📄 frm_zczj.frm
字号:
Begin VB.Label Label10
Caption = "选择"
Height = 255
Index = 1
Left = 10560
TabIndex = 36
Top = 1440
Width = 615
End
Begin VB.Label Label9
Caption = "折旧额"
Height = 255
Index = 1
Left = 8520
TabIndex = 35
Top = 1440
Width = 735
End
Begin VB.Label Label8
Caption = "折旧年限"
Height = 375
Index = 1
Left = 240
TabIndex = 34
Top = 1440
Width = 1095
End
Begin VB.Label Label6
Caption = "资产原值"
Height = 255
Index = 1
Left = 4440
TabIndex = 33
Top = 960
Width = 1215
End
Begin VB.Label Label5
Caption = "数量"
Height = 375
Index = 1
Left = 240
TabIndex = 32
Top = 960
Width = 1335
End
Begin VB.Label Label4
Caption = "型号"
Height = 255
Index = 1
Left = 8280
TabIndex = 31
Top = 480
Width = 495
End
Begin VB.Label Label3
Caption = "资产/设备名称"
Height = 375
Index = 1
Left = 4440
TabIndex = 30
Top = 480
Width = 1335
End
Begin VB.Label Label2
Caption = "资产/设备编号"
Height = 375
Index = 1
Left = 240
TabIndex = 29
Top = 480
Width = 1935
End
End
Begin VB.TextBox Text15
DataField = "预计使用年限"
DataSource = "Adodc2"
Height = 375
Left = 6240
TabIndex = 55
Text = "Text15"
Top = 3720
Width = 1575
End
End
Attribute VB_Name = "frm_ZCZJ"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim I
'Public adoCon As New ADODB.Connection
'Public adoRs As New ADODB.Recordset
Private Sub Check1_Click()
If Check1.Value = 1 Then
Command4.Enabled = True
ElseIf Check1.Value = 0 Then
Command4.Enabled = False
Else
End If
End Sub
Private Sub Combo2_Click()
If Combo2.Text <> " Like" Then
I = 0
ElseIf Combo2.Text = " Like" Then
I = 1
Else
End If
End Sub
Private Sub Combo3_Click()
Command4.Enabled = True
End Sub
Private Sub Combo3_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text8.SetFocus
Command4.Enabled = True
ElseIf KeyCode = 39 Then
Text8.SetFocus
Command4.Enabled = True
End If
End Sub
Private Sub Command1_Click()
Frame2.Visible = False
Frame3.Visible = True
If Text1.Text = "" Then
MsgBox "输入的查询内容不能为空"
Text1.SetFocus
Else
If Combo1.Text = "数量" Then
If Asc(Text1.Text) < 48 Or Asc(Text1.Text) > 57 Then
MsgBox "输入数据非法!!", , "提示"
Text1.Text = ""
Text1.SetFocus
Else
End If
ElseIf Combo1.Text = "资产原值" Then
If Asc(Text1.Text) < 48 Or Asc(Text1.Text) > 57 Then
MsgBox "输入数据非法!!", , "提示"
Text1.Text = ""
Text1.SetFocus
Else
End If
ElseIf Combo1.Text = "净残率" Then
If Asc(Text1.Text) < 48 Or Asc(Text1.Text) > 57 Then
MsgBox "输入数据非法!!", , "提示"
Text1.Text = ""
Text1.SetFocus
Else
End If
ElseIf Combo1.Text = "折旧额" Then
If Asc(Text1.Text) < 48 Or Asc(Text1.Text) > 57 Then
MsgBox "输入数据非法!!", , "提示"
Text1.Text = ""
Text1.SetFocus
Else
End If
ElseIf Combo1.Text = "折旧年限" Then
If Asc(Text1.Text) < 48 Or Asc(Text1.Text) > 57 Then
MsgBox "输入数据非法!!", , "提示"
Text1.Text = ""
Text1.SetFocus
Else
End If
Else
End If
Dim a
a = Text1.Text
If I = 0 Then
Adodc1.RecordSource = "select * from Table_ZCZJ where " + Combo1.Text + " " + Combo2 + " '" + a + "'"
Adodc1.Refresh
ElseIf I = 1 Then
Adodc1.RecordSource = "select * from Table_ZCZJ where " + Combo1.Text + " Like '%" + a + "%'"
Adodc1.Refresh
Else
End If
End If
End Sub
Private Sub Command2_Click()
Adodc1.RecordSource = "select * from Table_ZCZJ"
Adodc1.Refresh
End Sub
Private Sub Command3_Click()
DataEnvironment1.rsCommand5.Open "select * from Table_ZCZJ where 资产设备编号 like '" + Text10.Text + "'+ '%'order by 资产设备编号"
If DataEnvironment1.rsCommand5.RecordCount > 0 Then
DataRep_ZCZJ.Show
Else
MsgBox "此设备编号不存在,请确认后重新输入"
DataEnvironment1.rsCommand5.Close
End If
End Sub
Private Sub Command4_Click() ' 资产折旧按钮事件的程序代码
' Set adoCon = New ADODB.Connection
' adoCon.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=Data_MRSOFT;Data Source=MRVB"
Call main
Frame2.Visible = True
Frame3.Visible = False
Set adoCon = New ADODB.Connection
adoCon.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=Data_MRSOFT;Data Source=MRVB"
If Trim(Combo3.Text) = "产量比例法" Then
Text9.Text = (Val(Text6.Text) - Val(Text7.Text)) / Val(Text15.Text)
Set adoRs = adoCon.Execute("insert into Table_ZCZJ values(" & Text2 & ",'" & Text3 & "','" & Text4 & "','" & Text5 & "','" & Combo3 & "','" & Text6 & "','" & Text7 & "','" & Text8 & "','" & Text21 & "','" & Text9 & "','" & Check1 & "')")
Adodc1.Refresh
ElseIf Trim(Combo3.Text) = "重置成本法" Then
Text9.Text = (Val(Text6.Text) - Val(Text7.Text)) / Val(Text21.Text) + Val(Text7.Text)
Set adoRs = adoCon.Execute("insert into Table_ZCZJ values(" & Text2 & ",'" & Text3 & "','" & Text4 & "','" & Text5 & "','" & Combo3 & "','" & Text6 & "','" & Text7 & "','" & Text8 & "','" & Text21 & "','" & Text9 & "','" & Check1 & "')")
Adodc1.Refresh
ElseIf Trim(Combo3.Text) = "特别折旧率法" Then
Text9.Text = Val(Text6.Text) * Val(Text21.Text)
Set adoRs = adoCon.Execute("insert into Table_ZCZJ values(" & Text2 & ",'" & Text3 & "','" & Text4 & "','" & Text5 & "','" & Combo3 & "','" & Text6 & "','" & Text7 & "','" & Text8 & "','" & Text21 & "','" & Text9 & "','" & Check1 & "')")
Adodc1.Refresh
Else
End If
Set adoRs = adoCon.Execute("UPDATE Table_ZCXX SET 折旧数量='" + Text5.Text + "' where 资产设备编号='" + Text2.Text + "'")
MsgBox "数据增加成功!!", 32, "提示"
Command4.Enabled = False
adoCon.Close
End Sub
Private Sub Command5_Click()
frm_ZCZJ.Hide
End Sub
Private Sub Form_Activate()
If Combo2.Text = " >" Then
I = 0
ElseIf Combo2.Text = " =" Then
I = 1
ElseIf Combo2.Text = " <" Then
I = 2
Else
End If
End Sub
Private Sub Text19_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text8.SetFocus
ElseIf KeyCode = 39 Then
Text8.SetFocus
End If
End Sub
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Adodc2.RecordSource = "select * from Table_ZCXX where 资产设备编号='" + Text2.Text + "'"
Adodc2.Refresh
Text5.SetFocus
ElseIf KeyCode = 39 Then
Text5.SetFocus
Else
End If
End Sub
Private Sub Text21_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Combo3.SetFocus
ElseIf KeyCode = 39 Then
Combo3.SetFocus
End If
End Sub
Private Sub Text21_LostFocus()
Text9.Text = Val(Text6.Text) * Val(Text21.Text)
End Sub
Private Sub Text3_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text5.SetFocus
ElseIf KeyCode = 39 Then
Text5.SetFocus
End If
End Sub
Private Sub Text5_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text6.SetFocus
ElseIf KeyCode = 39 Then
Text6.SetFocus
End If
End Sub
Private Sub Text5_LostFocus()
If Text5.Text = "" Then
MsgBox "输入不能为空", , "提示"
Else
If Asc(Text5.Text) < 48 Or Asc(Text5.Text) > 57 Then
MsgBox "输入数据非法!!", , "提示"
Text5.Text = ""
Text5.SetFocus
Else
End If
End If
End Sub
Private Sub Text6_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text21.SetFocus
ElseIf KeyCode = 39 Then
Text21.SetFocus
End If
End Sub
Private Sub Text6_LostFocus()
If Text6.Text = "" Then
MsgBox "输入不能为空", , "提示"
Else
If Asc(Text6.Text) < 48 Or Asc(Text6.Text) > 57 Then
MsgBox "输入数据非法!!", , "提示"
Text6.Text = ""
Text6.SetFocus
Else
End If
End If
Text9.Text = Val(Text6.Text) * Val(Text21.Text)
End Sub
Private Sub Text7_Change()
If Val(Text6.Text) > Val(Text7.Text) Then
MsgBox "净残值不能大于资产原值!!", 32, "提示"
Else
End If
End Sub
Private Sub Text8_LostFocus()
If Text8.Text = "" Then
MsgBox "输入不能为空", , "提示"
Else
If Asc(Text8.Text) < 48 Or Asc(Text8.Text) > 57 Then
MsgBox "输入数据非法!!", , "提示"
Text8.Text = ""
Text8.SetFocus
Else
End If
End If
End Sub
Private Sub Text9_LostFocus()
If Text9.Text = "" Then
MsgBox "输入不能为空", , "提示"
Else
If Asc(Text9.Text) < 48 Or Asc(Text9.Text) > 57 Then
MsgBox "输入数据非法!!", , "提示"
Text9.Text = ""
Text9.SetFocus
Else
End If
End If
Text9.Text = Val(Text6.Text) * Val(Text21.Text)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -