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

📄 search sale departure.frm

📁 This project is to design the automated system for the inventory of Al-Ahmad Cotton and Oil Mills si
💻 FRM
📖 第 1 页 / 共 2 页
字号:
rs.Open "select * from Departure_Table", cnn, adOpenStatic, adLockReadOnly
If rs.RecordCount > 0 Then
rs.MoveFirst
While Not rs.EOF
Grid1.TextMatrix(Grid1.Rows - 1, 0) = rs.Fields("Dep_Id")
Grid1.TextMatrix(Grid1.Rows - 1, 3) = rs.Fields("S_Supply_Order")
Grid1.TextMatrix(Grid1.Rows - 1, 1) = rs.Fields("Dep_Date")
Grid1.TextMatrix(Grid1.Rows - 1, 2) = rs.Fields("Dep_Time")
Grid1.TextMatrix(Grid1.Rows - 1, 7) = rs.Fields("TBags")
Grid1.TextMatrix(Grid1.Rows - 1, 8) = rs.Fields("W/Bag")
Grid1.TextMatrix(Grid1.Rows - 1, 9) = rs.Fields("Total_Mn")

Grid1.TextMatrix(Grid1.Rows - 1, 10) = rs.Fields("Veh_Name")
Grid1.TextMatrix(Grid1.Rows - 1, 11) = rs.Fields("Veh_No")

Grid1.TextMatrix(Grid1.Rows - 1, 13) = rs.Fields("Bilty_No")
Grid1.TextMatrix(Grid1.Rows - 1, 14) = rs.Fields("Comp_Name")
Grid1.TextMatrix(Grid1.Rows - 1, 12) = rs.Fields("Driver_Name")
'////////////////////////////////
If rs1.State = adStateOpen Then rs1.Close
rs1.Open "select * from Sale_Supply_Order_Table where S_Supply_Order='" & rs.Fields("S_Supply_Order") & "'", cnn, adOpenStatic, adLockReadOnly
Grid1.TextMatrix(Grid1.Rows - 1, 4) = rs1.Fields("S_Supply_Date")
'//////////////////////
If rs2.State = adStateOpen Then rs2.Close
rs2.Open "select * from Customer_Table where Cust_Id=" & rs1.Fields("Cust_Id"), cnn, adOpenStatic, adLockReadOnly
Grid1.TextMatrix(Grid1.Rows - 1, 5) = rs2.Fields("Cust_Name")
'//////////////////////////
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select * from Sale_Supply_Order_Detail_Table where S_Supply_Order='" & rs.Fields("S_Supply_Order") & "'", cnn, adOpenStatic, adLockReadOnly
Grid1.TextMatrix(Grid1.Rows - 1, 6) = rs3.Fields("Product_Name")
'//////////////////////////
Grid1.Rows = Grid1.Rows + 1
rs.MoveNext
Wend
End If
Grid1.ColWidth(0) = 1200
Grid1.ColWidth(1) = 1200
Grid1.ColWidth(2) = 1300
Grid1.ColWidth(3) = 1300
Grid1.ColWidth(4) = 1200
Grid1.ColWidth(5) = 2300
Grid1.ColWidth(6) = 1200
Grid1.ColWidth(7) = 1200
Grid1.ColWidth(8) = 1200
Grid1.ColWidth(9) = 1200
Grid1.ColWidth(10) = 1200
Grid1.ColWidth(11) = 1200
Grid1.ColWidth(12) = 2000
Grid1.ColWidth(13) = 1200
Grid1.ColWidth(14) = 2300
'fdate.Value = Now
'tdate.Value = Now

End Sub

Private Sub Option1_Click()
depno.Text = ""
invoice.Text = ""
invoice.Enabled = False
fdate.Enabled = False
tdate.Enabled = False
depno.Enabled = True
depno.SetFocus
End Sub

Private Sub Option2_Click()
depno.Text = ""
invoice.Text = ""
fdate.Enabled = False
tdate.Enabled = False
depno.Enabled = False
invoice.Enabled = True
invoice.SetFocus
End Sub



Private Sub Option4_Click()
depno.Text = ""
invoice.Text = ""
invoice.Enabled = False
depno.Enabled = False
fdate.Enabled = True
tdate.Enabled = True
fdate.SetFocus
End Sub

Private Sub search_Click()
Grid1.clear
Grid1.Rows = 2
Grid1.TextMatrix(0, 0) = "Departure No"
Grid1.TextMatrix(0, 1) = "Date"
Grid1.TextMatrix(0, 2) = "Departure Time"
Grid1.TextMatrix(0, 3) = "Sale Invoice No"
Grid1.TextMatrix(0, 4) = "Invoice Date"
Grid1.TextMatrix(0, 5) = "Customer Name"
Grid1.TextMatrix(0, 6) = "Product Name"
Grid1.TextMatrix(0, 7) = "Total Bags"
Grid1.TextMatrix(0, 8) = "Weight/Bag"
Grid1.TextMatrix(0, 9) = "Total Mounds"
Grid1.TextMatrix(0, 10) = "Vehical Name"
Grid1.TextMatrix(0, 11) = "Vehical No"
Grid1.TextMatrix(0, 12) = "Driver Name"
Grid1.TextMatrix(0, 13) = "Bilty No"
Grid1.TextMatrix(0, 14) = "Good Company"

'///////////////////////////////////////////
If Option1.Value = False And Option2.Value = False And Option4.Value = False Then
MsgBox "First Select an Option"
Exit Sub
End If
'//////////////
If rs1.State = adStateOpen Then rs1.Close

rs1.Open " Departure_Table ", cnn, adOpenStatic, adLockReadOnly
If rs1.RecordCount = 0 Then
MsgBox " No Record Exists"
Exit Sub
End If
'///////////////////
If Option1.Value = True Then
If depno.Text = "" Then
MsgBox "Please Enter the Departure No"
depno.SetFocus
Exit Sub
End If
If rs.State = adStateOpen Then rs.Close
rs.Open " select * from Departure_Table where Dep_Id=" & Val(depno.Text), cnn, adOpenStatic, adLockReadOnly
If rs.RecordCount = 0 Then
MsgBox " This Departure Record does not Exist "
depno.SetFocus
Else
rs.MoveFirst
While Not rs.EOF
Grid1.TextMatrix(Grid1.Rows - 1, 0) = rs.Fields("Dep_Id")
Grid1.TextMatrix(Grid1.Rows - 1, 3) = rs.Fields("S_Supply_Order")
Grid1.TextMatrix(Grid1.Rows - 1, 1) = rs.Fields("Dep_Date")
Grid1.TextMatrix(Grid1.Rows - 1, 2) = rs.Fields("Dep_Time")
Grid1.TextMatrix(Grid1.Rows - 1, 7) = rs.Fields("TBags")
Grid1.TextMatrix(Grid1.Rows - 1, 8) = rs.Fields("W/Bag")
Grid1.TextMatrix(Grid1.Rows - 1, 9) = rs.Fields("Total_Mn")
Grid1.TextMatrix(Grid1.Rows - 1, 10) = rs.Fields("Veh_Name")
Grid1.TextMatrix(Grid1.Rows - 1, 11) = rs.Fields("Veh_No")

Grid1.TextMatrix(Grid1.Rows - 1, 13) = rs.Fields("Bilty_No")
Grid1.TextMatrix(Grid1.Rows - 1, 14) = rs.Fields("Comp_Name")
Grid1.TextMatrix(Grid1.Rows - 1, 12) = rs.Fields("Driver_Name")
'//////////////////////////////////////
If rs1.State = adStateOpen Then rs1.Close
rs1.Open "select * from Sale_Supply_Order_Table where S_Supply_Order='" & rs.Fields("S_Supply_Order") & "'", cnn, adOpenStatic, adLockReadOnly
Grid1.TextMatrix(Grid1.Rows - 1, 4) = rs1.Fields("S_Supply_Date")
'//////////////////////////////
If rs2.State = adStateOpen Then rs2.Close
rs2.Open "select * from Customer_Table where Cust_Id=" & rs1.Fields("Cust_Id"), cnn, adOpenStatic, adLockReadOnly
Grid1.TextMatrix(Grid1.Rows - 1, 5) = rs2.Fields("Cust_Name")
'//////////////////////////
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select * from Sale_Supply_Order_Detail_Table where S_Supply_Order='" & rs.Fields("S_Supply_Order") & "'", cnn, adOpenStatic, adLockReadOnly
Grid1.TextMatrix(Grid1.Rows - 1, 6) = rs3.Fields("Product_Name")
'//////////////////////////
Grid1.Rows = Grid1.Rows + 1
rs.MoveNext
Wend
End If
End If
If Option2.Value = True Then
ad
End If
If Option4.Value = True Then
atta
End If
End Sub
Public Sub ad()
If Option2.Value = True Then
If invoice.Text = "" Then
MsgBox "Please Enter the Invoice No"
invoice.SetFocus
Exit Sub
End If
'///////////////////////////////////////
If rs.State = adStateOpen Then rs.Close
rs.Open " select * from Departure_Table where S_Supply_Order=" & Val(invoice.Text), cnn, adOpenStatic, adLockReadOnly
If rs.RecordCount = 0 Then
MsgBox " This Invoice Record does not Exist "
invoice.SetFocus
Else
rs.MoveFirst
While Not rs.EOF
Grid1.TextMatrix(Grid1.Rows - 1, 0) = rs.Fields("Dep_Id")
Grid1.TextMatrix(Grid1.Rows - 1, 3) = rs.Fields("S_Supply_Order")
Grid1.TextMatrix(Grid1.Rows - 1, 1) = rs.Fields("Dep_Date")
Grid1.TextMatrix(Grid1.Rows - 1, 2) = rs.Fields("Dep_Time")
Grid1.TextMatrix(Grid1.Rows - 1, 7) = rs.Fields("TBags")
Grid1.TextMatrix(Grid1.Rows - 1, 8) = rs.Fields("W/Bag")
Grid1.TextMatrix(Grid1.Rows - 1, 9) = rs.Fields("Total_Mn")
Grid1.TextMatrix(Grid1.Rows - 1, 10) = rs.Fields("Veh_Name")
Grid1.TextMatrix(Grid1.Rows - 1, 11) = rs.Fields("Veh_No")

Grid1.TextMatrix(Grid1.Rows - 1, 13) = rs.Fields("Bilty_No")
Grid1.TextMatrix(Grid1.Rows - 1, 14) = rs.Fields("Comp_Name")
Grid1.TextMatrix(Grid1.Rows - 1, 12) = rs.Fields("Driver_Name")
'//////////////////////////////////////
If rs1.State = adStateOpen Then rs1.Close
rs1.Open "select * from Sale_Supply_Order_Table where S_Supply_Order='" & rs.Fields("S_Supply_Order") & "'", cnn, adOpenStatic, adLockReadOnly
Grid1.TextMatrix(Grid1.Rows - 1, 4) = rs1.Fields("S_Supply_Date")
'//////////////////////////////
If rs2.State = adStateOpen Then rs2.Close
rs2.Open "select * from Customer_Table where Cust_Id=" & rs1.Fields("Cust_Id"), cnn, adOpenStatic, adLockReadOnly
Grid1.TextMatrix(Grid1.Rows - 1, 5) = rs2.Fields("Cust_Name")
'//////////////////////////
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select * from Sale_Supply_Order_Detail_Table where S_Supply_Order='" & rs.Fields("S_Supply_Order") & "'", cnn, adOpenStatic, adLockReadOnly
Grid1.TextMatrix(Grid1.Rows - 1, 6) = rs3.Fields("Product_Name")
'//////////////////////////
Grid1.Rows = Grid1.Rows + 1
rs.MoveNext
Wend
End If
End If
End Sub

Public Sub atta()
If Option4.Value = True Then
If fdate.Value > tdate.Value Then
MsgBox "From Date must be smaller than the ToDate"
fdate.SetFocus
Exit Sub
End If
'///////////////////////////////////////
If rs.State = adStateOpen Then rs.Close
rs.Open " select * from Departure_Table where Dep_Date>='" & fdate.Value & "' and Dep_Date<='" & tdate.Value & "'", cnn, adOpenStatic, adLockReadOnly
If rs.RecordCount = 0 Then
MsgBox " Required Record does not Exist "
fdate.SetFocus
Else
rs.MoveFirst
While Not rs.EOF
Grid1.TextMatrix(Grid1.Rows - 1, 0) = rs.Fields("Dep_Id")
Grid1.TextMatrix(Grid1.Rows - 1, 3) = rs.Fields("S_Supply_Order")
Grid1.TextMatrix(Grid1.Rows - 1, 1) = rs.Fields("Dep_Date")
Grid1.TextMatrix(Grid1.Rows - 1, 2) = rs.Fields("Dep_Time")
Grid1.TextMatrix(Grid1.Rows - 1, 7) = rs.Fields("TBags")
Grid1.TextMatrix(Grid1.Rows - 1, 8) = rs.Fields("W/Bag")
Grid1.TextMatrix(Grid1.Rows - 1, 9) = rs.Fields("Total_Mn")
Grid1.TextMatrix(Grid1.Rows - 1, 10) = rs.Fields("Veh_Name")
Grid1.TextMatrix(Grid1.Rows - 1, 11) = rs.Fields("Veh_No")

Grid1.TextMatrix(Grid1.Rows - 1, 13) = rs.Fields("Bilty_No")
Grid1.TextMatrix(Grid1.Rows - 1, 14) = rs.Fields("Comp_Name")
Grid1.TextMatrix(Grid1.Rows - 1, 12) = rs.Fields("Driver_Name")
'/////////////////////////////
If rs1.State = adStateOpen Then rs1.Close
rs1.Open "select * from Sale_Supply_Order_Table where S_Supply_Order='" & rs.Fields("S_Supply_Order") & "'", cnn, adOpenStatic, adLockReadOnly
Grid1.TextMatrix(Grid1.Rows - 1, 4) = rs1.Fields("S_Supply_Date")
'/////////////////////////////
If rs2.State = adStateOpen Then rs2.Close
rs2.Open "select * from Customer_Table where Cust_Id=" & rs1.Fields("Cust_Id"), cnn, adOpenStatic, adLockReadOnly
Grid1.TextMatrix(Grid1.Rows - 1, 5) = rs2.Fields("Cust_Name")
'/////////////////////////////
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select * from Sale_Supply_Order_Detail_Table where S_Supply_Order='" & rs.Fields("S_Supply_Order") & "'", cnn, adOpenStatic, adLockReadOnly
Grid1.TextMatrix(Grid1.Rows - 1, 6) = rs3.Fields("Product_Name")
'/////////////////////////////
Grid1.Rows = Grid1.Rows + 1
rs.MoveNext
Wend
End If
End If
End Sub

Private Sub select_Click()
If callingform.Name = "MDIForm1" Then
Exit Sub
End If
'/////////////////////////////
If callingform.Name = "Form5" Then
If Grid1.TextMatrix(Grid1.RowSel, 0) = "" Then
MsgBox "No Record Exists"
Exit Sub
Else

callingform.depno.Text = Grid1.TextMatrix(Grid1.RowSel, 0)
callingform.invoiceno.Text = Grid1.TextMatrix(Grid1.RowSel, 3)
callingform.depdate.Text = Grid1.TextMatrix(Grid1.RowSel, 1)
callingform.deptime.Text = Grid1.TextMatrix(Grid1.RowSel, 2)

callingform.tbags.Text = Grid1.TextMatrix(Grid1.RowSel, 7)
callingform.bagw.Text = Grid1.TextMatrix(Grid1.RowSel, 8)
callingform.tmn.Text = Grid1.TextMatrix(Grid1.RowSel, 9)
callingform.qty.Text = Grid1.TextMatrix(Grid1.RowSel, 9)

callingform.vehname.Text = Grid1.TextMatrix(Grid1.RowSel, 10)
callingform.vehno.Text = Grid1.TextMatrix(Grid1.RowSel, 11)

callingform.bilty.Text = Grid1.TextMatrix(Grid1.RowSel, 13)
callingform.company.Text = Grid1.TextMatrix(Grid1.RowSel, 14)
callingform.drname.Text = Grid1.TextMatrix(Grid1.RowSel, 12)
callingform.invoicedate.Text = Grid1.TextMatrix(Grid1.RowSel, 4)
callingform.custname.Text = Grid1.TextMatrix(Grid1.RowSel, 5)
callingform.prodname.Text = Trim(Grid1.TextMatrix(Grid1.RowSel, 6))
callingform.kgs.Text = Val(Grid1.TextMatrix(Grid1.RowSel, 7)) * Val(Grid1.TextMatrix(Grid1.RowSel, 8))

If rs.State = adStateOpen Then rs.Close
rs.Open "select Cust_Id from Customer_Table where Cust_Name='" & Trim(Grid1.TextMatrix(Grid1.RowSel, 5)) & "'", cnn, adOpenStatic, adLockReadOnly
callingform.custcode.Text = rs.Fields("Cust_Id")
'**************
If callingform.prodname.Text = Trim("Del Cotton") Then
callingform.prodid.Text = 3
End If
If callingform.prodname.Text = Trim("Oil Cake") Then
callingform.prodid.Text = 4
End If
If callingform.prodname.Text = Trim("Refine Oil") Then
callingform.prodid.Text = 6
End If
If callingform.prodname.Text = Trim("Dirt Oil") Then
callingform.prodid.Text = 7
End If
'**************
'////////////////////
If Grid1.TextMatrix(Grid1.RowSel, 6) = Trim("Oil Cake") Or Grid1.TextMatrix(Grid1.RowSel, 6) = Trim("Del Cotton") Then
Form5.Label3.Visible = True
Form5.Label10.Visible = True
Form5.Label17.Visible = False
Form5.Label18.Visible = False

Else
Form5.Label3.Visible = False
Form5.Label10.Visible = False
Form5.Label17.Visible = True
Form5.Label18.Visible = True
End If
'/////////////////
Unload Me
Exit Sub
End If
End If
'////////////////////////

End Sub

⌨️ 快捷键说明

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