资源名称:ERPSYS.zip [点击查看]
上传用户:zhpu1995
上传日期:2013-09-06
资源大小:61151k
文件大小:8k
源码类别:
企业管理
开发平台:
Visual Basic
- VERSION 5.00
- Begin VB.Form Oper_DeprBack
- BorderStyle = 3 'Fixed Dialog
- Caption = "固定资产恢复计提折旧"
- ClientHeight = 1815
- ClientLeft = 45
- ClientTop = 330
- ClientWidth = 5355
- HelpContextID = 504003
- Icon = "固定资产恢复记提折旧.frx":0000
- LinkTopic = "Form1"
- LockControls = -1 'True
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 1815
- ScaleWidth = 5355
- ShowInTaskbar = 0 'False
- StartUpPosition = 2 '屏幕中心
- Begin VB.CommandButton QxCommand
- Cancel = -1 'True
- Caption = "取消(&C)"
- Height = 300
- Left = 2925
- TabIndex = 1
- Top = 1140
- Width = 1120
- End
- Begin VB.CommandButton QdCommand
- Caption = "确定(&O)"
- Height = 300
- Left = 1605
- TabIndex = 0
- Top = 1140
- Width = 1120
- End
- Begin VB.Label Lbl_Clew
- Alignment = 2 'Center
- ForeColor = &H00000000&
- Height = 285
- Left = 1080
- TabIndex = 2
- Top = 510
- Width = 3825
- End
- Begin VB.Image Image1
- Height = 480
- Left = 570
- Picture = "固定资产恢复记提折旧.frx":1042
- Stretch = -1 'True
- Top = 420
- Width = 480
- End
- End
- Attribute VB_Name = "Oper_DeprBack"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- '**********************************************
- '* 模 块 名 称 :固定资产恢复计提折旧
- '* 功 能 描 述 :反计提折旧
- '* 程序员姓名 : 徐衍民
- '* 最后修改人 : 徐衍民
- '* 最后修改时间:2001/12/08
- '* 备 注:
- '**********************************************
- Dim DeprM As Double '月折旧额
- Dim CardCode As String '卡片编号
- Dim Rs_Temp As ADODB.Recordset '打开数据集变量
- Dim rstemp As ADODB.Recordset '打开数据集变量
- Dim RecTemp As ADODB.Recordset '打开数据集变量
- Dim Sqlstr As String '字符串变量
- Dim Card_Str As String '字符串变量
- Dim YearTemp As Integer '会计年度
- Dim PeriodTemp As Integer '会计期间
- Dim FASortCode As String '资产类别编号
- Dim DeptCode As String '部门编号
- Dim FAValue As Double '资产原值
- Dim DeprSum As Double '资产累计折旧
- Dim MaxCode As Integer '最大变动单号
- Dim FAStateCode As String '资产使用状况编号
- Dim DeprMethod As String '折旧方法
- Dim Job As Double '工作总量
- Dim SalValue As Double '净残值
- Dim Quantity As Double '资产数量
- Dim Useyears As Double '使用年限
- Dim Tsxx As String '提示信息
- Private Sub Form_Load() '窗体装入
- '显示提示内容
- Set rstemp = New ADODB.Recordset
- rstemp.Open "select top 1 * from gy_kjrlb where gdzcjzbz='0'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- If Not rstemp.EOF Then
- YearTemp = rstemp!KjYear
- PeriodTemp = rstemp!Period
- Tsxx = "请确认是否恢复" + Trim(str(rstemp!KjYear)) + "年" + Mid(Trim(str(100 + rstemp!Period)), 2, 2) + "月计提折旧前状态?"
- Lbl_Clew.Caption = Tsxx
- Else
- Tsxx = "请确认是否恢复" + Trim(str(Xtyear)) + "年12月计提折旧前状态?"
- Lbl_Clew.Caption = Tsxx
- End If
- rstemp.Close
- Set rstemp = Nothing
- End Sub
- Private Sub QdCommand_Click() '确定
- Set Rs_Temp = New ADODB.Recordset
- Rs_Temp.Open "select * from gdzc_card where DeprFlag='0' and [Check-outFlag]='0'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- If Not Rs_Temp.EOF Then
- Tsxx = "本月已经恢复计提折旧!"
- Call Xtxxts(Tsxx, 0, 4)
- Unload Me
- Exit Sub
- End If
- On Error GoTo Cwcl
- Cw_DataEnvi.DataConnect.BeginTrans
- '固定资产恢复计提折旧
- Dim i As Integer
- Set RecTemp = New ADODB.Recordset
- Card_Str = "SELECT Gdzc_Card.* FROM Gdzc_Card LEFT OUTER JOIN Gdzc_State ON Gdzc_Card.FAStateCode = Gdzc_State.FaStateCode WHERE Gdzc_Card.WhetherNew = '0' AND Gdzc_State.DeprFlag = '1'"
- RecTemp.Open Card_Str, Cw_DataEnvi.DataConnect, adOpenKeyset, adLockOptimistic
- While Not RecTemp.EOF
- FAStateCode = RecTemp!FAStateCode
- FASortCode = RecTemp!FASortCode
- DeptCode = RecTemp!DeptCode
- CardCode = RecTemp!CardCode
- Call Depr
- RecTemp.MoveNext
- Wend
- RecTemp.Close
- Set RecTemp = Nothing
- '将卡片表中折旧标志赋成未折旧
- Cw_DataEnvi.DataConnect.Execute ("update gdzc_Card set deprFlag='0' where deprflag='1'")
- Cw_DataEnvi.DataConnect.CommitTrans
- Tsxx = "恢复本月折旧计提完毕!"
- Call Xtxxts(Tsxx, 0, 4)
- Unload Me
- Exit Sub
- Cwcl:
- Cw_DataEnvi.DataConnect.RollbackTrans
- Tsxx = "恢复计提折旧过程中出现未知错误,请核对相关数据!"
- Call Xtxxts(Tsxx, 0, 1)
- Exit Sub
- End Sub
- Private Sub QxCommand_Click() '取消
- Unload Me
- End Sub
- '固定资产反折旧
- Function Depr()
- '修改资产卡片表
- Set Rs_Temp = New ADODB.Recordset
- Sqlstr = "SELECT * from Gdzc_Card where CardCode='" & Trim(CardCode) & "'"
- Rs_Temp.Open Sqlstr, Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- With Rs_Temp
- If Not .EOF Then
- !deprmothes = Val(!deprmothes) - 1
- If !deprmothes <= 0 Then
- !deprmothes = 0
- !CardType = True
- End If
- !DeprSum = Format(Val(!DeprSum) - Val(!DeprValue), "##0.00")
- !FactValue = Format(Val(!FactValue) + Val(!DeprValue), "##0.00")
- !DeprFlag = False
- Job = !Activities
- SalValue = !SalValue
- Quantity = !FAQuantity
- Useyears = !Useyears
- FAValue = !FAValue
- DeprSum = !DeprSum
- DeprM = !DeprValue
- .Update
- End If
- End With
- Rs_Temp.Close
- Set Rs_Temp = Nothing
- '修改资产汇总表
- Set Rs_Temp = New ADODB.Recordset
- Sqlstr = "select * from Gdzc_total where deptCode='" & Trim(DeptCode) & "' and FASortCode='" & Trim(FASortCode) & "' " _
- & "and Year=" & YearTemp & " and period=" & PeriodTemp
- Rs_Temp.Open Sqlstr, Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- With Rs_Temp
- If Not .EOF Then
- !DeprSumEndM = Val(!DeprSumEndM) - Val(DeprM)
- !DeprSumInM = Val(!DeprSumInM) - Val(DeprM)
- .Update
- End If
- End With
- Rs_Temp.Close
- Set Rs_Temp = Nothing
- '修改资产明细表
- Set Rs_Temp = New ADODB.Recordset
- Sqlstr = "select * from Gdzc_DetailedForm where CardCode='" & Trim(CardCode) & "' and Year=" & Trim(YearTemp) & " and Period=" & Trim(PeriodTemp)
- Rs_Temp.Open Sqlstr, Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- If Not Rs_Temp.EOF Then
- Rs_Temp!DeprSumEnd = Val(Rs_Temp!DeprSumEnd) - Val(DeprM)
- Rs_Temp!DeprValue = 0
- Rs_Temp!DeprDate = Xtrq
- Rs_Temp.Update
- End If
- Rs_Temp.Close
- Set Rs_Temp = Nothing
- '生成资产变动记录
- Set Rs_Temp = New ADODB.Recordset
- Sqlstr = "select * from Gdzc_Variation where FAVariCode='00501' and year=" & Trim(YearTemp & "") & " and period=" & Trim(PeriodTemp & "")
- Rs_Temp.Open Sqlstr, Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- If Not Rs_Temp.EOF Then
- Rs_Temp.Delete
- Rs_Temp.Update
- End If
- Rs_Temp.Close
- Set Rs_Temp = Nothing
- End Function