资源名称:ERPSYS.zip [点击查看]
上传用户:zhpu1995
上传日期:2013-09-06
资源大小:61151k
文件大小:146k
源码类别:
企业管理
开发平台:
Visual Basic
- Left = 0
- TabIndex = 122
- Top = 0
- Width = 9510
- _ExtentX = 16775
- _ExtentY = 979
- ButtonWidth = 820
- ButtonHeight = 926
- AllowCustomize = 0 'False
- Appearance = 1
- Style = 1
- ImageList = "ImageList1"
- _Version = 393216
- BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
- NumButtons = 14
- BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "新增"
- Key = "zj"
- ImageKey = "xz"
- EndProperty
- BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "修改"
- Key = "xg"
- ImageKey = "xg"
- EndProperty
- BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "删除"
- Key = "sc"
- ImageKey = "sc"
- EndProperty
- BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Style = 4
- EndProperty
- BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "保存"
- Key = "bc"
- ImageKey = "bc"
- EndProperty
- BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "放弃"
- Key = "fq"
- ImageKey = "fq"
- EndProperty
- BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Style = 4
- EndProperty
- BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "首张"
- Key = "first"
- ImageKey = "first"
- EndProperty
- BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "上张"
- Key = "prev"
- ImageKey = "prev"
- EndProperty
- BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "下张"
- Key = "next"
- ImageKey = "next"
- EndProperty
- BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "末张"
- Key = "last"
- ImageKey = "last"
- EndProperty
- BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Style = 4
- EndProperty
- BeginProperty Button13 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "帮助"
- Key = "bz"
- ImageKey = "bz"
- EndProperty
- BeginProperty Button14 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "退出"
- Key = "fh"
- ImageKey = "tc"
- EndProperty
- EndProperty
- BorderStyle = 1
- End
- End
- Attribute VB_Name = "Kpgl_jbcz"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- '******************************************************************
- '* 模 块 名 称 :资产卡片录入
- '* 功 能 描 述 :
- '* 程序员姓名 :徐衍民
- '* 最后修改人 :徐衍民
- '* 最后修改时间:2001/11/27
- '* 备 注:
- '******************************************************************
- Dim Tsxx As String '系统信息提示
- Dim rstemp As ADODB.Recordset '打开数据集变量
- Dim MaxCode As String '最大值字符串变量
- Dim Ccur_bit As Boolean '币种本位币计算公式
- Public str_State As String '文本框编辑状态
- Public str_CardNumber As String '卡片编号
- Dim Str_RightEdit As String '编辑(新增、修改、删除)权限索引
- '以下为固定使用变量(文本框)
- Dim Textvar() As Variant '存储变体型文本框信息
- Dim Textboolean() As Boolean '存储布尔型文本框信息
- Dim Textint() As Integer '存储整型文本框信息
- Dim Textstr() As String '存储字符型文本框信息
- Dim Max_Text_Index As Integer '最大录入文本框索引值
- Dim TextGroupCode As String '文本框录入分组编码
- Dim TextValiLock As Boolean '文本框失去焦点是否进行有效性控制判断
- Dim TextValiJudgeLock() As Boolean '文本框录入有效性判断控制锁
- Dim CurTextIndex As Integer '当前文本框索引值
- Dim TextChangeLock As Boolean '文本框内容变换控制锁
- Dim Bln_Cancel As Boolean '取消按钮信息传递
- Private Sub Form_KeyPress(KeyAscii As Integer) '控 制 焦 点 转 移
- Dim jdzygs As Integer '控件焦点转移个数
- jdzygs = 52
- Select Case KeyAscii
- Case vbKeyReturn
- If Kjjdzy(jdzygs) Then
- KeyAscii = 0
- End If
- Case 39 '屏蔽"'"
- KeyAscii = 0
- End Select
- End Sub
- Private Sub Form_Load()
- '以下为文本框处理程序
- TextGroupCode = "Gdzc_CardJbcz"
- Call Drwbkxx(TextGroupCode, Textvar(), Textboolean(), Textint(), Textstr()) '读入文本框录入信息
- Call Wbkcsh
- SSTab1.Tab = 0
- Me.AutoRedraw = False
- Num_text.Text = str_CardNumber
- SetToolState
- '编辑(新增、修改、删除)权限索引
- Str_RightEdit = "Gdzc_Jbcz_Edit"
- End Sub
- '*******************以下区域为编写自定义过程区域**********************
- '设置工具栏按钮状态
- Private Sub SetToolState()
- If Me.AutoRedraw = False Then
- If Trim(str_State) = "1" Then
- SzToolbar.Buttons("xg").Enabled = False
- SzToolbar.Buttons("sc").Enabled = False
- SzToolbar.Buttons("bc").Enabled = True
- SzToolbar.Buttons("fq").Enabled = True
- SzToolbar.Buttons("first").Enabled = False
- SzToolbar.Buttons("prev").Enabled = False
- SzToolbar.Buttons("next").Enabled = False
- SzToolbar.Buttons("last").Enabled = False
- Call Open_Lock
- Me.AutoRedraw = True
- ElseIf Trim(str_State) = "2" Then
- Call Card_Edit(Trim(Num_text.Text))
- SzToolbar.Buttons("xg").Enabled = False
- SzToolbar.Buttons("sc").Enabled = False
- SzToolbar.Buttons("bc").Enabled = True
- SzToolbar.Buttons("fq").Enabled = True
- SzToolbar.Buttons("first").Enabled = False
- SzToolbar.Buttons("prev").Enabled = False
- SzToolbar.Buttons("next").Enabled = False
- SzToolbar.Buttons("last").Enabled = False
- Call Open_Lock
- Call Txt_Lock
- ElseIf Trim(str_State) = "4" Then
- Call Card_Edit(Trim(Num_text.Text))
- SzToolbar.Buttons("zj").Enabled = False
- SzToolbar.Buttons("xg").Enabled = False
- SzToolbar.Buttons("sc").Enabled = False
- SzToolbar.Buttons("bc").Enabled = False
- SzToolbar.Buttons("fq").Enabled = False
- SzToolbar.Buttons("first").Enabled = True
- SzToolbar.Buttons("prev").Enabled = True
- SzToolbar.Buttons("next").Enabled = True
- SzToolbar.Buttons("last").Enabled = True
- Call Txt_Lock
- Else
- Call Card_Edit(Trim(Num_text.Text))
- SzToolbar.Buttons("xg").Enabled = True
- SzToolbar.Buttons("sc").Enabled = True
- SzToolbar.Buttons("bc").Enabled = False
- SzToolbar.Buttons("fq").Enabled = False
- SzToolbar.Buttons("first").Enabled = True
- SzToolbar.Buttons("prev").Enabled = True
- SzToolbar.Buttons("next").Enabled = True
- SzToolbar.Buttons("last").Enabled = True
- Call Txt_Lock
- Set rstemp = New ADODB.Recordset
- rstemp.Open "select * from Gdzc_Card where CardCode='" & Trim(Lbl_Num.Caption) & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- If Not rstemp.EOF Then
- If rstemp!Year = Xtyear And rstemp!Period = Xtmm Then
- SzToolbar.Buttons("xg").Enabled = True
- SzToolbar.Buttons("sc").Enabled = True
- Else
- SzToolbar.Buttons("xg").Enabled = True
- SzToolbar.Buttons("sc").Enabled = False
- End If
- End If
- rstemp.Close
- Set rstemp = Nothing
- Set rstemp = Cw_DataEnvi.DataConnect.Execute("select top 1 * from gy_kjrlb where gdzcjzbz='0'")
- If Not rstemp.EOF Then
- If Val(rstemp!KjYear) <> Val(Xtyear) Or Val(rstemp!Period) <> Val(Xtmm) Then
- SzToolbar.Buttons("zj").Enabled = False
- Else
- SzToolbar.Buttons("zj").Enabled = True
- End If
- End If
- rstemp.Close
- Set rstemp = Nothing
- Set rstemp = Cw_DataEnvi.DataConnect.Execute("select * from Gdzc_Card")
- If rstemp.EOF Then
- SzToolbar.Buttons("xg").Enabled = False
- SzToolbar.Buttons("sc").Enabled = False
- End If
- rstemp.Close
- Set rstemp = Nothing
- Me.AutoRedraw = True
- End If
- End If
- End Sub
- '卡片存盘
- Function Lrbc() '保存
- Dim Depr_Str As String '折旧方法编号变量
- Dim NumTemp As Integer '文本框Index变量
- Dim str As String
- Dim rs As ADODB.Recordset
- '取得折旧方法编号
- Select Case Trim(Com_DeprMethod.Text) '折旧方法
- Case "不计提折旧"
- Depr_Str = "01"
- Case "平均年限法(依净资产计提折旧)"
- Depr_Str = "02"
- Case "平均年限法(依帐面原值计提折旧)"
- Depr_Str = "03"
- Case "工作量法"
- Depr_Str = "04"
- Case "固定折旧额折旧法"
- Depr_Str = "05"
- Case "年数总和法"
- Depr_Str = "06"
- Case "双倍余额法"
- Depr_Str = "07"
- End Select
- For NumTemp = 33 To 52 '自定义项
- If LrText(NumTemp).Visible = True Then
- LrText(NumTemp).Tag = Trim("zdy" & Val(NumTemp - 32))
- End If
- Next NumTemp
- If Trim(str_State) = "1" Then '新增
- On Error GoTo Cwcl
- Cw_DataEnvi.DataConnect.BeginTrans
- '增加资产卡片(Gdzc_Card)表
- Set rstemp = New ADODB.Recordset
- With rstemp
- .Open "select * from gdzc_card where 1=2", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- .AddNew
- .Fields("CardCode") = Trim(Lbl_Num.Caption) '卡片编号
- .Fields("FACode") = Trim(LrText(13).Text) '资产编号
- .Fields("FAName") = Trim(LrText(2).Text) '固定资产名称
- .Fields("FASortCode") = Trim(LrText(3).Tag) '资产类别编号
- .Fields("SpecificationMode") = Trim(LrText(16).Text) '规格型号
- .Fields("FAQuantity") = Val(LrText(14).Text) '资产数量
- .Fields("MeasureUnit") = Trim(LrText(4).Text) '计量单位
- .Fields("Year") = Val(Lbl_Year.Caption) '会计年度
- .Fields("Period") = Val(Lbl_Period.Caption) '会计期间
- .Fields("DeptCode") = Trim(LrText(5).Tag) '部门编号
- If Trim(Com_Type.Text) = "新增固定资产" Then '卡片类型(0-新增,1-原始)
- .Fields("CardType") = True
- .Fields("whetherNew") = True
- Else
- .Fields("CardType") = False
- .Fields("whetherNew") = False
- End If
- .Fields("Opreator") = Trim(Lbl_Operator.Caption) '操作员
- .Fields("FAVariCode") = Trim(LrText(6).Tag) '资产增加方式
- .Fields("SetLocaNum") = Trim(LrText(18).Text) '设备位号
- .Fields("FAStateCode") = Trim(LrText(7).Tag) '使用状况
- .Fields("UseYears") = Val(LrText(15).Text) '使用年限
- .Fields("DeprMothes") = Val(LrText(25).Text) '折旧月数
- .Fields("Activities") = Val(LrText(30).Text) '工作总量
- .Fields("DeprMethod") = Depr_Str '折旧方法
- .Fields("AcitvitiesSum") = Val(LrText(32).Text) '累计工作量
- If Trim(LrText(0).Text) <> "" Then .Fields("BeginUseDate") = Trim(LrText(0).Text) '开始使用日期
- .Fields("ForeignCurrCode") = Trim(LrText(12).Tag) '货币编码
- .Fields("ForeignValue") = CCur(Format(Val(LrText(21).Text), "##0.00")) '外币金额
- .Fields("AccRate") = Val(LrText(20).Text) '记帐汇率
- .Fields("FAValue") = CCur(Format(Val(LrText(22).Text), "##0.00")) '资产原值
- .Fields("DeprSum") = CCur(Format(Val(LrText(23).Text), "##0.00")) '累计折旧
- .Fields("FactValue") = CCur(Format(Val(Val(LrText(22).Text) - Val(LrText(23).Text)), "##0.00")) '净资产
- .Fields("DeprRate") = Val(LrText(27).Text) '月折旧率
- .Fields("DeprValue") = CCur(Format(Val(LrText(26).Text), "##0.00")) '月折旧额
- .Fields("SalRate") = Val(LrText(28).Text) '净残值率
- .Fields("SalValue") = CCur(Format(Val(LrText(29).Text), "##0.00")) '净残值
- .Fields("Product") = Trim(LrText(17).Text) '生产商
- .Fields("VouchClassCode") = Trim(LrText(11).Tag) '凭证类别
- If Trim(LrText(19).Text) <> "" Then .Fields("VouchNo") = Trim(LrText(19).Text) '凭证号
- If Trim(LrText(1).Text) <> "" Then .Fields("WriteDate") = CDate(LrText(1).Text) '录入日期
- .Fields("FACcode") = Trim(LrText(8).Tag) '固定资产折旧科目
- .Fields("DeprCcode") = Trim(LrText(9).Tag) '累计资产折旧科目
- .Fields("DeprMoneyCcode") = Trim(LrText(10).Tag) '折旧费用科目编码
- For NumTemp = 33 To 52 '自定义项
- If LrText(NumTemp).Text <> "" And LrText(NumTemp).Visible = True Then
- .Fields(Trim(LrText(NumTemp).Tag)) = Trim(LrText(NumTemp).Text)
- Set rs = New ADODB.Recordset
- rs.Open "select * from gdzc_custom where fieldcode='" & Trim(LrText(NumTemp).Tag) & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- If Not rs.EOF Then
- If rs.Fields("WhetherNull") = False Then rs.Fields("WhetherNull") = True
- rs.Update
- End If
- rs.Close
- Set rs = Nothing
- End If
- Next NumTemp
- .Update
- End With
- rstemp.Close
- Set rstemp = Nothing
- '当用户选择的资产折旧方法是“工作量法”时,追加工作量表
- If Trim(Com_DeprMethod.Text) = "工作量法" Then
- Set rstemp = New ADODB.Recordset
- With rstemp
- .Open "select * from Gdzc_jobquantity where 1=2", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- .AddNew
- .Fields("CardCode") = Trim(Lbl_Num.Caption) '卡片编号
- .Fields("Year") = Val(Lbl_Year.Caption) '会计年度
- .Fields("Period") = Val(Lbl_Period.Caption) '会计期间
- .Fields("ActivitiesStart") = Val(LrText(30).Text) '工作总量
- .Fields("AcivitiesAEnd") = Val(LrText(30).Text) '累计工作量
- .Fields("AcivitiesUnit") = Trim(LrText(31).Text) '工作量单位
- .Update
- End With
- rstemp.Close
- Set rstemp = Nothing
- End If
- '追加会计明细表记录
- Set rstemp = New ADODB.Recordset
- With rstemp
- .Open "select * from Gdzc_DetailedForm where 1=2", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- .AddNew
- .Fields("cardcode") = Trim(Lbl_Num.Caption) '卡片编号
- .Fields("FASortCode") = Trim(LrText(3).Tag) '资产类别编号
- .Fields("Year") = Trim(Lbl_Year.Caption) '会计年度
- .Fields("Period") = Trim(Lbl_Period.Caption) '会计期间
- .Fields("MmMake") = True '录入期间标志
- .Fields("FAValueEnd") = CCur(Format(Val(LrText(22).Text), "##0.00")) '资产原值
- .Fields("DeprsumEnd") = CCur(Format(Val(LrText(23).Text), "##0.00")) '期末累计折旧
- .Update
- End With
- rstemp.Close
- Set rstemp = Nothing
- '追加或修改资产汇总表记录
- Set rstemp = New ADODB.Recordset
- str = "select * from Gdzc_Total where DeptCode='" & Trim(LrText(5).Tag) & "' and FASortCode='" & Trim(LrText(3).Tag) & "' and Year=" & Val(Lbl_Year.Caption) & " and Period=" & Trim(Lbl_Period.Caption)
- rstemp.Open str, Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- With rstemp
- If .EOF Then
- .AddNew
- .Fields("Deptcode") = Trim(LrText(5).Tag) '部门编号
- .Fields("FASortCode") = Trim(LrText(3).Tag) '资产类别编号
- .Fields("Year") = Val(Lbl_Year.Caption) '会计年度
- .Fields("Period") = Val(Lbl_Period.Caption) '会计期间
- .Fields("FAValueEndM") = CCur(Format(Val(LrText(22).Text), "##0.00")) '月末原值
- .Fields("DeprSumEndM") = CCur(Format(Val(LrText(23).Text), "##0.00")) '月末累计折旧
- .Fields("FAValueInM") = CCur(Format(Val(LrText(22).Text), "##0.00")) '本期增加原值
- .Fields("DeprSumInM") = CCur(Format(Val(LrText(23).Text), "##0.00")) '本期累计折旧增加
- Else
- .Fields("FAValueEndM") = CCur(Format(Val(.Fields("FAValueEndM")) + Val(LrText(22).Text), "##0.00")) '月末原值
- .Fields("DeprSumEndM") = CCur(Val(.Fields("DeprSumEndM")) + Val(LrText(23).Text)) '月末累计折旧
- .Fields("FAValueInM") = CCur(Val(.Fields("FAValueInM")) + Val(LrText(22).Text)) '本期增加原值
- .Fields("DeprSumInM") = CCur(Val(.Fields("DeprSumInM")) + Val(LrText(23).Text)) '本期累计折旧增减
- End If
- .Update
- End With
- rstemp.Close
- Set rstemp = Nothing
- '追加资产变动单据表
- Call Vari
- Set rstemp = New ADODB.Recordset
- With rstemp
- .Open "Select * from Gdzc_Variation where 1=2", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- .AddNew
- .Fields("VariVouCode") = MaxCode '变动单号
- .Fields("CardCode") = Trim(Lbl_Num.Caption) '卡片编号
- .Fields("Year") = Trim(Lbl_Year.Caption) '会计年度
- .Fields("Period") = Trim(Lbl_Period.Caption) '会计期间
- .Fields("FAVariCode") = Trim(LrText(6).Tag) '资产变动
- .Fields("VouchClassCode") = Trim(LrText(11).Tag) '凭证类别
- .Fields("VouchNo") = Val(LrText(19).Text) '凭证号
- .Fields("VariationReason") = Trim(Com_Type.Text) '资产变动原因
- .Fields("DeptNew") = Trim(LrText(5).Tag) '所属部门
- .Fields("FAStateNew") = Trim(LrText(7).Tag) '使用状况
- .Fields("DeprMethNew") = Depr_Str '折旧方法
- .Fields("FASortNew") = Trim(LrText(3).Tag) '资产类别编号
- .Fields("FAValueNew") = CCur(Val(LrText(22).Text)) '资产原值
- .Fields("SumDeprNew") = CCur(Val(LrText(23).Text)) '资产累计折旧
- .Fields("ActivitiesNew") = Val(LrText(30).Text) '工作总量
- .Fields("SalValueNew") = CCur(Val(LrText(29).Text)) '净残值
- .Fields("UseYearsNew") = Val(LrText(15).Text) '使用年限
- .Fields("FAQuantityNew") = Val(LrText(14).Text) '资产数量
- .Fields("Opreator") = Trim(Lbl_Operator.Caption) '操作员
- .Fields("VariDate") = Xtrq
- .Update
- End With
- rstemp.Close
- Set rstemp = Nothing
- Cw_DataEnvi.DataConnect.CommitTrans
- MsgBox "保存完毕! ", vbOKOnly + vbInformation, "百利/ERP5.0-固定资产"
- Kpgl_CardList.Tj_YesNo = True
- Call Zdbm
- Call Txt_Clear
- TextChangeLock = True
- LrText(13).SetFocus
- Exit Function
- ElseIf Trim(str_State) = "2" 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
- '修改资产卡片(Gdzc_Card)表
- Set rstemp = New ADODB.Recordset
- With rstemp
- .Open "select * from gdzc_card where CardCode='" & Trim(Lbl_Num.Caption) & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- If Not .EOF Then
- FAValue_Temp = .Fields("FAValue") '借助变量存储修改资产原值
- DeprSum_temp = .Fields("DeprSum") '借助变量存储修改累计折旧
- Dept_Temp = .Fields("DeptCode")
- Sort = .Fields("FASortCode")
- .Fields("CardCode") = Trim(Lbl_Num.Caption) '卡片编号
- .Fields("FACode") = Trim(LrText(13).Text) '资产编号
- .Fields("FAName") = Trim(LrText(2).Text) '固定资产名称
- .Fields("FASortCode") = Trim(LrText(3).Tag) '资产类别编号
- .Fields("SpecificationMode") = Trim(LrText(16).Text) '规格型号
- .Fields("FAQuantity") = Val(LrText(14).Text) '资产数量
- .Fields("MeasureUnit") = Trim(LrText(4).Text) '计量单位
- .Fields("Year") = Val(Lbl_Year.Caption) '会计年度
- .Fields("Period") = Val(Lbl_Period.Caption) '会计期间
- .Fields("DeptCode") = Trim(LrText(5).Tag) '部门编号
- If Trim(Com_Type.Text) = "新增固定资产" Then '卡片类型(0-新增,1-原始)
- .Fields("CardType") = True
- .Fields("whetherNew") = True
- Else
- .Fields("CardType") = False
- .Fields("whetherNew") = False
- End If
- .Fields("Opreator") = Trim(Lbl_Operator.Caption) '操作员
- .Fields("FAVariCode") = Trim(LrText(6).Tag) '资产增加方式
- .Fields("SetLocaNum") = Trim(LrText(18).Text) '设备位号
- .Fields("FAStateCode") = Trim(LrText(7).Tag) '使用状况
- .Fields("UseYears") = Val(LrText(15).Text) '使用年限
- .Fields("DeprMothes") = Val(LrText(25).Text) '折旧月数
- .Fields("Activities") = Val(LrText(30).Text) '工作总量
- .Fields("DeprMethod") = Depr_Str '折旧方法
- .Fields("AcitvitiesSum") = Val(LrText(32).Text) '累计工作量
- If Trim(LrText(0).Text) <> "" Then .Fields("BeginUseDate") = Trim(LrText(0).Text) '开始使用日期
- .Fields("ForeignCurrCode") = Trim(LrText(12).Tag) '货币编码
- .Fields("ForeignValue") = CCur(Format(Val(LrText(21).Text), "##0.00")) '外币金额
- .Fields("AccRate") = Val(LrText(20).Text) '记帐汇率
- .Fields("FAValue") = CCur(Format(Val(LrText(22).Text), "##0.00")) '资产原值
- .Fields("DeprSum") = CCur(Format(Val(LrText(23).Text), "##0.00")) '累计折旧
- .Fields("FactValue") = CCur(Format(Val(Val(LrText(22).Text) - Val(LrText(23).Text)), "##0.00")) '净资产
- .Fields("DeprRate") = Val(LrText(27).Text) '月折旧率
- .Fields("DeprValue") = CCur(Format(Val(LrText(26).Text), "##0.00")) '月折旧额
- .Fields("SalRate") = Val(LrText(28).Text) '净残值率
- .Fields("SalValue") = CCur(Format(Val(LrText(29).Text), "##0.00")) '净残值
- .Fields("Product") = Trim(LrText(17).Text) '生产商
- .Fields("VouchClassCode") = Trim(LrText(11).Tag) '凭证类别
- .Fields("VouchNo") = Val(LrText(19).Text) '凭证号
- .Fields("WriteDate") = Trim(LrText(1).Text) '录入日期
- .Fields("FACcode") = Trim(LrText(8).Tag) '固定资产折旧科目
- .Fields("DeprCcode") = Trim(LrText(9).Tag) '累计资产折旧科目
- .Fields("DeprMoneyCcode") = Trim(LrText(10).Tag) '折旧费用科目编码
- For NumTemp = 33 To 52 '自定义项
- If LrText(NumTemp).Visible = True Then
- Set rs = New ADODB.Recordset
- rs.Open "select * from gdzc_custom where FieldCode='" & Trim(LrText(NumTemp).Tag) & "' and FieldState='1'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- If Not rs.EOF Then
- If rs!datatype = 2 Or rs!datatype = 3 Then
- .Fields(Trim(LrText(NumTemp).Tag)) = Val(LrText(NumTemp).Text)
- ElseIf rs!datatype = 4 Then
- .Fields(Trim(LrText(NumTemp).Tag)) = CCur(Val(Trim(LrText(NumTemp).Text)))
- ElseIf rs!datatype = 5 Then
- If Trim(LrText(NumTemp).Text) = "" Then
- .Fields(Trim(LrText(NumTemp).Tag)) = Null
- Else
- .Fields(Trim(LrText(NumTemp).Tag)) = Trim(LrText(NumTemp).Text & "")
- End If
- Else
- .Fields(Trim(LrText(NumTemp).Tag)) = Trim(LrText(NumTemp).Text & "")
- End If
- End If
- rs.Close
- Set rs = Nothing
- Set rs = New ADODB.Recordset
- rs.Open "select * from gdzc_custom where fieldcode='" & Trim(LrText(NumTemp).Tag) & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- If Not rs.EOF Then
- If rs.Fields("WhetherNull") = False Then rs.Fields("WhetherNull") = True
- rs.Update
- End If
- rs.Close
- Set rs = Nothing
- End If
- Next NumTemp
- .Update
- End If
- End With
- rstemp.Close
- Set rstemp = Nothing
- '当用户选择的资产折旧方法是“工作量法”时,修改工作量表
- If Trim(Com_DeprMethod.Text) = "工作量法" Then
- Set rstemp = New ADODB.Recordset
- With rstemp
- .Open "select * from Gdzc_jobquantity where CardCode='" & Trim(Lbl_Num.Caption) & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- If Not .EOF Then
- .Fields("CardCode") = Trim(Lbl_Num.Caption) '卡片编号
- .Fields("Year") = Val(Lbl_Year.Caption) '会计年度
- .Fields("Period") = Val(Lbl_Period.Caption) '会计期间
- .Fields("ActivitiesStart") = Val(LrText(30).Text) '工作总量
- .Fields("AcivitiesAEnd") = Val(LrText(30).Text) '累计工作量
- .Fields("AcivitiesUnit") = Trim(LrText(31).Text) '工作量单位
- .Update
- End If
- End With
- rstemp.Close
- Set rstemp = Nothing
- End If
- '修改会计明细表记录
- Set rstemp = New ADODB.Recordset
- With rstemp
- .Open "select * from Gdzc_DetailedForm where CardCode='" & Trim(Lbl_Num.Caption) & "' and year=" & Val(Lbl_Year.Caption) & " and period=" & Val(Lbl_Period.Caption), Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- .Fields("cardcode") = Trim(Lbl_Num.Caption) '卡片编号
- .Fields("FASortCode") = Trim(LrText(3).Tag) '资产类别编号
- .Fields("Year") = Trim(Lbl_Year.Caption) '会计年度
- .Fields("Period") = Trim(Lbl_Period.Caption) '会计期间
- .Fields("MmMake") = True '录入期间标志
- .Fields("FAValueEnd") = CCur(Format(Val(LrText(22).Text), "##0.00")) '资产原值
- .Fields("DeprSumEnd") = CCur(Format(Val(LrText(23).Text), "##0.00")) '期末累计折旧
- .Update
- End With
- rstemp.Close
- Set rstemp = Nothing
- '修改资产汇总表记录
- Set rstemp = New ADODB.Recordset
- str = "select * from Gdzc_Total where DeptCode='" & Trim(Dept_Temp) & "' and FASortCode='" & Trim(Sort) & "' and Year=" & Val(Lbl_Year.Caption) & " and Period=" & Trim(Lbl_Period.Caption)
- rstemp.Open str, Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- With rstemp
- If Not .EOF Then
- If Val(.Fields("FAValueEndM")) - Val(FAValue_Temp) = 0 Then
- .Delete
- .Update
- Else
- .Fields("FAValueEndM") = CCur(Format(Val(.Fields("FAValueEndM")) - FAValue_Temp + Val(LrText(22).Text), "##0.00")) '月末原值
- .Fields("DeprSumEndM") = CCur(Val(.Fields("DeprSumEndM")) - DeprSum_temp + Val(LrText(23).Text)) '月末累计折旧
- .Fields("FAValueInM") = CCur(Val(.Fields("FAValueInM")) - FAValue_Temp + Val(LrText(22).Text)) '本期增加原值
- .Fields("DeprSumInM") = CCur(Val(.Fields("DeprSumInM")) - DeprSum_temp + Val(LrText(23).Text)) '本期累计折旧增加
- .Update
- End If
- End If
- End With
- rstemp.Close
- Set rstemp = Nothing
- '追加或修改资产汇总表记录
- Set rstemp = New ADODB.Recordset
- str = "select * from Gdzc_Total where DeptCode='" & Trim(LrText(5).Tag) & "' and FASortCode='" & Trim(LrText(3).Tag) & "' and Year=" & Val(Lbl_Year.Caption) & " and Period=" & Trim(Lbl_Period.Caption)
- rstemp.Open str, Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- With rstemp
- If .EOF Then
- .AddNew
- .Fields("Deptcode") = Trim(LrText(5).Tag) '部门编号
- .Fields("FASortCode") = Trim(LrText(3).Tag) '资产类别编号
- .Fields("Year") = Val(Lbl_Year.Caption) '会计年度
- .Fields("Period") = Val(Lbl_Period.Caption) '会计期间
- .Fields("FAValueEndM") = CCur(Format(Val(LrText(22).Text), "##0.00")) '月末原值
- .Fields("DeprSumEndM") = CCur(Format(Val(LrText(23).Text), "##0.00")) '月末累计折旧
- .Fields("FAValueInM") = CCur(Format(Val(LrText(22).Text), "##0.00")) '本期增加原值
- .Fields("DeprSumInM") = CCur(Format(Val(LrText(23).Text), "##0.00")) '本期累计折旧增加
- Else
- .Fields("FAValueEndM") = CCur(Format(Val(.Fields("FAValueEndM")) + Val(LrText(22).Text), "##0.00")) '月末原值
- .Fields("DeprSumEndM") = CCur(Val(.Fields("DeprSumEndM")) + Val(LrText(23).Text)) '月末累计折旧
- .Fields("FAValueInM") = CCur(Val(.Fields("FAValueInM")) + Val(LrText(22).Text)) '本期增加原值
- .Fields("DeprSumInM") = CCur(Val(.Fields("DeprSumInM")) + Val(LrText(23).Text)) '本期累计折旧增减
- End If
- .Update
- End With
- rstemp.Close
- Set rstemp = Nothing
- '修改资产变动单据表
- Call Vari
- Set rstemp = New ADODB.Recordset
- With rstemp
- .Open "Select * from Gdzc_Variation where CardCode='" & Trim(Lbl_Num.Caption) & "' and year=" & Val(Lbl_Year.Caption) & " and Period=" & Val(Lbl_Period.Caption), Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- If Not .EOF Then
- .Fields("CardCode") = Trim(Lbl_Num.Caption) '卡片编号
- .Fields("Year") = Trim(Lbl_Year.Caption) '会计年度
- .Fields("Period") = Trim(Lbl_Period.Caption) '会计期间
- .Fields("FAVariCode") = Trim(LrText(6).Tag) '资产变动
- .Fields("VouchClassCode") = Trim(LrText(11).Tag) '凭证类别
- If Trim(LrText(19).Text) <> "" Then .Fields("VouchNo") = Trim(LrText(19).Text) '凭证号
- .Fields("VariationReason") = Trim(Com_Type.Text) '资产变动原因
- .Fields("DeptNew") = Trim(LrText(5).Tag) '所属部门
- .Fields("FAStateNew") = Trim(LrText(7).Tag) '使用状况
- .Fields("DeprMethNew") = Depr_Str '折旧方法
- .Fields("FASortNew") = Trim(LrText(3).Tag) '资产类别编号
- .Fields("FAValueNew") = CCur(Val(LrText(22).Text)) '资产原值
- .Fields("SumDeprNew") = CCur(Val(LrText(23).Text)) '资产累计折旧
- .Fields("ActivitiesNew") = Val(LrText(30).Text) '工作总量
- .Fields("SalValueNew") = CCur(Val(LrText(29).Text)) '净残值
- .Fields("UseYearsNew") = Val(LrText(15).Text) '使用年限
- .Fields("FAQuantityNew") = Val(LrText(14).Text) '资产数量
- .Fields("Opreator") = Trim(Lbl_Operator.Caption) '操作员
- .Fields("VariDate") = Xtrq
- .Update
- Else
- .AddNew
- .Fields("VariVouCode") = MaxCode '变动单号
- .Fields("CardCode") = Trim(Lbl_Num.Caption) '卡片编号
- .Fields("Year") = Trim(Lbl_Year.Caption) '会计年度
- .Fields("Period") = Trim(Lbl_Period.Caption) '会计期间
- .Fields("FAVariCode") = Trim(LrText(6).Tag) '资产变动
- .Fields("VouchClassCode") = Trim(LrText(11).Tag) '凭证类别
- If Trim(LrText(19).Text) <> "" Then .Fields("VouchNo") = Trim(LrText(19).Text) '凭证号
- .Fields("VariationReason") = Trim(Com_Type.Text) '资产变动原因
- .Fields("DeptNew") = Trim(LrText(5).Tag) '所属部门
- .Fields("FAStateNew") = Trim(LrText(7).Tag) '使用状况
- .Fields("DeprMethNew") = Depr_Str '折旧方法
- .Fields("FASortNew") = Trim(LrText(3).Tag) '资产类别编号
- .Fields("FAValueNew") = CCur(Val(LrText(22).Text)) '资产原值
- .Fields("SumDeprNew") = CCur(Val(LrText(23).Text)) '资产累计折旧
- .Fields("ActivitiesNew") = Val(LrText(30).Text) '工作总量
- .Fields("SalValueNew") = CCur(Val(LrText(29).Text)) '净残值
- .Fields("UseYearsNew") = Val(LrText(15).Text) '使用年限
- .Fields("FAQuantityNew") = Val(LrText(14).Text) '资产数量
- .Fields("Opreator") = Trim(Lbl_Operator.Caption) '操作员
- .Fields("VariDate") = Xtrq
- .Update
- End If
- End With
- rstemp.Close
- Set rstemp = Nothing
- Cw_DataEnvi.DataConnect.CommitTrans
- MsgBox "保存完毕! ", vbOKOnly + vbInformation, "百利/ERP5.0-固定资产"
- Kpgl_CardList.Tj_YesNo = True
- str_State = "3"
- Me.AutoRedraw = False
- SetToolState
- Exit Function
- Else
- Exit Function
- End If
- Cwcl:
- Cw_DataEnvi.DataConnect.RollbackTrans
- Tsxx = "您的输入有误导致存盘失败,请核对数据!"
- Call Xtxxts(Tsxx, 0, 1)
- Exit Function
- End Function
- '卡片自动编号
- Function Zdbm() '卡片自动编号
- Dim Max_Code As Double '最大值数值变量
- Set rstemp = New ADODB.Recordset
- rstemp.Open "select max(CardCode) as Max_CardCode from Gdzc_card", Cw_DataEnvi.DataConnect, adOpenKeyset, adLockOptimistic
- If Val(rstemp.Fields("Max_CardCode") & "") = 0 Then
- Max_Code = 1
- Else
- Max_Code = Val(rstemp.Fields("Max_CardCode")) + 1
- End If
- rstemp.Close
- Set rstemp = Nothing
- MaxCode = IIf(Max_Code < 10, "00000" & Max_Code, IIf(Max_Code < 100, "0000" & Max_Code, IIf(Max_Code < 1000, "000" & Max_Code, IIf(Max_Code < 10000, "00" & Max_Code, IIf(Max_Code < 100000, "0" & Max_Code, Max_Code)))))
- Lbl_Num.Caption = MaxCode
- End Function
- '变动单自动编号
- Function Vari()
- Dim Max_Code As Double '最大值数值变量
- Set rstemp = New ADODB.Recordset
- rstemp.Open "select max(VariVouCode) as Max_CardCode from Gdzc_Variation", Cw_DataEnvi.DataConnect, adOpenKeyset, adLockOptimistic
- If Val(rstemp.Fields("Max_CardCode") & "") = 0 Then
- Max_Code = 1
- Else
- Max_Code = Val(rstemp.Fields("Max_CardCode")) + 1
- End If
- rstemp.Close
- Set rstemp = Nothing
- MaxCode = IIf(Max_Code < 10, "00000" & Max_Code, IIf(Max_Code < 100, "0000" & Max_Code, IIf(Max_Code < 1000, "000" & Max_Code, IIf(Max_Code < 10000, "00" & Max_Code, IIf(Max_Code < 100000, "0" & Max_Code, Max_Code)))))
- End Function
- '根据折旧方法的选择,决定工作总量、工作量单位和累计工作量文本框的Enable状态
- Private Sub Com_DeprMethod_Click()
- If str_State = "1" Or str_State = "2" Then
- If Trim(Com_DeprMethod.Text) = "工作量法" Or Trim(Com_DeprMethod.Text) = "不计提折旧" Then
- LrText(30).Enabled = True
- LrText(31).Enabled = True
- LrText(32).Enabled = True
- LrText(26).Enabled = False
- LrText(27).Enabled = False
- Else
- LrText(26).Enabled = True
- LrText(27).Enabled = True
- LrText(30).Enabled = False
- LrText(31).Enabled = False
- LrText(32).Enabled = False
- End If
- End If
- End Sub
- '显示自定义项
- Function Define()
- Dim i As Integer
- Set rstemp = New ADODB.Recordset
- rstemp.Open "select * from Gdzc_custom where FieldState='1'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- i = 33
- While Not rstemp.EOF
- Lblzdy(i).Visible = True
- LrText(i).Visible = True
- Lblzdy(i).Caption = rstemp.Fields("FieldName") & ":"
- LrText(i).Tag = rstemp.Fields("FieldCode")
- Lblzdy(i).Left = LrText(i).Left - 25 - Lblzdy(i).Width
- rstemp.MoveNext
- i = i + 1
- Wend
- rstemp.Close
- Set rstemp = Nothing
- End Function
- '固定资产折旧算法
- Function DeprMethod()
- If Val(Lbl_FactValue.Caption) = 0 Or Val(LrText(15).Text) = 0 Then Exit Function
- Select Case Trim(Com_DeprMethod.Text) '折旧方法
- Case "平均年限法(依净资产计提折旧)"
- '月折旧额=净资产÷剩余使用年限÷12
- '月折旧率=月折旧额÷净资产
- LrText(26).Text = Format(Val(Lbl_FactValue.Caption) / (Val(LrText(15).Text) - (Val(LrText(25).Text) / 12)), "##0.00") / 12 '月折旧额
- LrText(27).Text = Format(Val(LrText(26).Text) / Val(Lbl_FactValue.Caption), "##0.000000") '月折旧率
- Case "平均年限法(依帐面原值计提折旧)"
- '月折旧额=(资产记帐原值-预计净残值)÷预计使用年限÷12
- '月折旧率=记帐原值×(1-残值率)×12÷使用年限
- LrText(26).Text = Format(Val(LrText(22).Text) * (1 - Val(LrText(28).Text)) / Val(LrText(15).Text) / 12, "##0.00") '月折旧额
- LrText(27).Text = Format(Val(LrText(26).Text) * (1 - Val(LrText(28).Text)) * 12 / Val(Lbl_FactValue.Caption), "##0.000000") '月折旧率
- Case "工作量法"
- '单位工作量折旧额=(记帐原值-预计净残值)÷工作总量
- '月折旧额=该月工作总量×单位工作量折旧额
- '注:计算方法在每月固定资产计提折旧时用,在这里将月折旧率和月折旧额文本框的Enable属性赋为False
- Case "固定折旧额折旧法"
- '月折旧额=记帐原值×月折旧率
- LrText(26).Text = Format(Val(LrText(22).Text) * Val(LrText(27).Text), "##0.00") '月折旧额
- Case "年数总和法"
- '年折旧率={(预计使用年限-已经使用年限)÷[预计使用年限×(1+预计使用年限)÷2]}×100%
- '月折旧率=年折旧率÷12
- '月折旧额=(记帐原值-净残值)×月折旧率
- LrText(27).Text = Format(Val(Val(LrText(15).Text) - Val(Val(LrText(25).Text) 12)) / Val(Val(LrText(15).Text) * Val(1 + Val(LrText(15).Text)) / 2) / 12, "##0.000000")
- LrText(26).Text = Format(Val(LrText(22).Text) * (1 - Val(LrText(28).Text)) * Val(LrText(27).Text), "##0.00") '月折旧额
- Case "双倍余额法"
- '年折旧率=(2÷预计使用年限)×100%
- '年折旧额=年初固定资产净值×年折旧率
- '月折旧额=年折旧额÷12
- LrText(26).Text = Format(Val(Lbl_FactValue.Caption) * Val(Val(1 - Val(2 / Val(LrText(15).Text))) ^ Val(Val(LrText(15).Text) 12)) * Val(2 / Val(LrText(15).Text)) / 12, "##0.00") '月折旧额
- LrText(27).Text = Format(Val(2 / Val(LrText(15).Text)) / 12, "##0.000000") '月折旧率
- End Select
- End Function
- '根据资产类别设置取得资产折旧方法、月折旧率、月折旧额和残值率
- Function From_Sort()
- Set rstemp = New ADODB.Recordset
- rstemp.Open "select * from Gdzc_Sort where FASortCode='" & Trim(LrText(3).Tag) & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- If Not rstemp.EOF Then
- LrText(15).Text = rstemp!Useyears
- LrText(28).Text = Val(rstemp!SalvageRate) / 100
- LrText(27).Text = Val(rstemp!DeprRate) / 100
- Select Case rstemp!DeprMethod
- Case "01"
- Com_DeprMethod.Text = "不计提折旧"
- Case "02"
- Com_DeprMethod.Text = "平均年限法(依净资产计提折旧)"
- Case "03"
- Com_DeprMethod.Text = "平均年限法(依帐面原值计提折旧)"
- Case "04"
- Com_DeprMethod.Text = "工作量法"
- Case "05"
- Com_DeprMethod.Text = "固定折旧额折旧法"
- Case "06"
- Com_DeprMethod.Text = "年数总和法"
- Case "07"
- Com_DeprMethod.Text = "双倍余额法"
- End Select
- Else
- LrText(15).Text = ""
- LrText(28).Text = ""
- LrText(27).Text = ""
- Com_DeprMethod.Text = "不计提折旧"
- End If
- rstemp.Close
- Set rstemp = Nothing
- End Function
- '根据用户选择的币种,取得汇率
- Function From_Ccur()
- Set rstemp = New ADODB.Recordset
- rstemp.Open "select * from Gy_ForeignCurrency where ForeignCurrCode='" & Trim(LrText(12).Tag) & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- If Not rstemp.EOF Then
- LrText(20).Text = rstemp!accrate
- Ccur_bit = rstemp!ConVertFlag
- Else
- LrText(20).Text = ""
- End If
- rstemp.Close
- Set rstemp = Nothing
- End Function
- '为卡片修改赋值
- Function Card_Edit(str As String)
- Dim Sqlstr As String
- Dim Custom_Num As Integer
- Dim Fields_Num As Integer '字段个数变量
- Set rstemp = New ADODB.Recordset
- rstemp.Open "select * from Gdzc_Custom where FieldState=1", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- If Not rstemp.EOF Then
- Custom_Num = rstemp.RecordCount
- End If
- rstemp.Close
- Set rstemp = Nothing
- Sqlstr = "SELECT Gdzc_Card.*, Gdzc_JobQuantity.AcivitiesUnit AS AcivitiesUnit, " _
- & "Gdzc_Sort.FASortName AS FASortName,Cwzz_VouchClass.VouchClassName AS VouchClassName, " _
- & "Gdzc_State.FAStateName AS FAStateName,Gy_Department.DeptName AS DeptName, " _
- & "Gdzc_VariationMode.FAVariName AS FAVariName,Gy_ForeignCurrency.ForeignCurrName AS ForeignCurrName, " _
- & "Cwzz_AccCode.Cname AS FACcode_Name,Cwzz_AccCode_1.Cname AS DeprCcode_Name, " _
- & "Cwzz_AccCode_2.Cname AS DeprMoneyCcode_Name FROM Gdzc_Card LEFT OUTER JOIN " _
- & "Gdzc_VariationMode ON Gdzc_Card.FAVariCode = Gdzc_VariationMode.FAVariCode LEFT OUTER JOIN " _
- & "Gdzc_Sort ON Gdzc_Card.FASortCode = Gdzc_Sort.FASortCode LEFT OUTER JOIN Gy_Department ON " _
- & "Gdzc_Card.DeptCode = Gy_Department.DeptCode LEFT OUTER JOIN " _
- & "Gdzc_State ON Gdzc_Card.FAStateCode = Gdzc_State.FaStateCode LEFT OUTER JOIN " _
- & "Gy_ForeignCurrency ON Gdzc_Card.ForeignCurrCode = Gy_ForeignCurrency.ForeignCurrCode LEFT OUTER JOIN " _
- & "Cwzz_VouchClass ON Gdzc_Card.VouchClassCode = Cwzz_VouchClass.VouchClassCode LEFT OUTER JOIN " _
- & "Gdzc_JobQuantity ON Gdzc_Card.CardCode = Gdzc_JobQuantity.CardCode LEFT OUTER JOIN " _
- & "Cwzz_AccCode ON Gdzc_Card.FACcode = Cwzz_AccCode.Ccode LEFT OUTER JOIN Cwzz_AccCode Cwzz_AccCode_1 ON " _
- & "Gdzc_Card.DeprCcode = Cwzz_AccCode_1.Ccode LEFT OUTER JOIN Cwzz_AccCode Cwzz_AccCode_2 ON " _
- & "Gdzc_Card.DeprMoneyCcode = Cwzz_AccCode_2.Ccode"
- Sqlstr = Sqlstr & " where Gdzc_Card.CardCode='" & Trim(str) & "'"
- Set rstemp = New ADODB.Recordset
- rstemp.Open Sqlstr, Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- With rstemp
- If Not rstemp.EOF Then
- LrText(0).Text = Trim(!BeginUsedate & "") '开始使用日期
- LrText(1).Text = Trim(!WriteDate & "") '记帐日期
- LrText(2).Text = Trim(!FAName & "") '资产名称
- LrText(3).Text = Trim(!FASortName & "") '资产类别名称
- LrText(3).Tag = Trim(!FASortCode & "") '资产类别编号
- LrText(4).Text = Trim(!Measureunit & "") '计量单位
- LrText(5).Text = Trim(!DeptName & "") '部门名称
- LrText(5).Tag = Trim(!DeptCode & "") '部门编号
- LrText(6).Text = Trim(!FAVariName & "") '增加方式名称
- LrText(6).Tag = Trim(!FAVariCode & "") '增加方式编号
- LrText(7).Text = Trim(!FAStateName & "") '使用状况名称
- LrText(7).Tag = Trim(!FAStateCode & "") '使用状况编号
- LrText(8).Text = Trim(!FACcode_Name & "") '资产科目名称
- LrText(8).Tag = Trim(!FACcode & "") '资产科目编号
- LrText(9).Text = Trim(!DeprCcode_Name & "") '累计折旧名称
- LrText(9).Tag = Trim(!DeprCcode & "") '累计折旧编号
- LrText(10).Text = Trim(!DeprMoneyCcode_Name & "") '折旧费用科目名称
- LrText(10).Tag = Trim(!DeprMoneyCcode & "") '折旧费用科目编号
- LrText(11).Text = Trim(!VouchClassName & "") '凭证类别名称
- LrText(11).Tag = Trim(!VouchClassCode & "") '凭证类别编号
- LrText(12).Text = Trim(!ForeignCurrName & "") '币种类别名称
- LrText(12).Tag = !ForeignCurrCode '币种类别编号
- LrText(13).Text = Trim(!FACode & "") '资产编号
- LrText(14).Text = !FAQuantity '资产数量
- LrText(15).Text = !Useyears '使用年限
- LrText(16).Text = Trim(!SpecificationMode & "") '规格型号
- LrText(17).Text = Trim(!Product & "") '生产商
- LrText(18).Text = Trim(!SetLocaNum & "") '设备位号
- LrText(19).Text = Trim(!VouchNo & "") '凭证号
- LrText(20).Text = !accrate '记帐汇率
- LrText(21).Text = !ForeignValue '外币金额
- LrText(22).Text = !FAValue '资产原值
- LrText(23).Text = !DeprSum '累计折旧
- LrText(24).Text = !FAValue '本位币值
- LrText(25).Text = !deprmothes '折旧月数
- LrText(26).Text = !DeprValue '月折旧额
- LrText(27).Text = !DeprRate '月折旧率
- LrText(28).Text = !SalRate '残值率
- LrText(29).Text = !SalValue '净残值
- LrText(30).Text = !Activities '工作总量
- LrText(31).Text = Trim(!AcivitiesUnit & "") '工作量单位
- LrText(32).Text = !AcitvitiesSum '累计工作量
- Lbl_Num.Caption = !CardCode '卡片编号
- Lbl_Year.Caption = !Year '会计年度
- Lbl_Period.Caption = Format(!Period, "00") '会计期间
- Lbl_Operator.Caption = !Opreator '操作员
- Lbl_FactValue.Caption = !FactValue '净资产
- Select Case .Fields("DeprMethod") ' 折旧方法 '折旧方法
- Case "01"
- Com_DeprMethod.Text = "不计提折旧"
- Case "02"
- Com_DeprMethod.Text = "平均年限法(依净资产计提折旧)"
- Case "03"
- Com_DeprMethod.Text = "平均年限法(依帐面原值计提折旧)"
- Case "04"
- Com_DeprMethod.Text = "工作量法"
- Case "05"
- Com_DeprMethod.Text = "固定折旧额折旧法"
- Case "06"
- Com_DeprMethod.Text = "年数总和法"
- Case "07"
- Com_DeprMethod.Text = "双倍余额法"
- End Select
- If !CardType = True Then
- Com_Type.Text = "新增固定资产" '卡片类型
- Else
- Com_Type.Text = "原始卡片录入"
- End If
- If Val(Custom_Num) > 0 Then
- For Fields_Num = 1 To Custom_Num '用户自定义属性
- If Trim(.Fields("zdy" & Val(Val(Fields_Num))) & " ") = "" Then
- LrText(Val(Fields_Num) + 32).Text = ""
- Else
- LrText(Val(Fields_Num) + 32).Text = Trim(.Fields("zdy" & Val(Val(Fields_Num))) & " ")
- End If
- Next Fields_Num
- End If
- End If
- End With
- rstemp.Close
- Set rstemp = Nothing
- Me.AutoRedraw = True
- End Function
- '录入完毕,清空录入文本框
- Function Txt_Clear()
- Dim i As Integer '文本框索引
- For i = 0 To LrText.count - 1
- If Trim(str_State) = "1" Then
- If i = 1 Then i = 2
- If i = 3 Then i = 4
- If i = 5 Then i = 8
- If i = 12 Then i = 13
- If i = 15 Then i = 16
- If i = 20 Then i = 21
- End If
- If i = 12 Then i = 13
- If i = 20 Then i = 21
- LrText(i).Text = ""
- Next
- Lbl_FactValue.Caption = ""
- LrText(14).Text = "1"
- LrText(1).Text = Xtrq
- End Function
- '移动记录指针函数
- Function Recordset_Move(Rs_int As Integer)
- Dim Rs_Temp As ADODB.Recordset
- Set Rs_Temp = New ADODB.Recordset
- Rs_Temp.Open "select * from Gdzc_card order by CardCode", Cw_DataEnvi.DataConnect, adOpenKeyset, adLockOptimistic
- Rs_Temp.Find "cardcode='" & Trim(Num_text.Text) & "'"
- If Rs_Temp.EOF And Rs_Temp.BOF Then
- Tsxx = "没有需要操作的卡片!"
- Call Xtxxts(Tsxx, 0, 4)
- Exit Function
- Else
- With Rs_Temp
- Select Case Rs_int
- Case 1
- .MoveFirst
- SzToolbar.Buttons("first").Enabled = False
- SzToolbar.Buttons("prev").Enabled = False
- SzToolbar.Buttons("next").Enabled = True
- SzToolbar.Buttons("last").Enabled = True
- Case 2
- .MovePrevious
- If .BOF And .RecordCount > 0 Then
- .MoveFirst
- SzToolbar.Buttons("first").Enabled = False
- SzToolbar.Buttons("prev").Enabled = False
- SzToolbar.Buttons("next").Enabled = True
- SzToolbar.Buttons("last").Enabled = True
- Else
- SzToolbar.Buttons("first").Enabled = True
- SzToolbar.Buttons("prev").Enabled = True
- SzToolbar.Buttons("next").Enabled = True
- SzToolbar.Buttons("last").Enabled = True
- End If
- Case 3
- .MoveNext
- If .EOF And .RecordCount > 0 Then
- .MoveLast
- SzToolbar.Buttons("first").Enabled = True
- SzToolbar.Buttons("prev").Enabled = True
- SzToolbar.Buttons("next").Enabled = False
- SzToolbar.Buttons("last").Enabled = False
- Else
- SzToolbar.Buttons("first").Enabled = True
- SzToolbar.Buttons("prev").Enabled = True
- SzToolbar.Buttons("next").Enabled = True
- SzToolbar.Buttons("last").Enabled = True
- End If
- Case 4
- .MoveLast
- SzToolbar.Buttons("first").Enabled = True
- SzToolbar.Buttons("prev").Enabled = True
- SzToolbar.Buttons("next").Enabled = False
- SzToolbar.Buttons("last").Enabled = False
- End Select
- End With
- Call Card_Edit(Rs_Temp!CardCode)
- Num_text.Text = Rs_Temp!CardCode
- End If
- Rs_Temp.Close
- Set Rs_Temp = Nothing
- End Function
- '对文本框加锁
- Function Txt_Lock()
- If Trim(str_State) = "3" Or Trim(str_State) = "4" Then
- For i = 0 To LrText.count - 1
- LrText(i).Enabled = False
- Next i
- Com_DeprMethod.Enabled = False
- Com_Type.Enabled = False
- ElseIf Trim(str_State) = "2" Then
- If Txt_Bit = False Then
- For i = 0 To LrText.count - 1
- If i = 0 Then i = 1
- If i = 4 Then i = 5
- If i = 8 Then i = 12
- If i = 16 Then i = 20
- If i = 31 Then i = 32
- Com_DeprMethod.Enabled = False
- Com_Type.Enabled = False
- LrText(i).Enabled = False
- Next i
- End If
- End If
- End Function
- '解锁
- Function Open_Lock()
- For i = 0 To LrText.count - 1
- LrText(i).Enabled = True
- Next i
- If Trim(Com_DeprMethod.Text) = "工作量法" Then
- LrText(30).Enabled = True
- LrText(31).Enabled = True
- LrText(32).Enabled = True
- Else
- LrText(30).Enabled = False
- LrText(31).Enabled = False
- LrText(32).Enabled = False
- End If
- If Trim(Com_DeprMethod.Text) = "不计提折旧" Then
- LrText(26).Enabled = False
- LrText(27).Enabled = False
- Else
- LrText(26).Enabled = True
- LrText(27).Enabled = True
- End If
- Com_DeprMethod.Enabled = True
- Com_Type.Enabled = True
- End Function
- '卡片删除操作
- Function Card_Del()
- Dim FAValue_Temp As Double '修改原资产原值变量
- Dim DeprSum_temp As Double '修改原累计折旧变量
- Dim DeptCode_temp As String '部门编号
- Dim FASortCode_temp As String '资产类别编号
- Dim str As String
- Dim rs As ADODB.Recordset
- '判断用户是否有此功能执行权限,如有则写上机日志(进入)
- If Not Security_Log(Str_RightEdit, Xtczybm, 1, True) Then
- Exit Function
- End If
- Set rstemp = New ADODB.Recordset
- rstemp.Open "select * from Gdzc_Variation where FAVariCode='00501' and Cardcode='" & Trim(Lbl_Num.Caption) & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- If Not rstemp.EOF Then
- Tsxx = "该资产卡片已经计提折旧,不能删除!"
- Call Xtxxts(Tsxx, 0, 4)
- Exit Function
- End If
- rstemp.Close
- Set rstemp = Nothing
- Set rstemp = New ADODB.Recordset
- rstemp.Open "select * from gdzc_card where CardCode='" & Trim(Lbl_Num.Caption) & "' and year=" & CInt(Xtyear) & " and period=" & CInt(Xtmm), Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- If rstemp.EOF Then
- Tsxx = "请操作本会计期间数据!"
- Call Xtxxts(Tsxx, 0, 4)
- Exit Function
- End If
- rstemp.Close
- Set rstemp = Nothing
- If MsgBox("真的要删除该记录吗?", vbOKCancel + vbDefaultButton2 + vbQuestion, "百利/ERP5.0-固定资产") = vbOK Then
- On Error GoTo Cwcl
- Cw_DataEnvi.DataConnect.BeginTrans
- '删除资产卡片
- Set rstemp = New ADODB.Recordset
- rstemp.Open "select * from Gdzc_Card where CardCode='" & Trim(Lbl_Num.Caption) & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- If Not rstemp.EOF Then
- FAValue_Temp = rstemp.Fields("FAValue") '借助变量存储修改资产原值
- DeprSum_temp = rstemp.Fields("DeprSum")
- DeptCode_temp = rstemp.Fields("DeptCode")
- FASortCode_temp = rstemp.Fields("FASortCode")
- rstemp.Delete
- rstemp.Update
- Else
- Tsxx = "请操作本会计期间的记录!"
- Call Xtxxts(Tsxx, 0, 4)
- Exit Function
- End If
- rstemp.Close
- Set rstemp = Nothing
- '删除工作量表
- Set rstemp = New ADODB.Recordset
- With rstemp
- .Open "select * from Gdzc_jobquantity where CardCode='" & Trim(Lbl_Num.Caption) & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- If Not .EOF Then
- .Delete
- .Update
- End If
- End With
- rstemp.Close
- Set rstemp = Nothing
- '删除会计明细表记录
- Set rstemp = New ADODB.Recordset
- With rstemp
- .Open "select * from Gdzc_DetailedForm where CardCode='" & Trim(Lbl_Num.Caption) & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- .Delete
- .Update
- End With
- rstemp.Close
- Set rstemp = Nothing
- '修改资产汇总表记录
- Set rstemp = New ADODB.Recordset
- str = "select * from Gdzc_Total where DeptCode='" & DeptCode_temp & "' and FASortCode='" & FASortCode_temp & "'"
- rstemp.Open str, Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- With rstemp
- If Not .EOF Then
- If Val(.Fields("FAValueEndM")) = Val(FAValue_Temp) Then
- .Delete
- .Update
- Else
- .Fields("FAValueEndM") = CCur(Format(Val(.Fields("FAValueEndM")) - FAValue_Temp, "##0.00")) '月末原值
- .Fields("DeprSumEndM") = CCur(Val(.Fields("DeprSumEndM")) - DeprSum_temp) '月末累计折旧
- .Fields("FAValueInM") = CCur(Val(.Fields("FAValueInM")) - FAValue_Temp) '本期增加原值
- .Fields("DeprSumInM") = CCur(Val(.Fields("DeprSumInM")) - DeprSum_temp) '本期累计折旧增加
- .Update
- End If
- End If
- End With
- rstemp.Close
- Set rstemp = Nothing
- '删除资产变动单据表
- Set rstemp = New ADODB.Recordset
- With rstemp
- .Open "Select * from Gdzc_Variation where CardCode='" & Trim(Lbl_Num.Caption) & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- While Not .EOF
- .Delete
- .Update
- .MoveNext
- Wend
- End With
- rstemp.Close
- Set rstemp = Nothing
- '判断并修改自定义属性表
- Set rstemp = New ADODB.Recordset
- rstemp.Open "select * from gdzc_Custom where FieldState='1'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- While Not rstemp.EOF
- Set rs = New ADODB.Recordset
- rs.Open "select * from gdzc_card where " & Trim(rstemp!FieldCode) & "<>''", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- If rs.EOF Then
- rstemp!WhetherNull = False
- rstemp.Update
- End If
- rs.Close
- Set rs = Nothing
- rstemp.MoveNext
- Wend
- rstemp.Close
- Set rstemp = Nothing
- Cw_DataEnvi.DataConnect.CommitTrans
- Call Recordset_Move(1)
- Exit Function
- Else
- Exit Function
- End If
- Cwcl:
- Cw_DataEnvi.DataConnect.RollbackTrans
- Tsxx = "删除出错,系统自动返回删除前状态!"
- Call Xtxxts(Tsxx, 0, 1)
- Exit Function
- End Function
- '是否允许修改
- Function Txt_Bit() As Boolean
- Txt_Bit = False
- Set rstemp = New ADODB.Recordset
- rstemp.Open "select * from gdzc_card where CardCode='" & Trim(Lbl_Num.Caption) & "' and year=" & CInt(Xtyear) & " and period=" & CInt(Xtmm), Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- If rstemp.EOF Then
- If Trim(str_State) <> "2" Then Exit Function
- Tsxx = "非本会计期间录入卡片只能修改部分数据!"
- Call Xtxxts(Tsxx, 0, 4)
- Exit Function
- Else
- Txt_Bit = True
- End If
- rstemp.Close
- Set rstemp = New ADODB.Recordset
- rstemp.Open "select * from Gdzc_Variation where FAVariCode='00501' and Cardcode='" & Trim(Lbl_Num.Caption) & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- If Not rstemp.EOF Then
- Tsxx = "该资产卡片已经计提折旧,只能修改部分数据!"
- Call Xtxxts(Tsxx, 0, 4)
- Txt_Bit = False
- End If
- rstemp.Close
- Set rstemp = Nothing
- End Function
- '本月是否已经进行计提折旧
- Function If_Add() As Boolean
- If_Add = False
- Set rstemp = New ADODB.Recordset
- rstemp.Open "select * from Gdzc_card where DeprFlag='1'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- If rstemp.EOF Then
- If_Add = True
- Else
- Tsxx = "固定资产已计提折旧,未执行月末结帐!"
- Call Xtxxts(Tsxx, 0, 4)
- Exit Function
- End If
- rstemp.Close
- Set rstemp = Nothing
- If_Add = True
- End Function
- '*******************以上区域为编写自定义过程区域**********************
- '************以下为文本框录入处理程序(固定不变部分)*************'
- Private Sub Wbklrwbcl(Index As Integer) '文本框录入事后处理程序
- '以下为依据实际情况自定义部分[
- '在此填写文本框录入事后处理程序
- ']以上为依据实际情况自定义部分
- End Sub
- Private Sub LrText_Change(Index As Integer)
- TextValiJudgeLock(Index) = False '打开有效性判断锁
- '限制字段录入长度
- TextChangeLock = True '加锁(防止执行Lrtext_Change)
- Select Case Textint(Index, 1)
- Case 8, 11 '金额型
- Call Sjgskz(LrText(Index), Xtjezws - Xtjexsws - 1, Xtjexsws)
- Case 9, 12 '数量型
- Call Sjgskz(LrText(Index), Xtslzws - Xtslxsws - 1, Xtslxsws)
- Case 10 '单价型
- Call Sjgskz(LrText(Index), Xtdjzws - Xtdjxsws - 1, Xtdjxsws)
- Case Else '其他小数类型控制
- If Textint(Index, 6) <> 0 Or Textint(Index, 7) <> 0 Then
- Call Sjgskz(LrText(Index), Textint(Index, 6), Textint(Index, 7))
- End If
- End Select
- TextChangeLock = False '解锁
- End Sub
- Private Sub LrText_GotFocus(Index As Integer) '文本框得到焦点,显示相应信息
- Call TextShow(Index)
- CurTextIndex = Index
- LrText(Index).SelStart = Len(LrText(Index))
- End Sub
- Private Sub LrText_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer) '字段按F2键提供帮助
- Select Case KeyCode
- Case vbKeyF2
- Call Text_Help(Index)
- '根据资产类别设置取得资产折旧方法、月折旧率、月折旧额和残值率
- If Index = 3 Then
- Call From_Sort
- End If
- '根据用户选择的币种,取得汇率
- Call From_Ccur
- End Select
- End Sub
- Private Sub LrText_KeyPress(Index As Integer, KeyAscii As Integer) '文本框录入事中控制
- Call InputFieldLimit(LrText(Index), Textint(Index, 1), KeyAscii)
- End Sub
- Private Sub LrText_LostFocus(Index As Integer) '文本框失去焦点进行有效性判断及相应处理
- If Textint(Index, 9) = 0 Or Textint(Index, 9) = 1 Then '事中判断
- Call TextYxxpd(Index)
- End If
- '//用户自定义判断过程
- '根据用户输入的外币金额,自动计算取得资产原值、本位币值
- If Index = 20 Or Index = 21 Then
- If Trim(LrText(20).Text) <> "" And Trim(LrText(21).Text) <> "" And Trim(LrText(22).Text) = "" Then
- If Ccur_bit = False Then
- LrText(24).Text = Format(Val(LrText(20).Text) * Val(LrText(21).Text), "##0.00")
- LrText(22).Text = Format(Val(LrText(20).Text) * Val(LrText(21).Text), "##0.00")
- Else
- LrText(24).Text = Format(Val(LrText(21).Text) / Val(LrText(20).Text), "##0.00")
- LrText(22).Text = Format(Val(LrText(21).Text) / Val(LrText(20).Text), "##0.00")
- End If
- End If
- End If
- '根据资产折旧方法,以及修改折旧方法所需要的各录入数据,取得月折旧额和月折旧率
- If Index = 15 Or Index = 22 Or Index = 25 Or Index = 28 Then
- Call DeprMethod
- End If
- If Index = 27 And Trim(Com_DeprMethod.Text) = "固定折旧额折旧法" Then
- Call DeprMethod
- End If
- '取得净资产
- If Index = 22 Or Index = 23 Then
- Lbl_FactValue.Caption = Format(Val(LrText(22).Text) - Val(LrText(23).Text), "#0.00")
- If Trim(LrText(20).Text & "") <> "" And Trim(LrText(22).Text) <> "" And Trim(LrText(21).Text) = "" Then
- If Ccur_bit = False Then
- LrText(21).Text = Format(Val(LrText(22).Text) / Val(LrText(20).Text), "##0.00")
- Else
- LrText(21).Text = Format(Val(LrText(22).Text) * Val(LrText(20).Text), "##0.00")
- End If
- End If
- End If
- '取得净残值
- If Index = 22 Or Index = 28 Then
- LrText(29).Text = Format(Val(LrText(22).Text) * Val(LrText(28).Text), "##0.00")
- End If
- '//自定义判断结束
- '屏蔽程序改变控制
- If TextChangeLock Then
- Exit Sub
- End If
- End Sub
- Private Function Bclrsj() As Boolean '判断录入数据有效性,并保存数据
- Dim Jsqte As Integer
- '对文本框录入内容进行为零和为空判断(固定不变)
- For Jsqte = 0 To Max_Text_Index
- If Textint(Jsqte, 8) = 1 Then '字段不能为空
- If Len(Trim(LrText(Jsqte).Text)) = 0 Then
- Tsxx = Textstr(Jsqte, 7) & "不能为空!"
- Call Xtxxts(Tsxx, 0, 1)
- LrText(Jsqte).SetFocus
- Bclrsj = False
- Exit Function
- End If
- Else
- If Textint(Jsqte, 8) = 2 Then '字段不能为零
- If Val(Trim(LrText(Jsqte).Text)) = 0 Then
- Tsxx = Textstr(Jsqte, 7) & "不能为零!"
- Call Xtxxts(Tsxx, 0, 1)
- LrText(Jsqte).SetFocus
- Bclrsj = False
- Exit Function
- End If
- End If
- End If
- Next Jsqte
- '对需要进行事后判断的文本框录入内容进行有效性判断 (固定不变)
- 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
- '//以下为自定义判断过程
- '判断资产编号不能重复
- Set rstemp = New ADODB.Recordset
- If str_State = "1" Then
- rstemp.Open "select * from gdzc_card where FACode='" & Trim(LrText(13).Text) & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- Else
- rstemp.Open "select * from gdzc_card where FACode='" & Trim(LrText(13).Text) & "' and CardCode<>'" & Trim(Lbl_Num.Caption) & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- End If
- If Not rstemp.EOF Then
- Tsxx = "资产编号不能重复!"
- Call Xtxxts(Tsxx, 0, 4)
- LrText(13).Text = ""
- LrText(13).SetFocus
- Exit Function
- End If
- rstemp.Close
- Set rstemp = Nothing
- '累计折旧不能大于资产原值
- If Val(LrText(22).Text) - Val(LrText(23).Text) < 0 Then
- Tsxx = "累计折旧不能大于资产原值!"
- Call Xtxxts(Tsxx, 0, 4)
- LrText(23).SetFocus
- Exit Function
- End If
- '折旧月数不能大于使用年限×12
- If Val(Val(LrText(25).Text)) > Val(Val(LrText(15).Text) * 12) Then
- Tsxx = "折旧月数的年限不能大于使用年限!"
- Call Xtxxts(Tsxx, 0, 4)
- LrText(25).SetFocus
- Exit Function
- End If
- '当资产折旧方法为“工作量法”时,工作总量和工作量单位不能为空
- If Trim(Com_DeprMethod.Text) = "工作量法" Then
- If Trim(LrText(30).Text) = "" Then
- Tsxx = "工作总量不能为空!"
- Call Xtxxts(Tsxx, 0, 4)
- LrText(30).SetFocus
- Exit Function
- End If
- If Trim(LrText(31).Text) = "" Then
- Tsxx = "工作量单位不能为空!"
- Call Xtxxts(Tsxx, 0, 4)
- LrText(31).SetFocus
- Exit Function
- End If
- End If
- '当资产折旧方法为“固定折旧额法”时,月折旧额不能为空
- If Trim(Com_DeprMethod.Text) = "固定折旧额折旧法" Then
- If Trim(LrText(26).Text) = "" Then
- Tsxx = "月折旧额不能为空!"
- Call Xtxxts(Tsxx, 0, 4)
- LrText(26).SetFocus
- Exit Function
- End If
- End If
- '日期判断
- If Trim(LrText(0).Text) <> "" Then
- If Val(Year(LrText(0).Text)) > Val(Xtyear) Then
- Tsxx = "使用日期不能大于本会计年度!"
- Call Xtxxts(Tsxx, 0, 4)
- LrText(0).Text = ""
- LrText(0).SetFocus
- Exit Function
- End If
- If Val(Year(LrText(0).Text)) > Val(Xtyear) And Val(Month(LrText(0).Text)) > Val(Xtmm) Then
- Tsxx = "使用日期不能大于本会计期间!"
- Call Xtxxts(Tsxx, 0, 4)
- LrText(0).Text = ""
- LrText(0).SetFocus
- Exit Function
- End If
- End If
- '日期判断
- If Trim(LrText(1).Text) <> "" Then
- If Val(Year(LrText(1).Text)) > Val(Xtyear) Then
- Tsxx = "记帐日期不能大于本会计年度!"
- Call Xtxxts(Tsxx, 0, 4)
- LrText(1).Text = ""
- LrText(1).SetFocus
- Exit Function
- End If
- If Val(Year(LrText(1).Text)) > Val(Xtyear) And Val(Month(LrText(1).Text)) > Val(Xtmm) Then
- Tsxx = "记帐日期不能大于本会计期间!"
- Call Xtxxts(Tsxx, 0, 4)
- LrText(1).Text = ""
- LrText(1).SetFocus
- Exit Function
- End If
- End If
- '自定义判断
- Dim Define_int As Integer
- Dim Define_tmep As Double
- For Define_int = 33 To 52
- If LrText(Define_int).Visible = True Then
- If Trim(LrText(Define_int).Text & "") <> "" Then
- Set rs = New ADODB.Recordset
- rs.Open "select * from gdzc_custom where FieldCode='" & Trim(LrText(Define_int).Tag) & "' and FieldState='1'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- If Not rs.EOF Then
- If rs!datatype = 3 Then
- Define_tmep = IIf(rs!intlength < 1, 1, IIf(rs!intlength < 2, 10, IIf(rs!intlength < 3, 100, IIf(rs!intlength < 4, 1000, IIf(rs!intlength < 5, 10000, _
- IIf(rs!intlength < 6, 100000, IIf(rs!intlength < 7, 1000000, IIf(rs!intlength < 8, 10000000, IIf(rs!intlength < 9, 100000000, IIf(rs!intlength < 10, 1000000000, 100000000000#))))))))))
- If Val(LrText(Define_int).Text) > Val(Define_tmep) Then
- Tsxx = "您的输入值不能超过自定义最大值!"
- Call Xtxxts(Tsxx, 0, 4)
- LrText(Define_int).Text = ""
- LrText(Define_int).SetFocus
- Exit Function
- End If
- ElseIf rs!datatype = 5 Then
- If Val(Year(Trim(LrText(Define_int).Text) & "")) > Val(Xtyear) Then
- Tsxx = "日期不能大于本会计年度!"
- Call Xtxxts(Tsxx, 0, 4)
- LrText(Define_int).Text = ""
- LrText(Define_int).SetFocus
- Exit Function
- End If
- If Val(Year(Trim(LrText(Define_int).Text) & "")) > Val(Xtyear) And Val(Month(LrText(Define_int).Text)) > Val(Xtmm) Then
- Tsxx = "日期不能大于本会计期间!"
- Call Xtxxts(Tsxx, 0, 4)
- LrText(Define_int).Text = ""
- LrText(Define_int).SetFocus
- Exit Function
- End If
- End If
- End If
- rs.Close
- Set rs = Nothing
- End If
- End If
- Next Define_int
- '//以上为自定义判断过程
- '录入数据保存
- Call Lrbc
- '保存记录成功,函数返回真值
- Bclrsj = True
- Exit Function
- End Function
- Private Sub SzToolbar_ButtonClick(ByVal Button As MSComctlLib.Button)
- Select Case Button.Key
- Case "zj" '新增
- '判断用户是否有此功能执行权限,如有则写上机日志(进入)
- If Not Security_Log(Str_RightEdit, Xtczybm, 1, True) Then
- Exit Sub
- End If
- If If_Add = True Then
- Call Txt_Clear
- str_State = "1"
- Call Zdbm
- Me.AutoRedraw = False
- SetToolState
- LrText(13).SetFocus
- End If
- Case "xg" '修改
- '判断用户是否有此功能执行权限,如有则写上机日志(进入)
- If Not Security_Log(Str_RightEdit, Xtczybm, 1, True) Then
- Exit Sub
- End If
- If If_Add = True Then
- str_State = "2"
- Me.AutoRedraw = False
- SetToolState
- End If
- Case "sc" '删除
- Call Card_Del
- Case "bc" '保存
- Call Bclrsj
- Case "fq" '放弃
- If str_State = "1" Then
- Call Zdbm
- Call Txt_Clear
- Call Recordset_Move(1)
- End If
- str_State = "3"
- Me.AutoRedraw = False
- SetToolState
- Case "first" '首张
- Call Recordset_Move(1)
- Case "prev" '上张
- Call Recordset_Move(2)
- Case "next" '下张
- Call Recordset_Move(3)
- Case "last" '末张
- Call Recordset_Move(4)
- Case "fh" '退 出
- Unload Me
- Case "bz"
- SendKeys "{F1}"
- End Select
- End Sub
- Private Sub ydcommand_MouseDown(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single) '按钮提供帮助
- If LrText(Index).Enabled = False Then
- Exit Sub
- End If
- If Index = 12 Then
- If Trim(LrText(21).Text) <> "" And Trim(LrText(22).Text) <> "" Then
- Exit Sub
- End If
- End If
- Call Text_Help(Index)
- '根据资产类别设置取得资产折旧方法、月折旧率、月折旧额和残值率
- If Index = 3 Then
- Call From_Sort
- End If
- '根据用户选择的币种,取得汇率
- Call From_Ccur
- End Sub
- Private Sub Text_Help(Index As Integer) '录入字段帮助
- If Not Textboolean(Index, 1) Then
- Exit Sub
- End If
- TextValiJudgeLock(Index) = True
- '先进行有效性判断
- If Not TextYxxpd(CurTextIndex) Then
- Exit Sub
- End If
- '[>>调入参照窗体
- 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) '文本框得到焦点,显示相应信息
- '填写文本框得到焦点,进行相应信息处理程序
- If Index = 2 Then LrText(Index).MaxLength = 20
- End Sub
- Private Sub Wbkcsh() '录入文本框初始化
- Dim Jsqte As Integer
- '最大录入文本框索引值
- Max_Text_Index = Textvar(1)
- ReDim TextValiJudgeLock(Max_Text_Index)
- For Jsqte = 3 To Max_Text_Index
- If Len(Trim(Textstr(Jsqte, 1))) <> 0 Then
- If Textboolean(Jsqte, 1) Then
- If Jsqte <> 0 And Not Textboolean(Jsqte, 3) Then
- Load ydcommand(Jsqte)
- End If
- ydcommand(Jsqte).Visible = True
- ydcommand(Jsqte).Picture = ydcommand(Jsqte - 1).Picture
- ydcommand(Jsqte).Move LrText(Jsqte).Left + LrText(Jsqte).Width, 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
- '显示自定义项
- Call Define
- '卡片自动编号
- Call Zdbm
- '初始化时显示值
- LrText(14).Text = 1
- Lbl_Year.Caption = Xtyear '会计年度
- Lbl_Period.Caption = Format(Xtmm, "00") '会计期间
- Lbl_Operator.Caption = Xtczy '操作员姓名
- Com_DeprMethod.Text = Com_DeprMethod.List(0) '资产折旧方法默认值
- Com_Type.Text = "新增固定资产" '卡片类型
- LrText(1).Text = Xtrq
- LrText(12).Text = XtSCurrName
- LrText(12).Tag = XtSCurrCode
- LrText(20).Text = "1"
- 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")
- If Val(Mid(LrText(Index), 1, 4)) < 1900 Then
- LrText(Index).Text = "1900" + Mid(LrText(Index), 5, 6)
- End If
- Else
- Tsxx = "非法公历日期!(格式:" + Format(Date, "yyyy-mm-dd") + ")"
- Call Xtxxts(Tsxx, 0, 1)
- LrText(Index).SetFocus
- Exit Function
- End If
- Case 3 '其他类型
- End Select
- TextValiJudgeLock(Index) = True
- TextYxxpd = True
- End Function