📄 cg_shqk_tjb.frm
字号:
End
Begin VB.Label Label5
Caption = "采购单编号:"
Height = 225
Left = 90
TabIndex = 8
Top = 600
Width = 1155
End
Begin VB.Label Label4
Caption = "物料编号:"
Height = 225
Index = 1
Left = 90
TabIndex = 7
Top = 930
Width = 945
End
End
Begin TrueOleDBGrid60.TDBGrid TDBGrid2
Bindings = "cg_ShQk_TJB.frx":1135
Height = 4215
Left = 2460
OleObjectBlob = "cg_ShQk_TJB.frx":114D
TabIndex = 0
Top = 600
Width = 7815
End
Begin MSAdodcLib.Adodc Ado_KhbH
Height = 495
Left = 3360
Top = 3120
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 = "PMingLiU"
Size = 9
Charset = 136
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 = 2040
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 = "PMingLiU"
Size = 9
Charset = 136
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin TrueOleDBGrid60.TDBGrid TDBGrid1
Bindings = "cg_ShQk_TJB.frx":6A68
Height = 6615
Left = 0
OleObjectBlob = "cg_ShQk_TJB.frx":6A7F
TabIndex = 1
Top = 0
Width = 2415
End
End
Attribute VB_Name = "cg_ShQk_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 gysmc from cg_sh_tj_rpt ", DB, adOpenStatic, adLockOptimistic
If combo2_data.RecordCount > 0 Then
For i = 1 To combo2_data.RecordCount
Combo1.AddItem (combo2_data.Fields("gysmc"))
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 cgdbh from cg_sh_tj_rpt", DB, adOpenStatic, adLockOptimistic
If combo3_data.RecordCount > 0 Then
For i = 1 To combo3_data.RecordCount
Combo2.AddItem (combo3_data.Fields("cgdbh"))
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 ylmc from cg_sh_tj_rpt", DB, adOpenStatic, adLockOptimistic
If Combo4_Data.RecordCount > 0 Then
For i = 1 To Combo4_Data.RecordCount
Combo3.AddItem (Combo4_Data.Fields("ylmc"))
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 gysMC='" & Trim(Combo1.Text) & "'"
End If
If Trim(Combo2.Text) = "" Then
Bqmc_s = ""
Else
Bqmc_s = "AND cgdbh='" & Trim(Combo2.Text) & "'"
End If
If Trim(Combo3.Text) = "" Then
Sjys_s = ""
Else
Sjys_s = "AND ylmc='" & 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 jhrq>='" & DTPicker1.Value & "' and jhrq<='" & DTPicker2.Value & "'"
End If
If Option2.Value = True Then
CGrq = "and jhrq>='" & DTPicker1.Value & "' and jhrq<='" & 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 cg_sh_tj_rpt where gysbh<>''" & 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,sum(isnull(shsl,0)) as wjsl from cg_sh_tj_rpt where gysbh<>''" & 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(4).FooterText = Str(Val(dd_tj_sl.Fields("ddzj").Value))
TDBGrid2.Columns(5).FooterText = Str(Val(dd_tj_sl.Fields("wjsl").Value))
TDBGrid2.Columns(1).FooterText = Str(Ado_dd_Lb.Recordset.RecordCount) + "项"
Else
TDBGrid2.Columns(4).FooterText = ""
TDBGrid2.Columns(5).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()
cg_CG_WH_tj.QSRQ.Caption = DTPicker1.Value
cg_CG_WH_tj.JZRQ.Caption = DTPicker2.Value
cg_CG_WH_tj.L_BT.Caption = TDBGrid2.Splits(0).Caption
cg_CG_WH_tj.DataControl1.ConnectionString = Conn_Str
cg_CG_WH_tj.DataControl1.Recordset = Ado_dd_Lb.Recordset
cg_CG_WH_tj.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
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 gysbh,gysmc from cg_sh_tj_rpt order by gysbh,gysmc"
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 cg_sh_tj_rpt where gysbh='" & 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 cg_sh_tj_rpt where gysbh='" & 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(5).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 + -