⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 grid of purchse order.frm

📁 This project is to design the automated system for the inventory of Al-Ahmad Cotton and Oil Mills si
💻 FRM
📖 第 1 页 / 共 3 页
字号:
Public Sub ahmad1()
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 Option1.Value = True Then
If nm.Text = "" Then
MsgBox "Enter the Supplier Name"
nm.SetFocus
Exit Sub
Else
'///////////////////
If rs2.State = adStateOpen Then rs2.Close
rs2.Open "select * from Supplier_Table where Sup_Name like '" & Trim(nm.Text) & "%'", cnn, adOpenStatic, adLockReadOnly
If rs2.RecordCount > 0 Then
rs2.MoveFirst
While Not rs2.EOF

'/////////////////////////////////////
If rs1.State = adStateOpen Then rs1.Close
rs1.Open " select * from Purchase_Given_Order_Table where Sup_Code='" & rs2.Fields("Sup_Code") & "'", cnn, adOpenStatic, adLockReadOnly
If rs1.RecordCount > 0 Then

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")
Grid1.TextMatrix(Grid1.Rows - 1, 4) = rs2.Fields("Sup_Name")
'//////////////////////////////////////
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"))
'///////////////////////////
Grid1.Rows = Grid1.Rows + 1
rs2.MoveNext
End If
Wend
End If
End If
End If
End Sub

Private Sub Option2_Click()
code.Text = ""
nm.Text = ""
cust.Text = ""
code.Enabled = False
nm.Enabled = False
fdate.Enabled = False
tdate.Enabled = False
vdate.Enabled = False
cust.Enabled = True
cust.SetFocus
End Sub

Private Sub Option4_Click()
code.Text = ""
nm.Text = ""
code.Enabled = False
nm.Enabled = False
cust.Enabled = False
vdate.Enabled = False
fdate.Enabled = True
tdate.Enabled = True
fdate.SetFocus
End Sub

Private Sub Option5_Click()
code.Text = ""
nm.Text = ""
nm.Enabled = False
cust.Enabled = False
fdate.Enabled = False
tdate.Enabled = False
code.Enabled = False
vdate.Enabled = True
vdate.SetFocus
End Sub

Private Sub select_Click()
If callingform.Name = "MDIForm1" Then
Exit Sub
End If
'/////////////////////////////

If callingform.Name = "Form25" Then
If Grid1.TextMatrix(Grid1.RowSel, 0) = "" Then
MsgBox "No Record Exists"
Exit Sub
Else

callingform.Text1.Text = Grid1.TextMatrix(Grid1.RowSel, 0)
callingform.Text2.Text = Grid1.TextMatrix(Grid1.RowSel, 3)
callingform.nam.Text = Grid1.TextMatrix(Grid1.RowSel, 6)
callingform.Text4.Text = Grid1.TextMatrix(Grid1.RowSel, 8)
callingform.dat.Value = Grid1.TextMatrix(Grid1.RowSel, 1)
callingform.date1 = Grid1.TextMatrix(Grid1.RowSel, 2)
callingform.Text3.Text = Grid1.TextMatrix(Grid1.RowSel, 7)
callingform.Text8.Text = Grid1.TextMatrix(Grid1.RowSel, 9)
callingform.code.Text = Grid1.TextMatrix(Grid1.RowSel, 5)
callingform.Text5.Text = Grid1.TextMatrix(Grid1.RowSel, 4)
Unload Me




Exit Sub
End If
End If
'////////////////////////
If callingform.Name = "form4" Then
callingform.csid(2).Text = Grid1.TextMatrix(Grid1.RowSel, 0)
callingform.scode(1).Text = Grid1.TextMatrix(Grid1.RowSel, 3)
callingform.cusid(1).Text = Grid1.TextMatrix(Grid1.RowSel, 3)
callingform.totalm(1).Text = Grid1.TextMatrix(Grid1.RowSel, 6)
callingform.mrate(1).Text = Grid1.TextMatrix(Grid1.RowSel, 7)
Unload Me
End If
If callingform.Name = "Form11" Then
callingform.csid(2).Text = Grid1.TextMatrix(Grid1.RowSel, 0)
callingform.scode(1).Text = Grid1.TextMatrix(Grid1.RowSel, 3)
callingform.cusid(1).Text = Grid1.TextMatrix(Grid1.RowSel, 3)
callingform.totalm(1).Text = Grid1.TextMatrix(Grid1.RowSel, 6)
callingform.mrate(1).Text = Grid1.TextMatrix(Grid1.RowSel, 7)
Unload Me
End If


'///////////////////////////////
If callingform.Name = "Form10" Then
callingform.csid(2).Text = Grid1.TextMatrix(Grid1.RowSel, 0)
callingform.scode(1).Text = Grid1.TextMatrix(Grid1.RowSel, 3)
'callingform.cusid(1).Text = Grid1.TextMatrix(Grid1.RowSel, 3)
callingform.totalm(1).Text = Grid1.TextMatrix(Grid1.RowSel, 7)
callingform.mrate(1).Text = Grid1.TextMatrix(Grid1.RowSel, 8)
callingform.Item(2).Text = Grid1.TextMatrix(Grid1.RowSel, 6)
callingform.oexp(0).Text = Grid1.TextMatrix(Grid1.RowSel, 5)
callingform.amount(1).Text = Grid1.TextMatrix(Grid1.RowSel, 9)
callingform.namount(1).Text = Grid1.TextMatrix(Grid1.RowSel, 9)
callingform.nam(0).Text = Grid1.TextMatrix(Grid1.RowSel, 4)
Unload Me
End If
'//////////////////////////////////
End Sub
Public Sub ahmad2()
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"
cust.SetFocus
Exit Sub
End If
If Option2.Value = True Then
If cust.Text = "" Then
MsgBox "please Enter the Customer Code"
cust.SetFocus
Exit Sub
Else
If rs1.State = adStateOpen Then rs1.Close

rs1.Open " select * from Purchase_Given_Order_Table where Sup_Code=" & Val(cust.Text), cnn, adOpenStatic, adLockReadOnly
If rs1.RecordCount = 0 Then
MsgBox "Requested Record does not exist"
cust.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
End Sub
Public Sub ahmad3()
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"
fdate.SetFocus
Exit Sub
End If
If Option4.Value = True Then
If fdate.Value > tdate.Value Then
MsgBox "From Date must be smaller than the ToDate"
fdate.SetFocus
Exit Sub
Else
If rs1.State = adStateOpen Then rs1.Close

rs1.Open " select * from Purchase_Given_Order_Table where Order_Date >='" & fdate.Value & " ' and Order_Date <='" & tdate.Value & " '", cnn, adOpenStatic, adLockReadOnly
If rs1.RecordCount = 0 Then
MsgBox "Requested Record does not exist"
fdate.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
End Sub
Public Sub ahmad4()
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"
vdate.SetFocus
Exit Sub
End If
If Option5.Value = True Then
If vdate.Value = "" Then
MsgBox "Please Enter the Valid Date of the Contracts"
vdate.SetFocus
Exit Sub
Else
If rs1.State = adStateOpen Then rs1.Close

rs1.Open " select * from Purchase_Given_Order_Table where Valid_Date='" & vdate.Value & "'", cnn, adOpenStatic, adLockReadOnly
If rs1.RecordCount = 0 Then
MsgBox "Requested Record does not exist"
vdate.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
End Sub



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -