📄 scbm_kh_ddwj.frm
字号:
_ExtentY = 741
_StockProps = 64
Enabled = -1 'True
Enabled = -1 'True
FormMinWidth = 0
FormMinHeight = 0
FormDesignHeight= 6750
FormDesignWidth = 10305
End
Begin TrueOleDBGrid60.TDBGrid TDBGrid3
Bindings = "SCBM_kh_ddWj.frx":2E41
Height = 4065
Left = 2460
OleObjectBlob = "SCBM_kh_ddWj.frx":2E59
TabIndex = 26
Top = 720
Width = 7815
End
Begin TrueOleDBGrid60.TDBGrid TDBGrid2
Bindings = "SCBM_kh_ddWj.frx":8D7C
Height = 4065
Left = 2460
OleObjectBlob = "SCBM_kh_ddWj.frx":8D94
TabIndex = 27
Top = 720
Width = 7815
End
Begin MSAdodcLib.Adodc Ado_KhbH
Height = 495
Left = 3360
Top = 3210
Width = 2655
_ExtentX = 4683
_ExtentY = 873
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Ado_KhbH"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSAdodcLib.Adodc Ado_dd_Lb
Height = 615
Left = 4680
Top = 2130
Width = 2295
_ExtentX = 4048
_ExtentY = 1085
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Ado_dd_Lb"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin TrueOleDBGrid60.TDBGrid TDBGrid1
Bindings = "SCBM_kh_ddWj.frx":ECBB
Height = 6615
Left = 0
OleObjectBlob = "SCBM_kh_ddWj.frx":ECD2
TabIndex = 28
Top = 60
Width = 2415
End
End
Attribute VB_Name = "SCBM_kh_ddWj"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim dd_tj_sl As Recordset
Dim Bqmc_s, Sjys_s, CGrq, Wcf, Gys_Mc As String
Sub combo_load()
Dim combo2_data As Recordset
Dim combo3_data As Recordset
Dim Combo4_Data As Recordset
Set combo2_data = New Recordset
combo2_data.Open "select DISTINCT khmc from yy_khdd_rpt ", DB, adOpenStatic, adLockOptimistic
If combo2_data.RecordCount > 0 Then
For i = 1 To combo2_data.RecordCount
Combo1.AddItem (combo2_data.Fields("khmc"))
If combo2_data.EOF = False Then
combo2_data.MoveNext
End If
Next i
combo2_data.MoveFirst
End If
Set combo3_data = New Recordset
combo3_data.Open "select DISTINCT ddbh from yy_khdd_rpt", DB, adOpenStatic, adLockOptimistic
If combo3_data.RecordCount > 0 Then
For i = 1 To combo3_data.RecordCount
Combo2.AddItem (combo3_data.Fields("ddbh"))
If combo3_data.EOF = False Then
combo3_data.MoveNext
End If
Next i
combo3_data.MoveFirst
End If
Set Combo4_Data = New Recordset
Combo4_Data.Open "select DISTINCT cpmc from yy_khdd_rpt", DB, adOpenStatic, adLockOptimistic
If Combo4_Data.RecordCount > 0 Then
For i = 1 To Combo4_Data.RecordCount
Combo3.AddItem (Combo4_Data.Fields("cpmc"))
If Combo4_Data.EOF = False Then
Combo4_Data.MoveNext
End If
Next i
Combo4_Data.MoveFirst
End If
End Sub
Private Sub CmdFIND_Click()
Cmdprint.Enabled = True
If DTPicker1.Value <= DTPicker2.Value Then
If Trim(Combo1.Text) = "" Then
Gys_Mc = ""
Else
Gys_Mc = "AND khmc='" & Trim(Combo1.Text) & "'"
End If
If Trim(Combo2.Text) = "" Then
Bqmc_s = ""
Else
Bqmc_s = "AND ddbh='" & Trim(Combo2.Text) & "'"
End If
If Trim(Combo3.Text) = "" Then
Sjys_s = ""
Else
Sjys_s = "AND cpmc='" & Trim(Combo3.Text) & "'"
End If
CGrq = "and djrq>='" & DTPicker1.Value & "' and djrq<='" & DTPicker2.Value & "'"
If Option1.Value = True Then
TDBGrid3.Visible = False
TDBGrid3.DataSource = Nothing
TDBGrid2.Visible = True
TDBGrid2.DataSource = Ado_dd_Lb
Ado_dd_Lb.ConnectionString = Conn_Str
Ado_dd_Lb.RecordSource = "select * from yy_khdd_rpt where khbh<>''" & Gys_Mc & Bqmc_s & Sjys_s & Wcf & CGrq
Ado_dd_Lb.Refresh
Text3.Text = Str(Ado_dd_Lb.Recordset.RecordCount)
Set dd_tj_sl = New Recordset
dd_tj_sl.Open "select sum(isnull(sl,0)) as ddzj from yy_khdd_rpt where khbh<>''" & Gys_Mc & Bqmc_s & Sjys_s & Wcf & CGrq, DB, adOpenStatic, adLockBatchOptimistic
If dd_tj_sl.RecordCount > 0 Then
TDBGrid2.Columns(0).FooterText = "总计"
If Not IsNull(dd_tj_sl!ddzj) Then
TDBGrid2.Columns(4).FooterText = Str(Val(dd_tj_sl.Fields("ddzj").Value))
TDBGrid2.Columns(1).FooterText = Str(Ado_dd_Lb.Recordset.RecordCount) + "项"
Else
TDBGrid2.Columns(4).FooterText = ""
TDBGrid2.Columns(1).FooterText = ""
End If
End If
End If
If Option2.Value = True Then
TDBGrid2.Visible = False
TDBGrid2.DataSource = Nothing
TDBGrid3.Visible = True
TDBGrid3.DataSource = Ado_dd_Lb
Ado_dd_Lb.ConnectionString = Conn_Str
Ado_dd_Lb.RecordSource = "select * from yy_khsh_rpt where khbh<>''" & Gys_Mc & Bqmc_s & Sjys_s & Wcf & CGrq
Ado_dd_Lb.Refresh
Text3.Text = Str(Ado_dd_Lb.Recordset.RecordCount)
Set dd_tj_sl = New Recordset
dd_tj_sl.Open "select sum(isnull(sl,0)) as ddzj from yy_khsh_rpt where khbh<>''" & Gys_Mc & Bqmc_s & Sjys_s & Wcf & CGrq, DB, adOpenStatic, adLockBatchOptimistic
If dd_tj_sl.RecordCount > 0 Then
TDBGrid3.Columns(0).FooterText = "总计"
If Not IsNull(dd_tj_sl!ddzj) Then
TDBGrid3.Columns(7).FooterText = Str(Val(dd_tj_sl.Fields("ddzj").Value))
TDBGrid3.Columns(1).FooterText = Str(Ado_dd_Lb.Recordset.RecordCount) + "项"
Else
TDBGrid3.Columns(7).FooterText = ""
TDBGrid3.Columns(1).FooterText = ""
End If
End If
End If
Else
MsgBox "起始时间不能晚于截止时间,请重新设置。", vbOKOnly + 16, "系统提示"
Exit Sub
End If
End Sub
Private Sub CmdPrint_Click()
If Option2.Value = True Then
YY_KhSh_TJB.QSRQ.Caption = DTPicker1.Value
YY_KhSh_TJB.JZRQ.Caption = DTPicker2.Value
YY_KhSh_TJB.L_BT.Caption = "客 户 送 货 情 况 统 计 表"
YY_KhSh_TJB.DataControl1.ConnectionString = Conn_Str
YY_KhSh_TJB.DataControl1.Recordset = Ado_dd_Lb.Recordset
YY_KhSh_TJB.Show VBRUN.FormShowConstants.vbModal
End If
If Option1.Value = True Then
YY_KhDd_TjB.QSRQ.Caption = DTPicker1.Value
YY_KhDd_TjB.JZRQ.Caption = DTPicker2.Value
YY_KhDd_TjB.L_BT.Caption = "客 户 订 单 详 细 列 表"
YY_KhDd_TjB.DataControl1.ConnectionString = Conn_Str
YY_KhDd_TjB.DataControl1.Recordset = Ado_dd_Lb.Recordset
YY_KhDd_TjB.Show VBRUN.FormShowConstants.vbModal
End If
Cmdprint.Enabled = False
End Sub
Private Sub Command1_Click()
Unload Me
End Sub
Private Sub Form_Load()
Me.Width = main_FRM.Picture1.Width - 30
Me.Top = main_FRM.ActiveBar21.Bands("Band7").Height * 2.5 - 65
Me.Height = main_FRM.Picture1.Height - 300
Me.Left = main_FRM.Picture1.Left + 15
DTPicker1.Value = VBA.Date - 30
DTPicker2.Value = VBA.Date
TDBGrid3.Visible = False
Option1.Value = True
Call combo_load
Ado_KhbH.ConnectionString = Conn_Str
Ado_KhbH.RecordSource = "select distinct khbh,khmc from yy_khdd_rpt order by khbh,khmc"
Ado_KhbH.Refresh
End Sub
Private Sub TDBGrid1_DblClick()
On Error Resume Next
If Option1.Value = True Then
Text1.Text = TDBGrid1.Columns(0).Value
Text2.Text = TDBGrid1.Columns(1).Value
TDBGrid3.Visible = False
TDBGrid3.DataSource = Nothing
TDBGrid2.Visible = True
TDBGrid2.DataSource = Ado_dd_Lb
Ado_dd_Lb.ConnectionString = Conn_Str
Ado_dd_Lb.RecordSource = "select * from yy_khdd_rpt where khbh='" & Text1.Text & "' order by ddbh"
Ado_dd_Lb.Refresh
Text3.Text = Str(Ado_dd_Lb.Recordset.RecordCount)
Set dd_tj_sl = New Recordset
dd_tj_sl.Open "select sum(isnull(sl,0)) as ddzj from yy_khdd_rpt where khbh='" & Text1.Text & "'", DB, adOpenStatic, adLockBatchOptimistic
If dd_tj_sl.RecordCount > 0 Then
TDBGrid2.Columns(0).FooterText = "总计"
TDBGrid2.Columns(4).FooterText = Str(Val(dd_tj_sl.Fields("ddzj").Value))
TDBGrid2.Columns(1).FooterText = Str(Ado_dd_Lb.Recordset.RecordCount) + "项"
End If
TDBGrid2.Refresh
End If
If Option2.Value = True Then
Text1.Text = TDBGrid1.Columns(0).Value
Text2.Text = TDBGrid1.Columns(1).Value
TDBGrid2.Visible = False
TDBGrid2.DataSource = Nothing
TDBGrid3.Visible = True
TDBGrid3.DataSource = Ado_dd_Lb
Ado_dd_Lb.ConnectionString = Conn_Str
Ado_dd_Lb.RecordSource = "select * from yy_khsh_rpt where khbh='" & Text1.Text & "' order by ddbh"
Ado_dd_Lb.Refresh
Text3.Text = Str(Ado_dd_Lb.Recordset.RecordCount)
Set dd_tj_sl = New Recordset
dd_tj_sl.Open "select sum(isnull(sl,0)) as ddzj from yy_khsh_rpt where khbh='" & Text1.Text & "'", DB, adOpenStatic, adLockBatchOptimistic
If dd_tj_sl.RecordCount > 0 Then
TDBGrid3.Columns(0).FooterText = "总计"
TDBGrid3.Columns(7).FooterText = Str(Val(dd_tj_sl.Fields("ddzj").Value))
TDBGrid3.Columns(1).FooterText = Str(Ado_dd_Lb.Recordset.RecordCount) + "项"
End If
TDBGrid2.Refresh
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -