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

📄

📁 VB开发的ERP系统
💻
📖 第 1 页 / 共 5 页
字号:
                    Load ydcommand(Jsqte)
                End If
                ydcommand(Jsqte).Visible = True
                ydcommand(Jsqte).Move LrText(Jsqte).Left + LrText(Jsqte).Width + 10, LrText(Jsqte).Top
            End If
            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 Sub Add_Tree()
    
    Dim aDo_Sort As New Recordset
    
    TreeView.Nodes.Clear
    TreeView.Nodes.Add , 4, "M", "部分增减", "Cl"
    TreeView.Nodes.Add , 4, "Z", "其它变动", "Cl"
    Set aDo_Sort = Cw_DataEnvi.DataConnect.Execute("select * from Gdzc_VariationMode where VariSort > 2 order by FAVariCode")
    With aDo_Sort
        Do While Not .EOF
            If aDo_Sort!VariSort = 3 Then
                Set nodX = TreeView.Nodes.Add("M", 4, "M" & Trim(.Fields("FAVariCode")), "(" & Trim(.Fields("FAVariCode")) & ")" & Trim(.Fields("FAVariName")), "C")
            ElseIf aDo_Sort!VariSort = 4 Then
                Set nodX = TreeView.Nodes.Add("Z", 4, "Z" & Trim(.Fields("FAVariCode")), "(" & Trim(.Fields("FAVariCode")) & ")" & Trim(.Fields("FAVariName")), "C")
            End If
            nodX.EnsureVisible
            .MoveNext
        Loop
    End With
    aDo_Sort.Close
    Set aDo_Sort = Nothing
    
End Sub

'用户录入条件有效性判断
Private Function Lrtjyxxpd() As Boolean
 
    Dim Jsqte As Integer
    Lrtjyxxpd = False
 
    '对需要进行事后判断的文本框录入内容进行有效性判断 (固定不变)
    For Jsqte = 0 To Max_Text_Index
        If Textint(Jsqte, 9) = 0 Or Textint(Jsqte, 9) = 2 Then
            If Not TextYxxpd(Jsqte) Then
                Exit Function
            End If
        End If
    Next Jsqte
    
    Lrtjyxxpd = True

End Function

'*******************以下区域为编写自定义过程区域**********************
'向文本框填充数据
Function Card_Rs()
    
    Sqlstr = "SELECT Gdzc_Card.*, Gdzc_Sort.FASortName AS FASortName," _
        & "Gy_Department.DeptName AS DeptName,Gdzc_State.FAStateName AS FAStateName," _
        & "Cwzz_VouchClass.VouchClassName AS VouchClassName FROM Gdzc_Card INNER JOIN " _
        & "Gdzc_Sort ON Gdzc_Card.FASortCode = Gdzc_Sort.FASortCode INNER JOIN " _
        & "Gdzc_State ON Gdzc_Card.FAStateCode = Gdzc_State.FaStateCode INNER JOIN " _
        & "Gy_Department ON Gdzc_Card.DeptCode = Gy_Department.DeptCode LEFT OUTER JOIN " _
        & "Cwzz_VouchClass ON Gdzc_Card.VouchClassCode = Cwzz_VouchClass.VouchClassCode"
    Sqlstr = Sqlstr & " where gdzc_card.cardcode='" & Trim(Lbl_Num.Caption) & "'"
    Set Rs_Temp = New ADODB.Recordset
    Rs_Temp.Open Sqlstr, Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
    With Rs_Temp
        If Not .EOF Then
            Lbl_FAName.Caption = Trim(!FAName & "")         '资产名称
            Lbl_Year.Caption = !Year                        '会计年度
            Lbl_Period.Caption = Format(!Period, "00")      '会计期间
            Lbl_Operator.Caption = !Opreator                '操作员
            LrText(0).Text = Trim(!VouchClassName & "")     '凭证类别
            LrText(0).Tag = Trim(!VouchClassCode)           '凭证类别编号
            LrText(1).Text = Trim(!VouchNo & "")            '凭证号
            LrText(2).Text = Trim(!DeptName)                '部门名称
            LrText(2).Tag = Trim(!DeptCode)                 '部门编号
            LrText(3).Text = Trim(!DeptName)                '部门名称
            LrText(3).Tag = Trim(!DeptCode)                 '部门编号
            LrText(4).Text = !FAValue                       '资产原值
            LrText(5).Text = !FAValue                       '资产原值
            LrText(6).Text = !FAQuantity                    '资产数量
            LrText(7).Text = !FAQuantity                    '资产数量
            LrText(9).Text = Trim(!FAStateName & "")        '使用状况名称
            LrText(9).Tag = Trim(!FAStateCode & "")         '使用状况编码
            LrText(10).Text = Trim(!FAStateName & "")       '是用状况名称
            LrText(10).Tag = Trim(!FAStateCode & "")        '使用状况编号
            LrText(11).Text = Trim(!FASortName & "")        '资产类别名称
            LrText(11).Tag = Trim(!FASortCode & "")         '资产类别编码
            LrText(12).Text = Trim(!FASortName & "")        '资产类别名称
            LrText(12).Tag = Trim(!FASortCode & "")         '资产类别编号
            LrText(13).Text = !DeprSum                      '累计折旧
            LrText(14).Text = !DeprSum                      '累计折旧
            LrText(15).Text = !Activities                   '工作总量
            LrText(16).Text = !Activities                   '工作总量
            LrText(17).Text = !FactValue                    '净资产
            LrText(18).Text = !FactValue                    '净资产
            LrText(19).Text = !Useyears                     '使用年限
            LrText(20).Text = !Useyears                     '使用年限
            Select Case !DeprMethod                         '折旧方法
                Case "01"
                    Com_DeprMethod(0).Text = "不计提折旧"
                    Com_DeprMethod(1).Text = "不计提折旧"
                Case "02"
                    Com_DeprMethod(0).Text = "平均年限法(依净资产计提折旧)"
                    Com_DeprMethod(1).Text = "平均年限法(依净资产计提折旧)"
                Case "03"
                    Com_DeprMethod(0).Text = "平均年限法(依帐面原值计提折旧)"
                    Com_DeprMethod(1).Text = "平均年限法(依帐面原值计提折旧)"
                Case "04"
                    Com_DeprMethod(0).Text = "工作量法"
                    Com_DeprMethod(1).Text = "工作量法"
                Case "05"
                    Com_DeprMethod(0).Text = "固定折旧额折旧法"
                    Com_DeprMethod(1).Text = "固定折旧额折旧法"
                Case "06"
                    Com_DeprMethod(0).Text = "年数总和法"
                    Com_DeprMethod(1).Text = "年数总和法"
                Case "07"
                    Com_DeprMethod(0).Text = "双倍余额法"
                    Com_DeprMethod(1).Text = "双倍余额法"
            End Select
        End If
    End With
    Rs_Temp.Close
    Set Rs_Temp = Nothing
    
End Function

'解锁
Function Open_Clock()

    LrText(0).Enabled = True
    LrText(1).Enabled = True
    LrText(3).Enabled = True
    LrText(5).Enabled = True
    LrText(7).Enabled = True
    LrText(8).Enabled = True
    LrText(10).Enabled = True
    LrText(12).Enabled = True
    LrText(14).Enabled = True
    LrText(16).Enabled = True
    LrText(18).Enabled = True
    LrText(20).Enabled = True
    Com_DeprMethod(1).Enabled = True
    QdCommand.Enabled = True
    
End Function

'加锁
Function Add_Clock()

    Dim i As Integer
    
    For i = 0 To LrText.count - 1
        LrText(i).Enabled = False
    Next i
    For i = 2 To LblName.count - 1
        If i = 8 Then i = 9
        LblName(i).ForeColor = &H0&
    Next i
    QdCommand.Enabled = False
    Com_DeprMethod(1).Enabled = False
    
End Function

'录入存盘
Function Save()

    If IsValidity = True Then
                
        Dim FAValue_Temp As Double              '修改原资产原值变量
        Dim DeprSum_temp As Double              '修改原累计折旧变量
        Dim Dept_Temp As String                 '部门编号
        Dim Sort As String                      '资产类别
                
        On Error GoTo Cwcl
        Cw_DataEnvi.DataConnect.BeginTrans
        
        '修改资产卡片表
        Set Rs_Temp = New ADODB.Recordset
        Rs_Temp.Open "select * from gdzc_card where cardcode='" & Trim(Lbl_Num.Caption) & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
        With Rs_Temp
            If Not .EOF Then
                Dept_Temp = !DeptCode
                Sort = !FASortCode
                !WhetherVariation = True                        '修改“是否发生变动标志”
                !FAValue = CCur(Val(LrText(5).Text))            '资产原值
                !DeptCode = Trim(LrText(3).Tag)                 '部门编号
                !FASortCode = Trim(LrText(12).Tag)              '资产类别编号
                !FAQuantity = Val(LrText(7).Text)               '资产数量
                !FAStateCode = Trim(LrText(10).Tag)             '使用状况编号
                !DeprSum = CCur(Val(LrText(14).Text))           '累计折旧
                !FactValue = CCur(Val(!FAValue) - Val(!DeprSum)) '净资产
                !Activities = Val(LrText(16).Text)              '工作总量
                !Useyears = Val(LrText(14).Text)                '使用年限
                !SalValue = CCur(Val(LrText(18).Text))          '净残值
                .Update
            End If
        End With
        Rs_Temp.Close
        Set Rs_Temp = Nothing
        
        '修改工作量表
        If Val(LrText(15).Text & "") <> Val(LrText(16).Text & "") Then
            Set Rs_Temp = New ADODB.Recordset
            Rs_Temp.Open "select * from Gdzc_JobQuantity where cardcode='" & Trim(Lbl_Num.Caption) & "' and year=" & Xtyear & " and period=" & Xtmm, Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
            With Rs_Temp
                If Not .EOF Then
                    !AcivitiesAEnd = Val(LrText(16).Text & "")  '变动后工作总量
                    .Update
                End If
            End With
            Rs_Temp.Close
            Set Rs_Temp = Nothing
        End If
        
        '修改固定资产明细帐
        Set Rs_Temp = New ADODB.Recordset
        Rs_Temp.Open "select * from Gdzc_DetailedForm where cardCode='" & Trim(Lbl_Num.Caption) & "' and FASortCode='" & Trim(LrText(12).Tag) & "' and year=" & Xtyear & " and period=" & Xtmm, Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
        With Rs_Temp
            If Not .EOF Then
                If Val(LrText(4).Text) <> Val(LrText(5).Text) Then
                    !FAValueEnd = CCur(Val(!FAValueEnd) + Val(LrText(5).Text))  '期末资产原值
                End If
                If Val(LrText(13).Text) <> Val(LrText(14).Text) Then
                    !DeprSumEnd = CCur(Val(!DeprSumEnd) + Val(LrText(14).Text)) '期末累计折旧
                End If
                .Update
            Else
                .AddNew
                !CardCode = Trim(Lbl_Num.Caption)                               '卡片编号
                !FASortCode = Trim(LrText(12).Tag)                              '资产类别
                !Year = Trim(Xt_Year.Caption)                                   '会计年度
                !Period = Val(Xt_Period.Caption)                                '会计期间
                !MmMake = False                                                 '录入期间标志
                !FAValueEnd = CCur(Val(LrText(5).Text))                         '期末资产原值
                !DeprSumEnd = CCur(LrText(14).Text)                             '期末累计折旧
                !DeprDate = Xtrq                                                '变动日期
                .Update
            End If
        End With
        Rs_Temp.Close
        Set Rs_Temp = Nothing
        
        '修改资产汇总表
        Set Rs_Temp = New ADODB.Recordset
        Rs_Temp.Open "select * from Gdzc_total where DeptCode='" & Trim(LrText(3).Tag) & "' and FASortCode='" & Trim(LrText(12).Tag) & "' and year=" & Xt_Year & " and Period=" & Xt_Period, Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
        With Rs_Temp
            If Not .EOF Then
                !FAvalueEndM = CCur(Val(!FAvalueEndM) - Val(LrText(4).Text) + Val(LrText(5).Text))
                !DeprSumEndM = CCur(Val(!DeprSumEndM) - Val(LrText(13).Text) + Val(LrText(14).Text))
                If Val(LrText(5).Text) - Val(LrText(4).Text) > 0 Then
                    !FAValueInM = CCur(Val(LrText(5).Text) - Val(LrText(4).Text))       '本期原值增加
                Else
                    !FAValueOutM = CCur(Val(LrText(4).Text) - Val(LrText(5).Text))      '本期原值减少
                End If
                If Val(Val(LrText(14).Text) - Val(LrText(13).Text)) > 0 Then
                    !DeprSumInM = CCur(Val(LrText(14).Text) - Val(LrText(13).Text))     '本期累计折旧增加
                Else
                    !DeprSumOutM = CCur(Val(LrText(13).Text) - Val(LrText(14).Text))    '本期累计折旧减少
                End If
                .Update
            Else
                .AddNew
                !DeptCode = Trim(LrText(3).Tag)                                         '所属部门
                !FASortCode = Trim(LrText(12).Tag)                                      '资产类别
                !Year = Trim(Xt_Year.Caption)                                           '会计年度
                !Period = Val(Xt_Period.Caption)                                        '会计期间
                !FAvalueEndM = CCur(Val(LrText(5).Text))                                '期末资产原值
                !DeprSumEndM = CCur(Val(LrText(14).Text))                               '期末累计折旧
                If Val(LrText(5).Text) - Val(LrText(4).Text) > 0 Then
                    !FAValueInM = CCur(Val(LrText(5).Text) - Val(LrText(4).Text))       '原值增加
                Else
                    !FAValueOutM = CCur(Val(LrText(4).Text) - Val(LrText(5).Text))      '原值减少
                End If
                If Val(Val(LrText(14).Text) - Val(LrText(13).Text)) > 0 Then
                    !DeprSumInM = CCur(Val(LrText(14).Text) - Val(LrText(13).Text))     '累计折旧增加
                Else
                    !DeprSumOutM = CCur(Val(LrText(13).Text) - Val(LrText(14).Text))    '累计折旧减少
                End If
                .Update
            End If
        End With
        Rs_Temp.Close
        Set Rs_Temp = Nothing
        
        '生成变动单
        Call Vari                 '生成变动单据号
        Set Rs_Temp = New ADODB.Recordset
        Rs_Temp.Open "select * from Gdzc_Variation where 1=2", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
        With Rs_Temp
            .AddNew
            !VariVouCode = Trim(MaxCode)                                                '变动单号
            !CardCode = Trim(Lbl_Num.Caption)                                           '卡片编号
            !Year = Val(Xt_Year.Caption)                                                '会计年度
            !Period = Val(Xt_Period.Caption)                                            '会计期间
            !varidate = Xtrq                                                            '变动日期
            !FAVariCode = Trim(Frame1.Tag)                                              '变动方式
            If Trim(LrText(0).Text) <> "" Then !VouchClassCode = Trim(LrText(0).Tag)    '凭证类别
            If Trim(LrText(1).Text) <> "" Then !VouchNo = Val(LrText(1).Text)           '凭证号
            !VariationReason = Trim(LrText(8).Text)                                     '变动原因
            !DeptOld = Trim(LrText(2).Tag)                                              '变动前部门
            !DeptNew = Trim(LrText(3).Tag)                                              '变动后部门
            !FAStateOld = Trim(LrText(9).Tag)                                           '变动前使用状况
            !FAStateNew = Trim(LrText(10).Tag)                                          '变动后使用状况
            !DeprMethOld = Trim("0" & Val(Com_DeprMethod(0).ListIndex + 1))             '变动前折旧方法
            !DeprMethNew = Trim("0" & Val(Com_DeprMethod(1).ListIndex + 1))             '变动后这就方法
            !FASortOld = Trim(LrText(11).Tag)                                           '变动前资产类别
            !FASortNew = Trim(LrText(12).Tag)                                           '变动后资产类别
            !FAValueOld = CCur(LrText(4).Text)                                          '变动前资产原值
            !FAValueNew = CCur(LrText(5).Text)                                          '变动后资产原值
            !SumDeprOld = CCur(LrText(13).Text)                                         '变动前累计折旧
            !SumDeprNew = CCur(LrText(14).Text)                                         '变动后累计折旧
            !ActivitiesOld = Val(LrText(15).Text)                                       '变动前工作总量
            !ActivitiesNew = Val(LrText(16).Text)                                       '变动后工作总量
            !SalValueOld = CCur(LrText(17).Text)                                        '变动前净残值
            !SalValueNew = CCur(LrText(18).Text)                                        '变动后净残值
            !UseYearsOld = Val(LrText(19).Text)                                         '变动前使用年限

⌨️ 快捷键说明

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