📄 form47.frm
字号:
VERSION 5.00
Begin VB.Form Form47
BorderStyle = 3 'Fixed Dialog
Caption = "Form47"
ClientHeight = 5850
ClientLeft = 45
ClientTop = 330
ClientWidth = 6945
LinkTopic = "Form47"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5850
ScaleWidth = 6945
ShowInTaskbar = 0 'False
StartUpPosition = 3 '窗口缺省
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 = 420
Left = 2520
TabIndex = 1
Top = 5040
Width = 1600
End
Begin VB.ListBox List1
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 3660
Left = 600
TabIndex = 0
Top = 840
Width = 5775
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 = 5280
TabIndex = 6
Top = 600
Width = 480
End
Begin VB.Label Label4
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 = 2400
TabIndex = 5
Top = 600
Width = 480
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 = 3480
TabIndex = 4
Top = 600
Width = 960
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 = 600
TabIndex = 3
Top = 600
Width = 720
End
Begin VB.Label Label1
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 = 2280
TabIndex = 2
Top = 0
Width = 1890
End
End
Attribute VB_Name = "Form47"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim f_fee_table(10, 5)
Private Sub Command1_Click()
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 = "delete from 跟单费用表 where 帐单号=" & "'" & f_fee_table((List1.ListIndex), 0) & "'" & _
"and 费用名称 =" & "'" & f_fee_table((List1.ListIndex), 3) & "'"
With cmd1
.ActiveConnection = cnn1
.CommandText = SQL
.CommandType = adCmdText
.Execute
End With
SQL = "select * from 跟单费用表 where 帐单号=" & "'" & g_reckoning & "'"
With cmd1
.ActiveConnection = cnn1
.CommandText = SQL
.CommandType = adCmdText
End With
Set rs1 = cmd1.Execute
List1.Clear
j = 0
If rs1.EOF Then
MsgBox ("没有查询到记录")
Command1.Enabled = False
'Command2.Enabled = False
cnn1.Close
Set cnn1 = Nothing
GoSub exit_Command1_Click
End If
rs1.MoveFirst
While Not rs1.EOF
S = ""
For i = 0 To rs1.Fields.Count - 1
Select Case i
Case 0, 3
tt_len = Len(rs1.Fields(i).Value)
t_len = 0
For t = 1 To tt_len
If Asc((Mid((rs1.Fields(i).Value), t, 1))) < 0 Then
t_len = t_len + 2
Else
t_len = t_len + 1
End If
Next
t_len = 14 - t_len
S1 = ""
For t = 1 To t_len
S1 = S1 & " "
Next
S = S & rs1.Fields(i).Value & S1
Case 1
date_string = Round(rs1.Fields(1).Value, 0) & "年" & _
Round(rs1.Fields(2).Value, 0) & "月"
t_len = 8 - Len(date_string)
S1 = ""
For t = 1 To t_len
S1 = S1 & " "
Next
S = S & date_string & S1
Case 4
t_len = 0
t_value = Round(rs1.Fields(i).Value, 2)
t_len = 11 - Len(t_value)
S1 = ""
If t_value = Int(t_value) Then
S1 = S1 & ".00"
t_len = t_len - 3
Else
If (t_value * 10) = Int(t_value * 10) Then
S1 = S1 & "0"
t_len = t_len - 1
End If
End If
For t = 1 To t_len
S1 = S1 & " "
Next
S = S & t_value & S1
End Select
f_fee_table(j, i) = rs1.Fields(i).Value
Next
List1.AddItem S, j
j = j + 1
rs1.MoveNext
Wend
List1.ListIndex = 0
cnn1.Close
Set cnn1 = Nothing
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 跟单费用表 where 帐单号=" & "'" & g_reckoning & "'"
With cmd1
.ActiveConnection = cnn1
.CommandText = SQL
.CommandType = adCmdText
End With
Set rs1 = cmd1.Execute
j = 0
If rs1.EOF Then
MsgBox ("没有查询到记录")
Command1.Enabled = False
'Command2.Enabled = False
cnn1.Close
Set cnn1 = Nothing
GoSub exit_form_load
End If
rs1.MoveFirst
While Not rs1.EOF
S = ""
For i = 0 To rs1.Fields.Count - 1
Select Case i
Case 0, 3
tt_len = Len(rs1.Fields(i).Value)
t_len = 0
For t = 1 To tt_len
If Asc((Mid((rs1.Fields(i).Value), t, 1))) < 0 Then
t_len = t_len + 2
Else
t_len = t_len + 1
End If
Next
t_len = 14 - t_len
S1 = ""
For t = 1 To t_len
S1 = S1 & " "
Next
S = S & rs1.Fields(i).Value & S1
Case 1
date_string = Round(rs1.Fields(1).Value, 0) & "年" & _
Round(rs1.Fields(2).Value, 0) & "月"
t_len = 8 - Len(date_string)
S1 = ""
For t = 1 To t_len
S1 = S1 & " "
Next
S = S & date_string & S1
Case 4
t_len = 0
t_value = Round(rs1.Fields(i).Value, 2)
t_len = 11 - Len(t_value)
S1 = ""
If t_value = Int(t_value) Then
S1 = S1 & ".00"
t_len = t_len - 3
Else
If (t_value * 10) = Int(t_value * 10) Then
S1 = S1 & "0"
t_len = t_len - 1
End If
End If
For t = 1 To t_len
S1 = S1 & " "
Next
S = S & t_value & S1
End Select
f_fee_table(j, i) = rs1.Fields(i).Value
Next
List1.AddItem S, j
j = j + 1
rs1.MoveNext
Wend
List1.ListIndex = 0
cnn1.Close
Set cnn1 = Nothing
exit_form_load:
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
Form43.Show
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -