📄 frmjjdcount.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form frmjjdcount
Caption = "降级单统计"
ClientHeight = 8430
ClientLeft = 60
ClientTop = 345
ClientWidth = 11880
LinkTopic = "Form1"
ScaleHeight = 8430
ScaleWidth = 11880
StartUpPosition = 2 '屏幕中心
Begin VB.PictureBox CurtPrinter1
ForeColor = &H80000008&
Height = 3975
Left = 720
ScaleHeight = 3915
ScaleWidth = 4155
TabIndex = 9
Top = 600
Width = 4215
End
Begin VB.Frame Frame3
Caption = "按流水号统计"
Height = 615
Left = 2880
TabIndex = 2
Top = 7440
Width = 5415
Begin VB.CommandButton dy
Caption = "打印"
Height = 255
Left = 4440
TabIndex = 8
Top = 240
Width = 615
End
Begin VB.TextBox lshbegin
Height = 270
Left = 720
MaxLength = 7
TabIndex = 5
Top = 240
Width = 1095
End
Begin VB.TextBox lshend
Height = 270
Left = 2280
MaxLength = 7
TabIndex = 4
Top = 240
Width = 1095
End
Begin VB.CommandButton hzcount
Caption = "统计"
Height = 255
Left = 3600
TabIndex = 3
Top = 240
Width = 615
End
Begin VB.Label Label1
Caption = "从"
Height = 255
Left = 360
TabIndex = 7
Top = 240
Width = 255
End
Begin VB.Label Label2
Caption = "到"
Height = 255
Left = 1920
TabIndex = 6
Top = 240
Width = 255
End
End
Begin VB.Frame Frame1
Caption = "烟叶统计"
Height = 7335
Left = 120
TabIndex = 0
Top = 120
Width = 11775
Begin MSFlexGridLib.MSFlexGrid MSF
Height = 7095
Left = 0
TabIndex = 1
Top = 195
Width = 11730
_ExtentX = 20690
_ExtentY = 12515
_Version = 393216
Rows = 1
Cols = 7
FixedCols = 2
BackColorBkg = -2147483624
End
End
End
Attribute VB_Name = "frmjjdcount"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim db As Database
Dim rs As Recordset
Dim db1 As Database
Dim rs1 As Recordset
Dim coun As Integer
Private Sub dy_Click()
CurtPrinter1.Visible = True
PrintContent toPreview
End Sub
Private Sub Form_Load()
CurtPrinter1.Visible = False
dy.Enabled = False
Set db = OpenDatabase(App.Path + "..\db\System.mdb")
Set rs = db.OpenRecordset("yy")
If rs.EOF = False Then
rs.MoveFirst
coun = 0
Do Until rs.EOF
coun = coun + 1
rs.MoveNext
Loop
MSF.Cols = coun + 2
MSF.Rows = coun + 2
MSF.ColWidth(0) = 500
MSF.TextMatrix(0, 1) = "烟叶等级"
MSF.TextMatrix(coun + 1, 0) = "合计"
rs.MoveFirst
For c = 1 To coun
MSF.RowHeight(c) = 300
MSF.ColWidth(c + 1) = 500
MSF.TextMatrix(0, c + 1) = UCase(rs.Fields("yycode"))
MSF.TextMatrix(c, 0) = UCase(rs.Fields("yycode"))
MSF.TextMatrix(c, 1) = rs.Fields("yymc")
rs.MoveNext
Next c
End If
With CurtPrinter1
.PaperSize = "256"
.PaperWidth = 380
.PaperHeight = 280
End With
End Sub
Private Sub hzcount_Click()
Dim temn As Integer
Set db1 = OpenDatabase(App.Path + "..\db\Data.mdb")
If lshbegin = "" Or lshend = "" Then
MsgBox ("请输入查询条件!"), vbOKOnly, ("错误")
lshbegin.SetFocus
Else
For c = 2 To coun + 1
For r = 1 To coun + 1
MSF.TextMatrix(r, c) = "0"
Next r
Next c
Set rs1 = db1.OpenRecordset("jjd")
temn = lshend - lshbegin + 1
rs1.MoveFirst
For i = 1 To lshbegin - 1
rs1.MoveNext
Next i
For rscou = 1 To temn
For msfc = 1 To coun
If UCase(rs1.Fields("yfdj")) = MSF.TextMatrix(msfc, 0) Then
For jl = 2 To coun + 1
If UCase(rs1.Fields("ssdj")) = MSF.TextMatrix(0, jl) Then
MSF.TextMatrix(msfc, jl) = MSF.TextMatrix(msfc, jl) + rs1.Fields("zl")
End If
Next jl
End If
Next msfc
rs1.MoveNext
Next rscou
For tjc = 2 To coun + 1
tem = 0
For tjr = 1 To coun + 1
tem = MSF.TextMatrix(tjr, tjc) + tem
Next tjr
MSF.TextMatrix(coun + 1, tjc) = tem
Next tjc
dy.Enabled = True
dy.SetFocus
End If
End Sub
Private Sub lshbegin_Click()
lshbegin = ""
lshbegin.SetFocus
End Sub
Private Sub lshbegin_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
lshend.SetFocus
lshend = ""
End If
End Sub
Private Sub lshend_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
hzcount.SetFocus
End If
End Sub
Private Sub Form_Resize()
CurtPrinter1.Move 0, 0, ScaleWidth, ScaleHeight
End Sub
Private Sub CurtPrinter1_PrintFooter(CurrentPage As Long, LeftText As String, CenterText As String, RightText As String)
LeftText = "作者:敖显昌"
CenterText = "第" & CurrentPage & "页"
RightText = "联系我:Heavens_door@xinhuanet.com"
End Sub
Private Sub curtprinter1_ClosePreview()
CurtPrinter1.Visible = False
lshbegin = ""
lshend = ""
lshbegin.SetFocus
dy.Enabled = False
End Sub
Private Sub curtprinter1_NeedRedraw()
PrintContent toPreview
End Sub
Private Sub curtprinter1_RealPrint()
PrintContent toPrinter
End Sub
Private Sub PrintContent(printDevice As PrintTo)
Dim TableStartX As Single
Dim CellHeight As Single
Dim TempX As Single, TempY As Single
CurtPrinter1.StartPrint printDevice
With CurtPrinter1
.NewPage
.TitleOut Format(Now, "yyyy-mm-dd"), 9, vbRightJustify
.TitleOut "烟叶降级单统计", 20
.TitleOut "流水号:从" + lshbegin + "到" + lshend, 9, vbLeftJustify
.DirectPrint MSF, , , , -7.5
.EndDoc
End With
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -