📄 form18.frm
字号:
VERSION 5.00
Begin VB.Form Form18
BorderStyle = 3 'Fixed Dialog
Caption = "Form18"
ClientHeight = 7395
ClientLeft = 45
ClientTop = 435
ClientWidth = 10335
LinkTopic = "Form18"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 7395
ScaleWidth = 10335
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 = 495
Left = 4320
TabIndex = 3
Top = 6840
Width = 1695
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 = 5820
Left = 240
TabIndex = 0
Top = 960
Width = 9855
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 = 3720
TabIndex = 2
Top = 240
Width = 2520
End
Begin VB.Label Label2
Caption = "单号 日期 购入金额 期初未付金额 期内已还金额 备注"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 240
TabIndex = 1
Top = 720
Width = 9855
End
End
Attribute VB_Name = "Form18"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim f_arr_number(1000), f_formshow
Private Sub Command1_Click()
Printer.Height = 6
Printer.FontUnderline = False
Printer.Orientation = 2
Printer.FontSize = 13
Printer.FontName = "黑体"
doc = ""
doc = doc & Chr(vbKeyReturn)
doc = doc & Space(3) & Label2.Caption
doc = doc & Chr(vbKeyReturn)
Printer.Print doc
Printer.FontUnderline = True
doc = ""
For i = 0 To List1.ListCount - 1
doc = doc & Space(3) & List1.List(i) & Chr(vbKeyReturn)
Next
Printer.Print doc
Printer.EndDoc
End Sub
Private Sub Form_Load()
f_formshow = "OK"
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
Select Case g_query_method
Case 1
SQL = "select * from 购入帐单表 where 未付金额=还款金额 and 未付金额>0 order by 备注,年份,月份"
Case 2
SQL = "select * from 购入帐单表 where 未付金额<>还款金额 order by 备注,年份,月份"
End Select
With cmd1
.ActiveConnection = cnn1
.CommandText = SQL
.CommandType = adCmdText
End With
Set rs1 = cmd1.Execute
If rs1.EOF Then
MsgBox ("没有查询到记录")
Command2.Enabled = False
cnn1.Close
Set cnn1 = Nothing
GoSub exit_form_load
End If
j = 0
rs1.MoveFirst
While Not rs1.EOF
S = ""
For i = 0 To rs1.Fields.Count - 1
Select Case i
Case 0
Case 1, 8
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 2
date_string = Round(rs1.Fields(2).Value, 0) & "年" & _
Round(rs1.Fields(3).Value, 0) & "月" & _
Round(rs1.Fields(4).Value, 0) & "日"
t_len = 14 - Len(date_string)
S1 = ""
For t = 1 To t_len
S1 = S1 & " "
Next
S = S & date_string & S1
Case 5, 6, 7
t_len = 0
t_value = Round(rs1.Fields(i).Value, 2)
t_len = 13 - 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
Next
List1.AddItem S, j
f_arr_number(j) = rs1.Fields(0)
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)
If f_formshow = "OK" Then
Form38.Show
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -