📄 form43.frm
字号:
End
Begin VB.Label Label7
Caption = "欠款金额:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 405
Left = 6960
TabIndex = 14
Top = 5970
Width = 1215
End
End
Attribute VB_Name = "Form43"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim f_reckoning_table(500, 10), f_arr_number(500), f_arr_number1(20)
Dim f_formshow, f_current_row
Private Sub Command1_Click()
t_YesNo = MsgBox("是否确认删除", vbYesNo)
If t_YesNo = 7 Then
GoSub exit_Command1_Click
End If
If List1.ListCount = 0 Then
MsgBox ("没有对应帐单数据")
GoSub exit_Command1_Click
End If
Dim cnn1 As ADODB.Connection
Dim cmd1 As ADODB.Command
Dim rs1 As ADODB.Recordset
Dim rs2 As ADODB.Recordset
List3.Clear
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 单号=" & "'" & f_reckoning_table(f_current_row, 1) & "'"
With cmd1
.ActiveConnection = cnn1
.CommandText = SQL
.CommandType = adCmdText
End With
Set rs1 = cmd1.Execute
rs1.MoveFirst
If rs1.Fields(0) > 0 Then
MsgBox ("购入明细有数据!不能删除")
cnn1.Close
Set cnn1 = Nothing
GoSub exit_Command1_Click
End If
SQL = "select count(*) from 购入帐单品种表 where 帐单号=" & "'" & f_reckoning_table(f_current_row, 1) & "'"
With cmd1
.ActiveConnection = cnn1
.CommandText = SQL
.CommandType = adCmdText
End With
Set rs1 = cmd1.Execute
rs1.MoveFirst
If rs1.Fields(0) > 0 Then
MsgBox ("购入明细有数据!不能删除")
cnn1.Close
Set cnn1 = Nothing
GoSub exit_Command1_Click
End If
SQL = "select count(*) from 跟单费用表 where 帐单号=" & "'" & f_reckoning_table(f_current_row, 1) & "'"
With cmd1
.ActiveConnection = cnn1
.CommandText = SQL
.CommandType = adCmdText
End With
Set rs1 = cmd1.Execute
rs1.MoveFirst
If rs1.Fields(0) > 0 Then
MsgBox ("购入明细有数据!不能删除")
cnn1.Close
Set cnn1 = Nothing
GoSub exit_Command1_Click
End If
SQL = "delete from 购入帐单表 where 编号=" & f_reckoning_table(f_current_row, 0)
With cmd1
.ActiveConnection = cnn1
.CommandText = SQL
.CommandType = adCmdText
.Execute
End With
Select Case g_query_method
Case 1
SQL = "select * from 购入帐单表 where 年份 =" & g_year & _
" and 月份 = " & g_month & " and 帐单号 = " & "'" & g_reckoning & "'" & " order by 编号"
Case 2, 3
SQL = "select * from 购入帐单表 where 年份 =" & g_year & _
" and 月份 = " & g_month & " order by 编号 "
End Select
With cmd1
.ActiveConnection = cnn1
.CommandText = SQL
.CommandType = adCmdText
End With
Set rs1 = cmd1.Execute
If rs1.EOF Then
MsgBox ("没有查询到数据!")
GoSub exit_Command1_Click
End If
List1.Clear
j = 0
rs1.MoveFirst
While Not rs1.EOF
If g_query_method = 3 Then
SQL = "select 品种,购入金额 from 品种购入表 where 单号=" & _
"'" & rs1.Fields(1) & "'" & " order by 品种"
With cmd1
.ActiveConnection = cnn1
.CommandText = SQL
.CommandType = adCmdText
End With
Set rs2 = cmd1.Execute
S1 = ""
t_SumBuy = 0
If Not rs2.EOF Then
rs2.MoveFirst
While Not rs2.EOF
S1 = S1 & rs2.Fields(0)
t_SumBuy = t_SumBuy + rs2.Fields(1)
rs2.MoveNext
Wend
End If
SQL = "select 品种 from 购入帐单品种表 where 帐单号=" & _
"'" & rs1.Fields(1) & "'" & " order by 品种"
With cmd1
.ActiveConnection = cnn1
.CommandText = SQL
.CommandType = adCmdText
End With
Set rs2 = cmd1.Execute
S2 = ""
If Not rs2.EOF Then
rs2.MoveFirst
While Not rs2.EOF
S2 = S2 & rs2.Fields(0)
rs2.MoveNext
Wend
End If
If Round(t_SumBuy, 2) = Round(rs1.Fields(5), 2) And S1 = S2 Then
rs1.MoveNext
GoTo exit_command1_click_while
End If
End If
S = ""
For i = 0 To rs1.Fields.Count - 1
Select Case i
Case 1
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 = 16 - t_len
S1 = ""
For t = 1 To t_len
S1 = S1 & " "
Next
S = S & rs1.Fields(i).Value & S1
End Select
f_reckoning_table(j, i) = rs1.Fields(i).Value
Next
List1.AddItem S, j
j = j + 1
rs1.MoveNext
exit_command1_click_while:
Wend
If j = 0 And g_query_method = 3 Then
MsgBox ("没有查到错误数据!")
GoSub exit_Command1_Click
End If
List1.ListIndex = 0
f_current_row = 0
List2.Clear
SQL = "select 编号,品种 from 购入帐单品种表 where 帐单号 = " & _
"'" & f_reckoning_table(f_current_row, 1) & "'" & " order by 品种"
With cmd1
.ActiveConnection = cnn1
.CommandText = SQL
.CommandType = adCmdText
End With
Set rs1 = cmd1.Execute
j = 0
If Not rs1.EOF Then
rs1.MoveFirst
End If
While Not rs1.EOF
S = ""
For i = 0 To rs1.Fields.Count - 1
Select Case i
Case 1
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 = 18 - t_len
S1 = ""
For t = 1 To t_len
S1 = S1 & " "
Next
S = S & rs1.Fields(i).Value & S1
End Select
Next
List2.AddItem S, j
f_arr_number1(j) = rs1.Fields(0)
j = j + 1
rs1.MoveNext
Wend
SQL = "select 品种,购入斤数,购入单价,购入金额,编号 from 品种购入表 where 单号 = " & _
"'" & f_reckoning_table(f_current_row, 1) & "'"
With cmd1
.ActiveConnection = cnn1
.CommandText = SQL
.CommandType = adCmdText
End With
Set rs1 = cmd1.Execute
If rs1.EOF Then
cnn1.Close
Set cnn1 = Nothing
Text1.Text = 0
Text2.Text = f_reckoning_table(f_current_row, 5)
GoTo exit_Command1_Click
End If
j = 0
List3.Clear
Text1.Text = 0
rs1.MoveFirst
While Not rs1.EOF
S = ""
For i = 0 To rs1.Fields.Count - 1
Select Case i
Case 0
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 = 18 - t_len
S1 = ""
For t = 1 To t_len
S1 = S1 & " "
Next
S = S & rs1.Fields(i).Value & S1
Case 2
t_len = 0
t_value = Round(rs1.Fields(i).Value, 3)
t_len = 11 - Len(t_value)
S1 = ""
If t_value = Int(t_value) Then
S1 = S1 & ".000"
t_len = t_len - 4
Else
If (t_value * 10) = Int(t_value * 10) Then
S1 = S1 & "00"
t_len = t_len - 2
Else
If (t_value * 100) = Int(t_value * 100) Then
S1 = S1 & "0"
t_len = t_len - 1
End If
End If
End If
If t_value < 1 And t_value > 0 Then
S = S & "0"
t_len = t_len - 1
End If
For t = 1 To t_len
S1 = S1 & " "
Next
S = S & t_value & S1
Case 3
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
Case 1
t_len = 0
t_len = 11 - Len(rs1.Fields(i).Value)
S1 = ""
For t = 1 To t_len
S1 = S1 & " "
Next
S = S & rs1.Fields(i).Value & S1
End Select
Next
List3.AddItem S, j
f_arr_number(j) = rs1.Fields(4)
Text1.Text = Text1.Text + rs1.Fields(3)
j = j + 1
rs1.MoveNext
Wend
List3.ListIndex = 0
Text1.Text = Round(Text1.Text, 2)
Text2.Text = f_reckoning_table(f_current_row, 5)
Text3.Text = f_reckoning_table(f_current_row, 6)
cnn1.Close
Set cnn1 = Nothing
exit_Command1_Click:
End Sub
Private Sub Command10_Click()
g_reckoning = f_reckoning_table(f_current_row, 1)
g_buy_weigh = f_reckoning_table(f_current_row, 9)
g_form = "form43"
Form43.Hide
Form40.Show
End Sub
Private Sub Command2_Click()
If List1.ListCount = 0 Then
MsgBox ("没有对应帐单数据")
GoSub exit_command2_click
End If
Printer.FontSize = 13
Printer.FontName = "黑体"
Printer.Print Chr(vbKeyReturn)
doc = Space(3) & "帐本号 " & "帐单号 " & "金 额 " & "制单日期"
Printer.Print doc
doc = "----------------------------------------------------------------------------------------"
Printer.Print doc
t_row_count = List1.ListCount
For i = 0 To t_row_count - 1
S = ""
tt_len = Len(f_reckoning_table(i, 4))
t_len = 0
For t = 1 To tt_len
If Asc((Mid(f_reckoning_table(i, 4), t, 1))) < 0 Then
t_len = t_len + 2
Else
t_len = t_len + 1
End If
Next
t_len = 16 - t_len
S1 = ""
For t = 1 To t_len
S1 = S1 & " "
Next
S = S & f_reckoning_table(i, 4) & S1
tt_len = Len(f_reckoning_table(i, 5))
t_len = 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -