📄 form40.frm
字号:
VERSION 5.00
Begin VB.Form Form40
BorderStyle = 3 'Fixed Dialog
Caption = "Form40"
ClientHeight = 4725
ClientLeft = 45
ClientTop = 330
ClientWidth = 5055
LinkTopic = "Form40"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4725
ScaleWidth = 5055
ShowInTaskbar = 0 'False
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text4
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2040
TabIndex = 4
Top = 3120
Width = 1900
End
Begin VB.TextBox Text3
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2040
TabIndex = 2
Top = 2040
Width = 1900
End
Begin VB.CommandButton Command1
Caption = "添 加"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1560
TabIndex = 5
Top = 3720
Width = 1695
End
Begin VB.ComboBox Combo1
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
Left = 2040
TabIndex = 3
Top = 2640
Width = 1935
End
Begin VB.TextBox Text2
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2040
TabIndex = 1
Top = 1440
Width = 1900
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2040
TabIndex = 0
Top = 840
Width = 1900
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "月 份:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 840
TabIndex = 11
Top = 2160
Width = 1200
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "年 份:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 840
TabIndex = 10
Top = 1560
Width = 1200
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "跟单费用输入画面"
BeginProperty Font
Name = "黑体"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 1200
TabIndex = 9
Top = 240
Width = 2520
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "费用名称:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 840
TabIndex = 8
Top = 2640
Width = 1200
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "金 额:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 840
TabIndex = 7
Top = 3240
Width = 1200
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "单 号:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 840
TabIndex = 6
Top = 960
Width = 1200
End
End
Attribute VB_Name = "Form40"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
If Text4.Text = "" Then
MsgBox ("金额不能为零")
Text4.SetFocus
GoSub exit_Command1_Click
End If
If Combo1.Text = "" Then
MsgBox ("费用名称未输入!")
Combo1.SetFocus
GoSub exit_Command1_Click
End If
Dim cnn1 As ADODB.Connection
Dim cmd1 As ADODB.Command
Dim rs1 As ADODB.Recordset
Set cnn1 = New ADODB.Connection
cnn1.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Documents and Settings\jujumao\My Documents\粤丰饲料\粤丰饲料经营情况.mdb;"
Set cmd1 = New ADODB.Command
SQL = "select count(*) from 跟单费用表 where 帐单号=" & "'" & Text1.Text & "'" & _
" and 费用名称 =" & "'" & Combo1.Text & "'"
With cmd1
.ActiveConnection = cnn1
.CommandText = SQL
.CommandType = adCmdText
End With
Set rs1 = cmd1.Execute
rs1.MoveFirst
If rs1.Fields(0) > 0 Then
MsgBox ("该费用已经输入!")
Combo1.SetFocus
cnn1.Close
Set cnn1 = Nothing
GoSub exit_Command1_Click
End If
SQL = "INSERT INTO 跟单费用表(帐单号,年份,月份,费用名称,金额) " & _
" VALUES ( " & "'" & Text1.Text & "'" & "," & Text2.Text & "," & _
Text3.Text & "," & "'" & Combo1.Text & "'" & "," & Text4.Text & ")"
With cmd1
.ActiveConnection = cnn1
.CommandText = SQL
.CommandType = adCmdText
.Execute
End With
cnn1.Close
Set cnn1 = Nothing
MsgBox ("数据保存成功")
Combo1.Text = ""
Text4.Text = ""
Combo1.SetFocus
exit_Command1_Click:
End Sub
Private Sub Form_Load()
Dim cnn1 As ADODB.Connection
Dim cmd1 As ADODB.Command
Dim rs1 As ADODB.Recordset
Set cnn1 = New ADODB.Connection
cnn1.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Documents and Settings\jujumao\My Documents\粤丰饲料\粤丰饲料经营情况.mdb;"
Set cmd1 = New ADODB.Command
SQL = "select 费用名称 from 跟单费用项目表 order by 费用名称"
With cmd1
.ActiveConnection = cnn1
.CommandText = SQL
.CommandType = adCmdText
End With
Set rs1 = cmd1.Execute
rs1.MoveFirst
i = 0
While Not rs1.EOF
Combo1.AddItem rs1.Fields(0), i
rs1.MoveNext
i = i + 1
Wend
Combo1.Text = ""
Text1.Text = g_reckoning
Text2.Text = g_year
Text3.Text = g_month
End Sub
Private Sub Form_Unload(Cancel As Integer)
Dim cnn1 As ADODB.Connection
Dim cmd1 As ADODB.Command
Dim rs1 As ADODB.Recordset
Dim rs2 As ADODB.Recordset
Set cnn1 = New ADODB.Connection
cnn1.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Documents and Settings\jujumao\My Documents\粤丰饲料\粤丰饲料经营情况.mdb;"
Set cmd1 = New ADODB.Command
SQL = "select 编号,购入斤数 from 品种购入表 where 单号=" & "'" & g_reckoning & "'"
With cmd1
.ActiveConnection = cnn1
.CommandText = SQL
.CommandType = adCmdText
End With
Set rs1 = cmd1.Execute
If Not rs1.EOF Then
rs1.MoveFirst
End If
While Not rs1.EOF
t_transport_fee = 0
t_unload_fee = 0
SQL = "select * from 跟单费用表 where 帐单号=" & "'" & g_reckoning & "'"
With cmd1
.ActiveConnection = cnn1
.CommandText = SQL
.CommandType = adCmdText
End With
Set rs2 = cmd1.Execute
If Not rs2.EOF Then
rs2.MoveFirst
End If
While Not rs2.EOF
If rs2.Fields(3) = "运费" Then
t_transport_fee = rs2.Fields(4)
End If
If rs2.Fields(3) = "卸车费" Then
t_unload_fee = rs2.Fields(4)
End If
rs2.MoveNext
Wend
If g_buy_weigh > 0 Then
t_transport_fee = t_transport_fee * (rs1.Fields(1) / g_buy_weigh)
t_unload_fee = t_unload_fee * (rs1.Fields(1) / g_buy_weigh)
End If
SQL = "update 品种购入表 set 运费=" & t_transport_fee & _
",卸车费 =" & t_unload_fee & " where 编号 =" & rs1.Fields(0)
With cmd1
.ActiveConnection = cnn1
.CommandText = SQL
.CommandType = adCmdText
.Execute
End With
rs1.MoveNext
Wend
cnn1.Close
Set cnn1 = Nothing
Select Case g_form
Case "form37"
g_form = "form45"
Form45.Show
Case "form43"
Form43.Show
End Select
End Sub
Private Sub Text1_GotFocus()
Combo1.SetFocus
End Sub
Private Sub Text2_GotFocus()
Combo1.SetFocus
End Sub
Private Sub Text3_GotFocus()
Combo1.SetFocus
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -