📄 yy_khdd_sh_tjb.frm
字号:
Width = 1485
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "客户编号:"
BeginProperty Font
Name = "宋体"
Size = 11.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 330
Index = 0
Left = 30
TabIndex = 4
Top = 255
Width = 1455
End
End
Begin TrueOleDBGrid60.TDBGrid TDBGrid2
Bindings = "yy_KHDD_SH_tjB.frx":1707
Height = 4065
Left = 2460
OleObjectBlob = "yy_KHDD_SH_tjB.frx":171F
TabIndex = 25
Top = 690
Width = 7815
End
Begin MSAdodcLib.Adodc Ado_KhbH
Height = 495
Left = 3360
Top = 3150
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 = 2070
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 = "yy_KHDD_SH_tjB.frx":8262
Height = 6615
Left = 0
OleObjectBlob = "yy_KHDD_SH_tjB.frx":8279
TabIndex = 26
Top = 30
Width = 2415
End
End
Attribute VB_Name = "yy_KHDD_SH_tjB"
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_shqk_tjb ", 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_shqk_tjb", 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_shqk_tjb", 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(Combo2.Text) = "" And Trim(Combo3.Text) = "" And Trim(Combo1.Text) = "" Then
' MsgBox "查询选项至少有一项不能为空,请核对。", vbOKOnly + 16, "系统提示"
' Exit Sub
' Else
' Cmdprint.Enabled = True
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
If Op1.Value = True Then
CGrq = "and djrq>='" & DTPicker1.Value & "' and djrq<='" & DTPicker2.Value & "'"
End If
If Option2.Value = True Then
CGrq = "and shrq>='" & DTPicker1.Value & "' and shrq<='" & DTPicker2.Value & "'"
End If
If Option2.Value = True Then
CGrq = "and shrq>='" & DTPicker1.Value & "' and shrq<='" & DTPicker2.Value & "'"
End If
If Check1.Value <> 1 And Check2.Value = 1 Then
Wcf = "and wanch='完成'"
TDBGrid2.Splits(0).Caption = "客户订单送货量已足统计表"
TDBGrid2.Refresh
End If
If Check1.Value = 1 And Check2.Value <> 1 Then
Wcf = "and (wanch='未完成' or wanch is null or wanch='')"
TDBGrid2.Splits(0).Caption = "送货未足客户订单跟踪表"
TDBGrid2.Refresh
End If
If (Check1.Value = 1 And Check2.Value = 1) Or (Check1.Value <> 1 And Check2.Value <> 1) Then
Wcf = ""
TDBGrid2.Splits(0).Caption = "客户订单送货情况统计表"
TDBGrid2.Refresh
End If
Ado_dd_Lb.ConnectionString = Conn_Str
Ado_dd_Lb.RecordSource = "select * from yy_khdd_shqk_tjb where khbh<>''" & Gys_Mc & Bqmc_s & Sjys_s & Wcf & CGrq & "order by ddbh,cpmc"
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,sum(isnull(shsl,0)) as wjsl from yy_khdd_shqk_tjb 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) And Not IsNull(dd_tj_sl!WJsl) Then
TDBGrid2.Columns(7).FooterText = Str(Val(dd_tj_sl.Fields("ddzj").Value))
TDBGrid2.Columns(8).FooterText = Str(Val(dd_tj_sl.Fields("wjsl").Value))
TDBGrid2.Columns(1).FooterText = Str(Ado_dd_Lb.Recordset.RecordCount) + "项"
Else
TDBGrid2.Columns(7).FooterText = ""
TDBGrid2.Columns(8).FooterText = ""
TDBGrid2.Columns(1).FooterText = ""
End If
End If
'End If
Else
MsgBox "起始时间不能晚于截止时间,请重新设置。", vbOKOnly + 16, "系统提示"
Exit Sub
End If
End Sub
Private Sub CmdPrint_Click()
yy_KhDd_ShQk_rpt.QSRQ.Caption = DTPicker1.Value
yy_KhDd_ShQk_rpt.JZRQ.Caption = DTPicker2.Value
yy_KhDd_ShQk_rpt.L_BT.Caption = TDBGrid2.Splits(0).Caption
yy_KhDd_ShQk_rpt.DataControl1.ConnectionString = Conn_Str
yy_KhDd_ShQk_rpt.DataControl1.Recordset = Ado_dd_Lb.Recordset
yy_KhDd_ShQk_rpt.Show VBRUN.FormShowConstants.vbModal
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
Cmdprint.Enabled = False
DTPicker1.Value = VBA.Date - 30
DTPicker2.Value = VBA.Date
Op1.Value = True
Call combo_load
Ado_KhbH.ConnectionString = Conn_Str
Ado_KhbH.RecordSource = "select distinct khbh,khmc from yy_khdd_shqk_tjb order by khbh,khmc"
Ado_KhbH.Refresh
End Sub
Private Sub TDBGrid1_DblClick()
On Error Resume Next
Text1.Text = TDBGrid1.Columns(0).Value
Text2.Text = TDBGrid1.Columns(1).Value
TDBGrid2.Splits(0).Caption = "客户订单送货情况_列表"
TDBGrid2.Refresh
Ado_dd_Lb.ConnectionString = Conn_Str
Ado_dd_Lb.RecordSource = "select * from yy_khdd_shqk_tjb where khbh='" & Text1.Text & "'"
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,sum(isnull(shsl,0)) as wjsl from yy_khdd_shqk_tjb where khbh='" & Text1.Text & "'", DB, adOpenStatic, adLockBatchOptimistic
If dd_tj_sl.RecordCount > 0 Then
TDBGrid2.Columns(0).FooterText = "总计"
TDBGrid2.Columns(7).FooterText = Str(Val(dd_tj_sl.Fields("ddzj").Value))
TDBGrid2.Columns(8).FooterText = Str(Val(dd_tj_sl.Fields("wjsl").Value))
TDBGrid2.Columns(1).FooterText = Str(Ado_dd_Lb.Recordset.RecordCount) + "项"
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -