📄 grid of purchse order.frm
字号:
Left = 6840
Top = 0
Visible = 0 'False
Width = 1695
_ExtentX = 2990
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=hussain"
OLEDBString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=hussain"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "Purchase_Given_Order_Table"
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.Image Image3
Height = 585
Left = 9860
Picture = "grid of purchse order.frx":0000
Top = 6925
Width = 615
End
Begin VB.Label Label2
BackColor = &H80000013&
Height = 6975
Left = 10080
TabIndex = 21
Top = 0
Width = 375
End
Begin VB.Image Image2
Height = 915
Left = -480
Picture = "grid of purchse order.frx":1326
Top = 7520
Width = 10620
End
Begin VB.Image Image1
Height = 8460
Left = 10120
Picture = "grid of purchse order.frx":20D84
Top = 0
Width = 1800
End
Begin VB.Label Label1
BackColor = &H80000013&
Caption = "Search Purchase Contract"
BeginProperty Font
Name = "Times New Roman"
Size = 24
Charset = 0
Weight = 700
Underline = -1 'True
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 2520
TabIndex = 5
Top = 360
Width = 5535
End
End
Attribute VB_Name = "Form26"
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 rs2 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) = "Contract No"
Grid1.TextMatrix(0, 1) = "Contract Date"
Grid1.TextMatrix(0, 2) = "Valid Upto"
Grid1.TextMatrix(0, 3) = "Supplier Code"
Grid1.TextMatrix(0, 4) = "Supplier Name"
Grid1.TextMatrix(0, 5) = "Product Code"
Grid1.TextMatrix(0, 6) = "Product Name"
Grid1.TextMatrix(0, 7) = "Total Qty(Mn)"
Grid1.TextMatrix(0, 8) = "Rate/Mn"
Grid1.TextMatrix(0, 9) = "Total Amount"
If rs1.State = adStateOpen Then rs1.Close
rs1.Open " Purchase_Given_Order_Table ", cnn, adOpenStatic, adLockReadOnly
If rs1.RecordCount = 0 Then
MsgBox " No Record Exists"
Exit Sub
End If
If Op1.Value = False And Option2.Value = False And Option1.Value = False And Option4.Value = False And Option5.Value = False Then
MsgBox "First Select an Option"
Else
If Op1.Value = True Then
If code.Text = "" Then
MsgBox "please Enter the Contract No"
code.SetFocus
Exit Sub
'End If
Else
If rs1.State = adStateOpen Then rs1.Close
rs1.Open " select * from Purchase_Given_Order_Table where P_Given_Order=" & Val(code.Text), cnn, adOpenStatic, adLockReadOnly
If rs1.RecordCount = 0 Then
MsgBox "Requested Record does not exist"
code.SetFocus
Exit Sub
Else
rs1.MoveFirst
While Not rs1.EOF
Grid1.TextMatrix(Grid1.Rows - 1, 0) = rs1.Fields("P_Given_Order")
Grid1.TextMatrix(Grid1.Rows - 1, 1) = rs1.Fields("Order_Date")
Grid1.TextMatrix(Grid1.Rows - 1, 2) = rs1.Fields("Valid_Date")
Grid1.TextMatrix(Grid1.Rows - 1, 3) = rs1.Fields("Sup_Code")
'//////////////////////////////////////
If rs.State = adStateOpen Then rs.Close
rs.Open "select * from Purchase_Given_Order_Detail_Table where P_Given_Order= '" & rs1.Fields("P_Given_Order") & "'", cnn, adOpenStatic, adLockReadOnly
Grid1.TextMatrix(Grid1.Rows - 1, 5) = rs.Fields("Product_Code")
Grid1.TextMatrix(Grid1.Rows - 1, 6) = rs.Fields("Product_Name")
Grid1.TextMatrix(Grid1.Rows - 1, 7) = rs.Fields("Total_Mounds")
Grid1.TextMatrix(Grid1.Rows - 1, 8) = rs.Fields("Rate/Mn")
Grid1.TextMatrix(Grid1.Rows - 1, 9) = Val(rs.Fields("Rate/Mn")) * Val(rs.Fields("Total_Mounds"))
'/////////////////////////////////////////////////
If rs2.State = adStateOpen Then rs2.Close
rs2.Open "select * from Supplier_Table where Sup_Code=" & rs1.Fields("Sup_Code"), cnn, adOpenStatic, adLockReadOnly
Grid1.TextMatrix(Grid1.Rows - 1, 4) = rs2.Fields("Sup_Name")
'///////////////////////////
Grid1.Rows = Grid1.Rows + 1
rs1.MoveNext
Wend
End If
End If
End If
If Option1.Value = True Then
ahmad1
End If
If Option2.Value = True Then
ahmad2
End If
If Option4.Value = True Then
ahmad3
End If
If Option5.Value = True Then
ahmad4
End If
End If
End Sub
Private Sub Command4_Click()
If sup.Visible = False And Grid2.Visible = False Then
sup.Visible = True
Grid2.Visible = True
Else
sup.Visible = False
Grid2.Visible = False
End If
End Sub
Private Sub Command5_Click()
End Sub
Private Sub DTPicker1_CallbackKeyDown(ByVal KeyCode As Integer, ByVal Shift As Integer, ByVal CallbackField As String, CallbackDate As Date)
End Sub
Private Sub Form_Load()
Grid1.TextMatrix(0, 0) = "Contract No"
Grid1.TextMatrix(0, 1) = "Contract Date"
Grid1.TextMatrix(0, 2) = "Valid Upto"
Grid1.TextMatrix(0, 3) = "Supplier Code"
Grid1.TextMatrix(0, 4) = "Supplier Name"
Grid1.TextMatrix(0, 5) = "Product Code"
Grid1.TextMatrix(0, 6) = "Product Name"
Grid1.TextMatrix(0, 7) = "Total Qty(Mn)"
Grid1.TextMatrix(0, 8) = "Rate/Mn"
Grid1.TextMatrix(0, 9) = "Total Amount"
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 "Purchase_Given_Order_Table", cnn, adOpenStatic, adLockReadOnly
If rs1.RecordCount > 0 Then
rs1.MoveFirst
While Not rs1.EOF
Grid1.TextMatrix(Grid1.Rows - 1, 0) = rs1.Fields("P_Given_Order")
Grid1.TextMatrix(Grid1.Rows - 1, 1) = rs1.Fields("Order_Date")
Grid1.TextMatrix(Grid1.Rows - 1, 2) = rs1.Fields("Valid_Date")
Grid1.TextMatrix(Grid1.Rows - 1, 3) = rs1.Fields("Sup_Code")
If rs.State = adStateOpen Then rs.Close
rs.Open "select * from Purchase_Given_Order_Detail_Table where P_Given_Order= '" & rs1.Fields("P_Given_Order") & "'", cnn, adOpenStatic, adLockReadOnly
Grid1.TextMatrix(Grid1.Rows - 1, 5) = rs.Fields("Product_Code")
Grid1.TextMatrix(Grid1.Rows - 1, 6) = rs.Fields("Product_Name")
Grid1.TextMatrix(Grid1.Rows - 1, 7) = rs.Fields("Total_Mounds")
Grid1.TextMatrix(Grid1.Rows - 1, 8) = rs.Fields("Rate/Mn")
Grid1.TextMatrix(Grid1.Rows - 1, 9) = Val(rs.Fields("Rate/Mn")) * Val(rs.Fields("Total_Mounds"))
'//////////////////////
If rs2.State = adStateOpen Then rs2.Close
rs2.Open "select * from Supplier_Table where Sup_Code=" & rs1.Fields("Sup_Code"), cnn, adOpenStatic, adLockReadOnly
Grid1.TextMatrix(Grid1.Rows - 1, 4) = rs2.Fields("Sup_Name")
'//////////////////////////
Grid1.Rows = Grid1.Rows + 1
rs1.MoveNext
Wend
End If
'Grid1.ColWidth(0) = 1000
Grid1.ColWidth(1) = 1200
Grid1.ColWidth(2) = 1300
Grid1.ColWidth(3) = 1200
Grid1.ColWidth(4) = 2300
Grid1.ColWidth(5) = 1200
Grid1.ColWidth(7) = 1200
Grid1.ColWidth(6) = 1200
Grid1.ColWidth(8) = 1200
Grid1.ColWidth(9) = 1200
code.Enabled = False
nm.Enabled = False
'fdate.Value = Now
'tdate.Value = Now
'vdate.Value = Now
End Sub
Private Sub Grid1_Click()
'Grid2.Visible = True
'If rs.State = adStateOpen Then rs.Close
'rs.Open "select * from Supplier_Table where Sup_Code=" & Grid1.TextMatrix(Grid1.RowSel, Grid1.ColSel), cnn, adOpenStatic, adLockReadOnly
'If rs.RecordCount = 0 Then
'MsgBox "Record Not Found"
'Exit Sub
'Else
'Set Grid2.DataSource = rs
'Grid2.Refresh
'End If
'Grid1.BackColorSel = &H0&
'Grid1.Row.Color == &H888880
End Sub
Private Sub Op1_Click()
code.Text = ""
nm.Text = ""
nm.Enabled = False
cust.Enabled = False
fdate.Enabled = False
tdate.Enabled = False
code.Enabled = True
vdate.Enabled = False
code.SetFocus
End Sub
Private Sub Option1_Click()
code.Text = ""
nm.Text = ""
code.Enabled = False
cust.Enabled = False
fdate.Enabled = False
tdate.Enabled = False
vdate.Enabled = False
nm.Enabled = True
nm.SetFocus
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -