📄 grid of oil refining.frm
字号:
End
Begin MSComCtl2.DTPicker tdate
Height = 315
Left = 2520
TabIndex = 3
Top = 6360
Width = 1455
_ExtentX = 2566
_ExtentY = 556
_Version = 393216
Format = 63635457
CurrentDate = 38278
End
Begin VB.Image Image3
Height = 585
Left = 9860
Picture = "grid of oil refining.frx":0000
Top = 6620
Width = 615
End
Begin VB.Image Image2
Height = 915
Left = -480
Picture = "grid of oil refining.frx":1326
Top = 7200
Width = 10620
End
Begin VB.Label Label3
BackColor = &H80000013&
Height = 6735
Left = 10080
TabIndex = 17
Top = 0
Width = 375
End
Begin VB.Image Image1
Height = 8100
Left = 10120
Picture = "grid of oil refining.frx":20D84
Top = 0
Width = 1800
End
Begin VB.Label Label1
BackColor = &H80000013&
Caption = "Search Oil Refining Detail"
BeginProperty Font
Name = "Times New Roman"
Size = 24
Charset = 0
Weight = 700
Underline = -1 'True
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 1800
TabIndex = 0
Top = 360
Width = 5775
End
End
Attribute VB_Name = "Form19"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public callingform As Object
Dim rs1 As New ADODB.Recordset
Dim rs As New ADODB.Recordset
Dim cnn As New ADODB.Connection
Private Sub Command1_Click()
Unload Me
End Sub
Private Sub Command2_Click()
Grid1.clear
Grid1.Rows = 2
Grid1.TextMatrix(0, 0) = "Refining No"
Grid1.TextMatrix(0, 1) = "Refining Date"
Grid1.TextMatrix(0, 2) = "Crude Oil Used(Mn)"
Grid1.TextMatrix(0, 3) = "Castic Soda Used(Mn)"
Grid1.TextMatrix(0, 4) = "Refinie Oil Prod(Mn)"
Grid1.TextMatrix(0, 5) = "Dirt Oil Prod(Mn)"
Grid1.TextMatrix(0, 6) = "Shortage(Mn)"
If Option1.Value = False And Option2.Value = False Then
MsgBox "First Select an Option"
Exit Sub
End If
'//////////////
If rs1.State = adStateOpen Then rs1.Close
rs1.Open " SeedCrtshing ", cnn, adOpenStatic, adLockReadOnly
If rs1.RecordCount = 0 Then
MsgBox " No Record Exists"
Exit Sub
End If
'///////////////////
If Option2.Value = True Then
If crush.Text = "" Then
MsgBox "Enter the Refining No"
crush.SetFocus
Exit Sub
End If
If rs1.State = adStateOpen Then rs1.Close
rs1.Open "select * from OilRefining where RefNo=" & Val(crush.Text), cnn, adOpenStatic, adLockReadOnly
If rs1.RecordCount = 0 Then
MsgBox "This Refinig Record does not Exists"
Exit Sub
Else
rs1.MoveFirst
While Not rs1.EOF
Grid1.TextMatrix(Grid1.Rows - 1, 0) = rs1.Fields("RefNo")
Grid1.TextMatrix(Grid1.Rows - 1, 1) = rs1.Fields("RefDate")
Grid1.TextMatrix(Grid1.Rows - 1, 2) = rs1.Fields("CrudeOilMnUsed")
Grid1.TextMatrix(Grid1.Rows - 1, 3) = rs1.Fields("CasticSodaMnCosm")
Grid1.TextMatrix(Grid1.Rows - 1, 4) = rs1.Fields("RefOilMnProd")
Grid1.TextMatrix(Grid1.Rows - 1, 5) = rs1.Fields("OilDirtMnProd")
Grid1.TextMatrix(Grid1.Rows - 1, 6) = rs1.Fields("Shortage")
Grid1.Rows = Grid1.Rows + 1
rs1.MoveNext
Wend
End If
End If
If Option1.Value = True Then
atta
End If
End Sub
Private Sub Form_Load()
Grid1.ColWidth(0) = 1200
Grid1.ColWidth(1) = 1200
Grid1.ColWidth(2) = 1500
Grid1.ColWidth(3) = 1600
Grid1.ColWidth(4) = 1500
Grid1.ColWidth(5) = 1200
Grid1.ColWidth(6) = 1200
Grid1.TextMatrix(0, 0) = "Refining No"
Grid1.TextMatrix(0, 1) = "Refining Date"
Grid1.TextMatrix(0, 2) = "Crude Oil Used(Mn)"
Grid1.TextMatrix(0, 3) = "Castic Soda Used(Mn)"
Grid1.TextMatrix(0, 4) = "Refinie Oil Prod(Mn)"
Grid1.TextMatrix(0, 5) = "Dirt Oil Prod(Mn)"
Grid1.TextMatrix(0, 6) = "Shortage(Mn)"
If cnn.State = adStateOpen Then cnn.Close
cnn.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=hussain"
If rs1.State = adStateOpen Then rs1.Close
rs1.Open "OilRefining", cnn, adOpenStatic, adLockReadOnly
If rs1.RecordCount > 0 Then
rs1.MoveFirst
While Not rs1.EOF
Grid1.TextMatrix(Grid1.Rows - 1, 0) = rs1.Fields("RefNo")
Grid1.TextMatrix(Grid1.Rows - 1, 1) = rs1.Fields("RefDate")
Grid1.TextMatrix(Grid1.Rows - 1, 2) = rs1.Fields("CrudeOilMnUsed")
Grid1.TextMatrix(Grid1.Rows - 1, 3) = rs1.Fields("CasticSodaMnCosm")
Grid1.TextMatrix(Grid1.Rows - 1, 4) = rs1.Fields("RefOilMnProd")
Grid1.TextMatrix(Grid1.Rows - 1, 5) = rs1.Fields("OilDirtMnProd")
Grid1.TextMatrix(Grid1.Rows - 1, 6) = rs1.Fields("Shortage")
Grid1.Rows = Grid1.Rows + 1
rs1.MoveNext
Wend
'fdate1.Value = Now
'tdate1.Value = Now
End If
End Sub
Private Sub Option1_Click()
crush.Text = ""
crush.Enabled = False
fdate1.Enabled = True
tdate1.Enabled = True
fdate.SetFocus
End Sub
Private Sub Option2_Click()
crush.Text = ""
fdate1.Enabled = False
tdate1.Enabled = False
crush.Enabled = True
crush.SetFocus
End Sub
Private Sub select_Click()
'/////////////////////////////
If callingform.Name = "MDIForm1" Then
Exit Sub
End If
'//////////////////////////////
If callingform.Name = "form3" Then
If Grid1.TextMatrix(Grid1.RowSel, 0) = "" Then
MsgBox "No Record Exists"
Exit Sub
Else
callingform.refno(1).Text = Grid1.TextMatrix(Grid1.RowSel, 0)
callingform.refno(0).Text = Grid1.TextMatrix(Grid1.RowSel, 1)
callingform.crudeoilmnused.Text = Grid1.TextMatrix(Grid1.RowSel, 2)
a = Val(Grid1.TextMatrix(Grid1.RowSel, 2)) * 37.324
form3.ckg.Text = CStr(Round(a, 0))
callingform.casticsodamncon.Text = Grid1.TextMatrix(Grid1.RowSel, 3)
b = Val(Grid1.TextMatrix(Grid1.RowSel, 3)) * 37.324
form3.cskg(0).Text = CStr(Round(b, 0))
callingform.refoilmnprod.Text = Grid1.TextMatrix(Grid1.RowSel, 4)
c = Val(Grid1.TextMatrix(Grid1.RowSel, 4)) * 37.324
form3.rkg.Text = CStr(Round(c, 0))
callingform.oildirtmnprod.Text = Grid1.TextMatrix(Grid1.RowSel, 5)
d = Val(Grid1.TextMatrix(Grid1.RowSel, 5)) * 37.324
form3.dkg.Text = CStr(Round(d, 0))
callingform.shortage.Text = Grid1.TextMatrix(Grid1.RowSel, 6)
e = Val(Grid1.TextMatrix(Grid1.RowSel, 6)) * 37.324
form3.rshortage.Text = CStr(Round(e, 0))
Unload Me
Exit Sub
End If
End If
'////////////////////////
End Sub
Public Sub atta()
If Option1.Value = True Then
If fdate1.Value = "" Then
MsgBox "Please Enter the From Date"
fdate1.SetFocus
Exit Sub
End If
'///////////////////
If Option1.Value = True Then
If fdate1.Value > tdate1.Value Then
MsgBox "From Date must be smaller than the ToDate"
fdate1.SetFocus
Exit Sub
Else
'////////////////////
If rs1.State = adStateOpen Then rs1.Close
rs1.Open " select * from OilRefining where RefDate>='" & fdate1.Value & " ' and RefDate <='" & tdate1.Value & " '", cnn, adOpenStatic, adLockReadOnly
If rs1.RecordCount = 0 Then
MsgBox "Oil is not Refining between these dates"
Exit Sub
Else
rs1.MoveFirst
While Not rs1.EOF
Grid1.TextMatrix(Grid1.Rows - 1, 0) = rs1.Fields("RefNo")
Grid1.TextMatrix(Grid1.Rows - 1, 1) = rs1.Fields("RefDate")
Grid1.TextMatrix(Grid1.Rows - 1, 2) = rs1.Fields("CrudeOilMnUsed")
Grid1.TextMatrix(Grid1.Rows - 1, 3) = rs1.Fields("CasticSodaMnCosm")
Grid1.TextMatrix(Grid1.Rows - 1, 4) = rs1.Fields("RefOilMnProd")
Grid1.TextMatrix(Grid1.Rows - 1, 5) = rs1.Fields("OilDirtMnProd")
Grid1.TextMatrix(Grid1.Rows - 1, 6) = rs1.Fields("Shortage")
Grid1.Rows = Grid1.Rows + 1
rs1.MoveNext
Wend
End If
End If
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -