📄 frmrkhz.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form FrmRKHZ
Caption = "订单汇总"
ClientHeight = 7590
ClientLeft = 3480
ClientTop = 2040
ClientWidth = 11445
LinkTopic = "Form1"
ScaleHeight = 7590
ScaleWidth = 11445
StartUpPosition = 1 '所有者中心
Begin VB.Frame Frame3
Caption = "根据订单编号查询"
Height = 975
Left = 8520
TabIndex = 14
Top = 0
Width = 2895
Begin VB.TextBox TxtRKDBH
Appearance = 0 'Flat
Height = 330
Left = 120
TabIndex = 16
Top = 382
Width = 1695
End
Begin VB.CommandButton Command8
Caption = "查 询"
Height = 375
Left = 1920
TabIndex = 15
Top = 360
Width = 855
End
End
Begin VB.CommandButton Command7
Caption = "退 出"
Height = 375
Left = 9960
TabIndex = 13
Top = 5880
Width = 1095
End
Begin VB.CommandButton Command6
Caption = "打印订单"
Height = 375
Left = 8640
TabIndex = 12
Top = 5880
Width = 1095
End
Begin VB.CommandButton Command5
Caption = "刷 新"
Height = 375
Left = 9960
TabIndex = 11
Top = 5280
Width = 1095
End
Begin VB.CommandButton Command4
Caption = "打印汇总"
Height = 375
Left = 8640
TabIndex = 10
Top = 5280
Width = 1095
End
Begin VB.CommandButton Command3
Caption = "删 除"
Height = 375
Left = 9960
TabIndex = 9
Top = 4680
Width = 1095
End
Begin VB.CommandButton Command2
Caption = "详细信息"
Height = 375
Left = 8640
TabIndex = 8
Top = 4680
Width = 1095
End
Begin VB.Frame Frame2
Caption = "按时间查询"
Height = 1815
Left = 8520
TabIndex = 2
Top = 1080
Width = 2895
Begin VB.CommandButton Command1
Caption = "查 询"
Height = 375
Left = 840
TabIndex = 7
Top = 1320
Width = 1215
End
Begin MSComCtl2.DTPicker DTP2
Height = 330
Left = 840
TabIndex = 6
Top = 840
Width = 1695
_ExtentX = 2990
_ExtentY = 582
_Version = 393216
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Format = 74317825
CurrentDate = 38411
End
Begin MSComCtl2.DTPicker DTP1
Height = 330
Left = 840
TabIndex = 5
Top = 360
Width = 1695
_ExtentX = 2990
_ExtentY = 582
_Version = 393216
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Format = 74317825
CurrentDate = 38411
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "到:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 240
TabIndex = 4
Top = 900
Width = 420
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "从:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 240
TabIndex = 3
Top = 420
Width = 420
End
End
Begin VB.Frame Frame1
Caption = "订单汇总表"
Height = 7575
Left = 120
TabIndex = 0
Top = 0
Width = 8295
Begin MSFlexGridLib.MSFlexGrid Grid
Height = 7215
Left = 120
TabIndex = 1
Top = 240
Width = 8055
_ExtentX = 14208
_ExtentY = 12726
_Version = 393216
Cols = 5
FixedCols = 0
RowHeightMin = 315
SelectionMode = 1
FormatString = "订 单 号 码 |^ 工 厂 名 称 |^ 落 单 日 期 |^ 出 货 日 期 |^ 总 金 额 "
End
End
End
Attribute VB_Name = "FrmRKHZ"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim CmdFlag As Integer
Dim SQLTJ As String
Dim Msgtext As String
Dim zsbexcel As Excel.Application
Private Sub Command1_Click()
If DTP1 > DTP2 Then
MsgBox "请正确选择日期,终止日期不能小于起始日期!", vbOKOnly + vbCritical, "提示"
Else
SQLTJ = " where 落单时间>='" & Format(DTP1.Value, "yyyy-mm-dd") & "' and 落单时间<='" & Format(DTP2.Value, "yyyy-mm-dd") & "'"
CmdFlag = 2
Call ReSet
Call FillGrid
End If
End Sub
Private Sub Command2_Click()
'Set RstQD = New ADODB.Recordset
SQL = "select * from rkcx where 进货ID='" & Grid.TextMatrix(Grid.RowSel, 0) & "'"
'RstQD.Open SQL, db, 1, 3
Set RstQD = ExecuteSQL(SQL, Msgtext)
If RstQD.EOF Then Exit Sub
FrmRKQD.LblRKDH.Caption = RstQD.Fields(0)
FrmRKQD.lblRKLX.Caption = RstQD.Fields(1)
FrmRKQD.lblRKRQ.Caption = RstQD.Fields(2)
FrmRKQD.LblCKMC.Caption = RstQD.Fields(3)
FrmRKQD.lblZJE.Caption = Format(RstQD.Fields(12), "0.00")
FrmRKQD.Grid.Clear
FrmRKQD.Grid.Rows = 1
FrmRKQD.Grid.FormatString = "序号|^ 商 品 名 称 |^ 货 号 |^ 规 格 |^ 单 位 |^ 数 量 |^ 单 价 |^ 金 额 "
Do While Not RstQD.EOF
FrmRKQD.Grid.Rows = FrmRKQD.Grid.Rows + 1
FrmRKQD.Grid.TextMatrix(FrmRKQD.Grid.Rows - 1, 0) = RstQD.Fields(4)
FrmRKQD.Grid.TextMatrix(FrmRKQD.Grid.Rows - 1, 1) = RstQD.Fields(5)
FrmRKQD.Grid.TextMatrix(FrmRKQD.Grid.Rows - 1, 2) = RstQD.Fields(6)
FrmRKQD.Grid.TextMatrix(FrmRKQD.Grid.Rows - 1, 3) = RstQD.Fields(7)
FrmRKQD.Grid.TextMatrix(FrmRKQD.Grid.Rows - 1, 4) = RstQD.Fields(8)
FrmRKQD.Grid.TextMatrix(FrmRKQD.Grid.Rows - 1, 5) = RstQD.Fields(9)
FrmRKQD.Grid.TextMatrix(FrmRKQD.Grid.Rows - 1, 6) = Format(RstQD.Fields(10), "0.00")
FrmRKQD.Grid.TextMatrix(FrmRKQD.Grid.Rows - 1, 7) = Format(RstQD.Fields(11), "0.00")
SumSL = SumSL + RstQD.Fields(9)
RstQD.MoveNext
Loop
FrmRKQD.lblSL.Caption = SumSL
FrmRKQD.Show 1
End Sub
Private Sub Command4_Click()
Call FPPrint
End Sub
Private Sub Command5_Click()
Call ReSet
Call FillGrid
End Sub
Private Sub Command7_Click()
Unload Me
End Sub
Private Sub Command8_Click()
If TxtRKDBH <> "" Then
SQLTJ = " where 进货id='" & Trim(TxtRKDBH) & "'"
CmdFlag = 1
Call ReSet
Call FillGrid
End If
End Sub
Private Sub Form_Load()
DTP1.Value = Date$
DTP2.Value = Date$
CmdFlag = 0
Call ReSet
Call FillGrid
End Sub
Sub ReSet()
Grid.Clear
Grid.Rows = 1
Grid.FormatString = "订 单 号 码 |^ 工 厂 名 称 |^ 落 单 日 期 |^ 出 货 日 期 |^ 总 金 额 "
End Sub
Sub FillGrid()
'Set Rst = New Recordset
SQL = "select * from 进货总表" & SQLTJ & " order by 进货id"
'Rst.Open SQL, db, 1, 3
Set Rst = ExecuteSQL(SQL, Msgtext)
If Rst.EOF Then
If CmdFlag = 1 Then
MsgBox "找不到此入库单,请确认入库单编号输入正确!", vbOKOnly + vbInformation, "提示"
ElseIf CmdFlag = 2 Then
MsgBox "在此日期段无入库单!", vbOKOnly + vbInformation, "提示"
End If
SQLTJ = ""
Exit Sub
End If
Do While Not Rst.EOF
Grid.Rows = Grid.Rows + 1
Grid.TextMatrix(Grid.Rows - 1, 0) = Rst.Fields(0)
Grid.TextMatrix(Grid.Rows - 1, 1) = Rst.Fields(1)
Grid.TextMatrix(Grid.Rows - 1, 2) = Rst.Fields(2)
Grid.TextMatrix(Grid.Rows - 1, 3) = Rst.Fields(3)
Grid.TextMatrix(Grid.Rows - 1, 4) = Format(Rst.Fields(4), "0.00")
Rst.MoveNext
Loop
SQLTJ = ""
CmdFlag = 0
End Sub
Private Sub Grid_DblClick()
Call Command2_Click
End Sub
Private Sub Grid_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Call Command2_Click
End If
End Sub
Private Sub FPPrint()
Dim t As Integer
Dim j As Integer
Dim sum, sum1 As Integer
Set zsbexcel = New Excel.Application
zsbexcel.Visible = True
zsbexcel.SheetsInNewWorkbook = 1
Set zsbworkbook = zsbexcel.Workbooks.Open(App.Path + "\" + "sheet\订单汇总.xlt")
With zsbexcel.ActiveSheet
For t = 1 To Grid.Rows - 1
Grid.Col = 4
a = "A" + CStr(t + 4)
c = "C" + CStr(t + 4)
e = "E" + CStr(t + 4)
g = "G" + CStr(t + 4)
a1 = "I" + CStr(t + 4)
.Range(a).Value = Grid.TextMatrix(t, 0)
.Range(c).Value = Grid.TextMatrix(t, 1)
.Range(e).Value = Grid.TextMatrix(t, 2)
.Range(g).Value = Grid.TextMatrix(t, 3)
.Range(a1).Value = Grid.TextMatrix(t, 4)
Next t
'Next t
' .Cells(32, 12).Value = sum
' .Cells(31, 12).Value = sum
' .Cells(31, 11).Value = sum1
' .Cells(32, 11).Value = sum1
' .Cells(31, 2).Value = Text10 - 1
' .Cells(32, 2).Value = Text10 - 1
End With
'dd = MsgBox("yes or no", vbYesNo + vbSystemModal)
'If dd = vbNo Then Exit Sub
' zsbexcel.ActiveSheet.PageSetup.Orientation = xlPortrait 'xlLandscape
'zsbexcel.ActiveSheet.PageSetup.PaperSize = xlPaperA4
zsbexcel.Caption = "打印预览"
zsbexcel.ActiveWindow.SelectedSheets.PrintPreview
'zsbexcel.ActiveSheet.PrintOut
zsbexcel.DisplayAlerts = False
zsbexcel.Quit
zsbexcel.DisplayAlerts = True
Set zsbexcel = Nothing
Exit Sub
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -