SOURCE CODE
CODING
Dim Flag As Boolean
Private Sub cmdClear_Click() ClearAll
End Sub
Private Sub cmdExit_Click() Unload Me
End Sub
Private Sub cmdPrint_Click() Dim Rs As New ADODB.Recordset
If Rs.State = adStateOpen Then Rs.Close
End If
Rs.Open "select bank,address,state,city,phone,mobile from bankprofile order by bank", Con, adOpenKeyset
If Rs.RecordCount > 0 Then Set dsrClient.DataSource = Rs dsrClient.Show
dsrClient.Refresh End If
End Sub
Private Sub cmdSubmit_Click() Dim Rs As New ADODB.Recordset
If Trim(txtBN) <> "" And Flag = False Then For i = 0 To lstBN.ListCount - 1
If Trim(UCase(txtBN)) = Trim(UCase(lstBN.List(i))) Then MsgBox "Bank Already Exist", vbOKOnly + vbInformation txtBN.SetFocus
Exit Sub End If Next
Con.Execute "insert into Bankprofile (Bank,address,city,state,phone,mobile) values ('"
& Trim(txtBN) & "','" & Trim(txtAddress) & "','" & Trim(txtCP) & "','" & Trim(txtSD)
& "','" & Trim(txtPhone) & "','" & Trim(txtMobile) & "')"
If Rs.State = adStateOpen Then Rs.Close
End If
Rs.Open "select max(id) as max_id from Bankprofile", Con, adOpenKeyset If Rs.RecordCount > 0 Then
lstBN.AddItem Trim(txtBN)
lstBN.ItemData(lstBN.ListCount - 1) = Rs!max_id
ClearAll End If
ElseIf Trim(txtBN) <> "" And Flag = True Then
Con.Execute "update Bankprofile set Bank='" & Trim(txtBN) & "',address='" &
Trim(txtAddress) & "',state='" & Trim(txtSD) & "',city='" & Trim(txtCP) & "',phone='"
& Trim(txtPhone) & "',mobile='" & Trim(txtMobile) & "' where id=" & Val(txtBN.Tag) ClearAll
End If End Sub
Private Sub Form_Load()
Dim Rs As New ADODB.Recordset
If Rs.State = adStateOpen Then Rs.Close
End If
Rs.Open "select id,Bank from Bankprofile order by Bank", Con, adOpenKeyset If Rs.RecordCount > 0 Then
For i = 0 To Rs.RecordCount - 1 lstBN.AddItem Rs!Bank & ""
lstBN.ItemData(i) = Rs!id Rs.MoveNext
Next End If End Sub
Private Sub lstbn_DblClick()
Dim Rs As New ADODB.Recordset If Rs.State = adStateOpen Then Rs.Close
End If
If lstBN.ListIndex > -1 Then
Rs.Open "select * from Bankprofile where id=" & lstBN.ItemData(lstBN.ListIndex), Con, adOpenKeyset
If Rs.RecordCount > 0 Then txtBN = Rs!Bank & ""
txtBN.Tag = Rs!id & ""
txtAddress = Rs!address & ""
txtSD = Rs!State & ""
txtCP = Rs!city & ""
txtPhone = Rs!phone & ""
txtMobile = Rs!mobile & ""
Flag = True End If
End If End Sub
Private Sub lstbn_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
txtBN.SetFocus End If
End Sub
Private Sub txtAddress_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
txtSD.SetFocus
ElseIf KeyAscii = 27 Then txtBN.SetFocus
End If End Sub
Private Sub txtbn_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
txtAddress.SetFocus ElseIf KeyAscii = 27 Then lstBN.SetFocus
If lstBN.ListCount > 0 Then lstBN.ListIndex = 0 End If
End If End Sub
Private Sub txtCP_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
txtPhone.SetFocus
ElseIf KeyAscii = 27 Then txtSD.SetFocus
End If End Sub
Private Sub txtMobile_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
cmdSubmit.SetFocus ElseIf KeyAscii = 27 Then txtPhone.SetFocus End If
End Sub
Private Sub txtPhone_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
txtMobile.SetFocus ElseIf KeyAscii = 27 Then txtCP.SetFocus
End If End Sub
Private Sub txtSD_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
txtCP.SetFocus
ElseIf KeyAscii = 27 Then txtAddress.SetFocus End If
End Sub Sub ClearAll() txtBN = ""
txtBN.Tag = ""
txtAddress = ""
txtSD = ""
txtCP = ""
txtPhone = ""
txtMobile = ""
txtBN.SetFocus End Sub
Private Sub cmbBank_Click() Dim Rs As New ADODB.Recordset If Rs.State = adStateOpen Then Rs.Close
End If
If cmbBank.ListCount > 0 Then
Rs.Open "select * from bankprofile where id=" &
cmbBank.ItemData(cmbBank.ListIndex), Con, adOpenKeyset If Rs.RecordCount > 0 Then
txtBPhone = Rs!phone & ""
txtBMobile = Rs!mobile & ""
txtBAddress = Rs!address & ""
txtBState = Rs!State & ""
txtBCity = Rs!city & ""
grdDetails.Rows = 1 End If
End If End Sub
Private Sub cmbBank_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
dtpFrom.SetFocus End If
End Sub
Private Sub cmdClear_Click() ClearAll
End Sub
Private Sub cmdExit_Click()
Unload Me End Sub
Private Sub dtpPFM_KeyDown(KeyCode As Integer, Shift As Integer) Dim Rs As New ADODB.Recordset
If KeyCode = 13 Then
If Rs.State = adStateOpen Then Rs.Close
End If
Rs.Open "select * from pfm where datepfm=#" & dtpPFM.Value & "# and bid=" &
Val(cmbBank.ItemData(cmbBank.ListIndex)), Con, adOpenKeyset If Rs.RecordCount > 0 Then
grdDetails.Rows = 1
For i = 0 To Rs.RecordCount - 1
grdDetails.Rows = grdDetails.Rows + 1
grdDetails.TextMatrix(grdDetails.Rows - 1, 0) = grdDetails.Rows - 1
grdDetails.TextMatrix(grdDetails.Rows - 1, 1) = Format(Rs!currentdate, "dd mmm yyyy")
grdDetails.TextMatrix(grdDetails.Rows - 1, 2) = Trim(Rs!sno) grdDetails.TextMatrix(grdDetails.Rows - 1, 3) = Trim(Rs!Weight) grdDetails.TextMatrix(grdDetails.Rows - 1, 4) = Trim(Rs!tostation) grdDetails.TextMatrix(grdDetails.Rows - 1, 5) = Trim(Rs!amount) grdDetails.RowData(i + 1) = Rs!id
Rs.MoveNext Next
Label10 = Rs.RecordCount & " Records Found"
Else
grdDetails.Rows = 1
Label10 = "No Data Found"
End If
ElseIf KeyCode = 27 Then
cmbBank.SetFocus End If
End Sub
Private Sub cmdSearch_Click() Dim Rs As New ADODB.Recordset
If Rs.State = adStateOpen Then Rs.Close
End If
Rs.Open "select * from pfm where datepfm between #" & dtpFrom.Value & "# and #" &
dtpTo.Value & "# and bid=" & Val(cmbBank.ItemData(cmbBank.ListIndex)), Con, adOpenKeyset
If Rs.RecordCount > 0 Then grdDetails.Rows = 1
For i = 0 To Rs.RecordCount - 1
grdDetails.Rows = grdDetails.Rows + 1
grdDetails.TextMatrix(grdDetails.Rows - 1, 0) = grdDetails.Rows - 1
grdDetails.TextMatrix(grdDetails.Rows - 1, 1) = Format(Rs!currentdate, "dd mmm yyyy")
grdDetails.TextMatrix(grdDetails.Rows - 1, 2) = Trim(Rs!sno) grdDetails.TextMatrix(grdDetails.Rows - 1, 3) = Trim(Rs!Weight) grdDetails.TextMatrix(grdDetails.Rows - 1, 4) = Trim(Rs!tostation) grdDetails.TextMatrix(grdDetails.Rows - 1, 5) = Trim(Rs!amount) grdDetails.RowData(i + 1) = Rs!id
Rs.MoveNext Next
Label10 = Rs.RecordCount & " Records Found"
Else
grdDetails.Rows = 1
Label10 = "No Data Found"
End If End Sub
Private Sub Command1_Click() Dim Rs As New ADODB.Recordset If grdDetails.Rows > 1 Then
If Rs.State = adStateOpen Then Rs.Close
End If
Rs.Open "select * from pfm where datepfm between #" & dtpFrom.Value & "# and #"
& dtpTo.Value & "# and bid=" & Val(cmbBank.ItemData(cmbBank.ListIndex)), Con, adOpenKeyset
If Rs.RecordCount > 0 Then
dsrBill.Sections("section4").Controls("label10").Caption = cmbBank.Text
dsrBill.Sections("section4").Controls("label11").Caption = Format(dtpFrom.Value,
"dd MMM yyyy") & " To " & Format(dtpTo.Value, "dd MMM yyyy") Set dsrBill.DataSource = Rs
dsrBill.Show dsrBill.Refresh End If
End If End Sub
Private Sub dtpFrom_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then
dtpTo.SetFocus
ElseIf KeyCode = 27 Then cmbBank.SetFocus End If
End Sub
Private Sub dtpTo_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then
cmdSearch.SetFocus ElseIf KeyCode = 27 Then dtpFrom.SetFocus End If
End Sub
Private Sub Form_Load()
Dim Rs As New ADODB.Recordset
grdDetails.ColWidth(0) = 550 grdDetails.TextMatrix(0, 0) = "S.no"
grdDetails.ColWidth(1) = 1350 grdDetails.TextMatrix(0, 1) = "Date"
grdDetails.ColWidth(2) = 850
grdDetails.TextMatrix(0, 2) = "C.No."
grdDetails.ColWidth(3) = 865
grdDetails.TextMatrix(0, 3) = "Weight"
grdDetails.ColWidth(4) = 2035
grdDetails.TextMatrix(0, 4) = "To Station"
grdDetails.ColWidth(5) = 1075
grdDetails.TextMatrix(0, 5) = "Amount"
grdDetails.Rows = 1
If Rs.State = adStateOpen Then Rs.Close
End If
Rs.Open "select id,bank from bankprofile order by bank", Con, adOpenKeyset If Rs.RecordCount > 0 Then
For i = 0 To Rs.RecordCount - 1 cmbBank.AddItem Rs!Bank & ""
cmbBank.ItemData(i) = Rs!id Rs.MoveNext
Next
cmbBank.ListIndex = 0 End If
End Sub
Sub ClearAll() grdDetails.Rows = 1 cmbCompany.SetFocus End Sub
Dim Flag As Boolean
Private Sub cmdClear_Click() ClearAll
End Sub
Private Sub cmdExit_Click() Unload Me
End Sub
Private Sub cmdPrint_Click() Dim Rs As New ADODB.Recordset
If Rs.State = adStateOpen Then Rs.Close
End If
Rs.Open "select company,address,state,city,phone,mobile from companyprofile order by company", Con, adOpenKeyset
If Rs.RecordCount > 0 Then
Set dsrCompany.DataSource = Rs dsrCompany.Show
dsrCompany.Refresh End If
End Sub
Private Sub cmdSubmit_Click() Dim Rs As New ADODB.Recordset
If Trim(txtCN) <> "" And Flag = False Then For i = 0 To lstCN.ListCount - 1
If Trim(UCase(txtCN)) = Trim(UCase(lstCN.List(i))) Then
MsgBox "Company Already Exist", vbOKOnly + vbInformation txtCN.SetFocus
Exit Sub End If Next
Con.Execute "insert into companyprofile (company,address,city,state,phone,mobile) values ('" & Trim(txtCN) & "','" & Trim(txtAddress) & "','" & Trim(txtCP) & "','" &
Trim(txtSD) & "','" & Trim(txtPhone) & "','" & Trim(txtMobile) & "')"
If Rs.State = adStateOpen Then Rs.Close
End If
Rs.Open "select max(id) as max_id from companyProfile", Con, adOpenKeyset If Rs.RecordCount > 0 Then
lstCN.ItemData(lstCN.ListCount) = Rs!max_id lstCN.AddItem Trim(txtCN)
ClearAll End If
ElseIf Trim(txtCN) <> "" And Flag = True Then
Con.Execute "update companyprofile set company='" & Trim(txtCN) & "',address='"
& Trim(txtAddress) & "',state='" & Trim(txtSD) & "',city='" & Trim(txtCN) &
"',phone='" & Trim(txtPhone) & "',mobile='" & Trim(txtMobile) & "' where id=" &
Val(txtCN.Tag) ClearAll End If End Sub
Private Sub Form_Load()
Dim Rs As New ADODB.Recordset If Rs.State = adStateOpen Then Rs.Close
End If
Rs.Open "select id,company from companyProfile order by company", Con, adOpenKeyset
If Rs.RecordCount > 0 Then For i = 0 To Rs.RecordCount - 1 lstCN.AddItem Rs!company & ""
lstCN.ItemData(i) = Rs!id Rs.MoveNext
Next End If End Sub
Private Sub lstCN_DblClick() Dim Rs As New ADODB.Recordset If Rs.State = adStateOpen Then Rs.Close
End If
If lstCN.ListIndex > -1 Then
Rs.Open "select * from companyProfile where id=" &
lstCN.ItemData(lstCN.ListIndex), Con, adOpenKeyset If Rs.RecordCount > 0 Then
txtCN = Rs!company & ""
txtCN.Tag = Rs!id & ""
txtAddress = Rs!address & ""
txtSD = Rs!State & ""
txtCP = Rs!city & ""
txtPhone = Rs!phone & ""
txtMobile = Rs!mobile & ""
Flag = True End If
End If
End Sub
Private Sub lstCN_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
txtCN.SetFocus End If
End Sub
Private Sub txtAddress_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
txtSD.SetFocus
ElseIf KeyAscii = 27 Then txtCN.SetFocus
End If End Sub
Private Sub txtCN_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
txtAddress.SetFocus ElseIf KeyAscii = 27 Then lstCN.SetFocus
If lstCN.ListCount > 0 Then lstCN.ListIndex = 0 End If
End If End Sub
Private Sub txtCP_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
txtPhone.SetFocus ElseIf KeyAscii = 27 Then
txtSD.SetFocus End If
End Sub
Private Sub txtMobile_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
cmdSubmit.SetFocus ElseIf KeyAscii = 27 Then txtPhone.SetFocus End If
End Sub
Private Sub txtPhone_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
txtMobile.SetFocus ElseIf KeyAscii = 27 Then txtCP.SetFocus
End If End Sub
Private Sub txtSD_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
txtCP.SetFocus
ElseIf KeyAscii = 27 Then txtAddress.SetFocus End If
End Sub
Sub ClearAll() txtCN = ""
txtCN.Tag = ""
txtAddress = ""
txtSD = ""
txtCP = ""
txtPhone = ""
txtMobile = ""
txtCN.SetFocus End Sub
Private Sub cmbBoy_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
txtCNo.SetFocus
ElseIf KeyAscii = 27 Then dtpDelivery.SetFocus End If
End Sub
Private Sub cmbBoy_LostFocus() Dim Rs As New ADODB.Recordset If Rs.State = adStateOpen Then Rs.Close
End If
'Rs.Open "select distinct cno from Delivery where D_Date=#" & dtpDelivery.Value & "#
and cid=" & cmbCompany.ItemData(cmbCompany.ListIndex) & " and boyid=" &
cmbBoy.ItemData(cmbBoy.ListIndex), Con, adOpenKeyset
Rs.Open "select distinct cno from Delivery where D_Date=#" & dtpDelivery.Value & "#
and boyid=" & cmbBoy.ItemData(cmbBoy.ListIndex), Con, adOpenKeyset If Rs.RecordCount > 0 Then
lstCNo.Clear
For i = 0 To Rs.RecordCount - 1 lstCNo.AddItem Rs!cno & ""
Rs.MoveNext Next
Else
lstCNo.Clear End If
End Sub
Private Sub cmbCompany_Click()
Dim Rs As New ADODB.Recordset If Rs.State = adStateOpen Then Rs.Close
End If
If cmbCompany.ListCount > 0 Then
Rs.Open "select * from companyprofile where id=" &
cmbCompany.ItemData(cmbCompany.ListIndex), Con, adOpenKeyset If Rs.RecordCount > 0 Then
txtPhone = Rs!phone & ""
txtMobile = Rs!mobile & ""
txtAddress = Rs!address & ""
txtState = Rs!State & ""
txtcity = Rs!city & ""
' lstCNo.Clear
' grdDetails.Rows = 1 End If
End If End Sub
Private Sub cmbCompany_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
dtpDelivery.SetFocus End If
End Sub
Private Sub cmbType_KeyPress(KeyAscii As Integer) Dim Rs As New ADODB.Recordset
If Trim(txtDocument) = "" Then Exit Sub
End If
If KeyAscii = 13 And Val(txtSNo) = 0 Then If Trim(txtCNo) = "" Then
MsgBox "C.No. Must Be There", vbOKOnly + vbInformation txtCNo.SetFocus
Exit Sub End If
grdDetails.Rows = grdDetails.Rows + 1
grdDetails.TextMatrix(grdDetails.Rows - 1, 0) = grdDetails.Rows - 1 grdDetails.TextMatrix(grdDetails.Rows - 1, 1) = Trim(txtDocument) grdDetails.TextMatrix(grdDetails.Rows - 1, 2) = Trim(txtFW) grdDetails.TextMatrix(grdDetails.Rows - 1, 3) = Trim(txtParty) grdDetails.TextMatrix(grdDetails.Rows - 1, 4) = Trim(txtAmount) grdDetails.TextMatrix(grdDetails.Rows - 1, 5) = Trim(cmbType.Text)
Con.Execute "insert into Delivery (cid,D_date,boyid,cno,dno,fw,party,amount,type) values (" & Val(cmbCompany.ItemData(cmbCompany.ListIndex)) & ",#" &
dtpDelivery.Value & "#," & Val(cmbBoy.ItemData(cmbBoy.ListIndex)) & ",'" &
Trim(txtCNo) & "','" & Trim(txtDocument) & "','" & Trim(txtFW) & "','" &
Trim(txtParty) & "'," & Val(txtAmount) & ",'" & Trim(cmbType.Text) & "')"
If Rs.State = adStateOpen Then Rs.Close
End If
Rs.Open "select max(id) as max_ID from delivery", Con, adOpenKeyset If Rs.RecordCount > 0 Then
grdDetails.RowData(grdDetails.Rows - 1) = Rs!max_id End If
txtSNo = ""
txtDocument = ""
txtFW = ""
txtParty = ""
txtAmount = ""
cmbType.ListIndex = 0 txtDocument.SetFocus
ElseIf KeyAscii = 13 And Val(txtSNo) > 0 Then
grdDetails.TextMatrix(Val(txtSNo), 1) = Trim(txtDocument) grdDetails.TextMatrix(Val(txtSNo), 2) = Trim(txtFW) grdDetails.TextMatrix(Val(txtSNo), 3) = Trim(txtParty) grdDetails.TextMatrix(Val(txtSNo), 4) = Trim(txtAmount) grdDetails.TextMatrix(Val(txtSNo), 5) = Trim(cmbType.Text)
Con.Execute "update Delivery set dno='" & Trim(txtDocument) & "',fw='" &
Trim(txtFW) & "',party='" & Trim(txtParty) & "',amount=" & Val(txtAmount) &
",type='" & Trim(cmbType) & "' where id=" & grdDetails.RowData(Val(txtSNo)) txtSNo = ""
txtDocument = ""
txtFW = ""
txtParty = ""
txtAmount = ""
cmbType.ListIndex = 0 txtDocument.SetFocus ElseIf KeyAscii = 27 Then txtAmount.SetFocus End If
End Sub
Private Sub cmdClear_Click() ClearAll
End Sub
Private Sub cmdExit_Click()
Unload Me End Sub
Private Sub cmdPrint_Click() Dim Rs As New ADODB.Recordset If grdDetails.Rows > 1 Then
Con.Execute "delete from dump"
For i = 1 To grdDetails.Rows - 1
Con.Execute "insert into dump values ('" & Trim(grdDetails.TextMatrix(i, 0)) & "','"
& Trim(grdDetails.TextMatrix(i, 1)) & "','" & Trim(grdDetails.TextMatrix(i, 2)) & "','" &
Trim(grdDetails.TextMatrix(i, 3)) & "')"
Next
If Rs.State = adStateOpen Then Rs.Close
End If
Rs.Open "select * from dump", Con, adOpenKeyset If Rs.RecordCount > 0 Then
Set dsrDelivery.DataSource = Rs dsrDelivery.Show
dsrDelivery.Refresh End If
End If End Sub
Private Sub dtpDelivery_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then
cmbBoy.SetFocus ElseIf KeyCode = 27 Then cmbCompany.SetFocus End If
End Sub
Private Sub dtpDelivery_LostFocus() Dim Rs As New ADODB.Recordset If Rs.State = adStateOpen Then Rs.Close
End If
'Rs.Open "select distinct cno from Delivery where D_Date=#" & dtpDelivery.Value & "#
and cid=" & cmbCompany.ItemData(cmbCompany.ListIndex), Con, adOpenKeyset Rs.Open "select distinct cno from Delivery where D_Date=#" & dtpDelivery.Value &
"#", Con, adOpenKeyset If Rs.RecordCount > 0 Then lstCNo.Clear
For i = 0 To Rs.RecordCount - 1 lstCNo.AddItem Rs!cno & ""
Rs.MoveNext Next
End If End Sub
Private Sub Form_Load()
Dim Rs As New ADODB.Recordset
grdDetails.ColWidth(0) = 525
grdDetails.TextMatrix(0, 0) = "S.No."
grdDetails.ColWidth(1) = 1075
grdDetails.TextMatrix(0, 1) = "Doc. No."
grdDetails.ColWidth(2) = 1945
grdDetails.TextMatrix(0, 2) = "From Where"
grdDetails.ColWidth(3) = 1945
grdDetails.TextMatrix(0, 3) = "Party Name"
grdDetails.ColWidth(4) = 1075
grdDetails.TextMatrix(0, 4) = "Amount"
grdDetails.ColWidth(5) = 1185 grdDetails.TextMatrix(0, 5) = "Type"
grdDetails.Rows = 1
If Rs.State = adStateOpen Then Rs.Close
End If
Rs.Open "select id,empname from staff order by empname", Con, adOpenKeyset If Rs.RecordCount > 0 Then
For i = 0 To Rs.RecordCount - 1 cmbBoy.AddItem Rs!empname & ""
cmbBoy.ItemData(i) = Rs!id Rs.MoveNext
Next
cmbBoy.ListIndex = 0 End If
If Rs.State = adStateOpen Then Rs.Close
End If
Rs.Open "select id,company from companyprofile order by company", Con, adOpenKeyset
If Rs.RecordCount > 0 Then For i = 0 To Rs.RecordCount - 1
cmbCompany.AddItem Rs!company & ""
cmbCompany.ItemData(i) = Rs!id Rs.MoveNext
Next
cmbCompany.ListIndex = 0 cmbType.ListIndex = 0 End If
dtpDelivery.Value = Date End Sub
Private Sub lstCno_DblClick() Dim Rs As New ADODB.Recordset If Rs.State = adStateOpen Then Rs.Close
End If
'Rs.Open "select * from Delivery where D_date=#" & dtpDelivery.Value & "# and cid="
& cmbCompany.ItemData(cmbCompany.ListIndex) & " and cno=" & Val(lstCNo.Text), Con, adOpenKeyset
Rs.Open "select * from Delivery where D_date=#" & dtpDelivery.Value & "# and cno="
& Val(lstCNo.Text), Con, adOpenKeyset If Rs.RecordCount > 0 Then
grdDetails.Rows = 1
For i = 0 To Rs.RecordCount - 1
grdDetails.Rows = grdDetails.Rows + 1
grdDetails.TextMatrix(grdDetails.Rows - 1, 0) = grdDetails.Rows - 1 grdDetails.TextMatrix(grdDetails.Rows - 1, 1) = Trim(Rs!dno) grdDetails.TextMatrix(grdDetails.Rows - 1, 2) = Trim(Rs!FW) grdDetails.TextMatrix(grdDetails.Rows - 1, 3) = Trim(Rs!Party) grdDetails.TextMatrix(grdDetails.Rows - 1, 4) = Trim(Rs!amount) grdDetails.TextMatrix(grdDetails.Rows - 1, 5) = Trim(Rs!Type) grdDetails.RowData(i + 1) = Rs!id
Rs.MoveNext
Next End If End Sub
Private Sub txtAmount_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
cmbType.SetFocus ElseIf KeyAscii = 27 Then txtParty.SetFocus End If
End Sub
Private Sub txtCNo_Change() Dim Rs As New ADODB.Recordset If Rs.State = adStateOpen Then Rs.Close
End If
'Rs.Open "select * from Delivery where D_date=#" & dtpDelivery.Value & "# and cid="
& cmbCompany.ItemData(cmbCompany.ListIndex) & " and boyid=" &
cmbBoy.ItemData(cmbBoy.ListIndex) & " and cno=" & Val(txtCNo), Con, adOpenKeyset
Rs.Open "select * from Delivery where D_date=#" & dtpDelivery.Value & "# and boyid=" & cmbBoy.ItemData(cmbBoy.ListIndex) & " and cno=" & Val(txtCNo), Con, adOpenKeyset
If Rs.RecordCount > 0 Then grdDetails.Rows = 1
For i = 0 To Rs.RecordCount - 1
grdDetails.Rows = grdDetails.Rows + 1
grdDetails.TextMatrix(grdDetails.Rows - 1, 0) = grdDetails.Rows - 1 grdDetails.TextMatrix(grdDetails.Rows - 1, 1) = Trim(Rs!dno) grdDetails.TextMatrix(grdDetails.Rows - 1, 2) = Trim(Rs!FW)
grdDetails.TextMatrix(grdDetails.Rows - 1, 3) = Trim(Rs!Party) grdDetails.TextMatrix(grdDetails.Rows - 1, 4) = Trim(Rs!amount) grdDetails.TextMatrix(grdDetails.Rows - 1, 5) = Trim(Rs!Type) grdDetails.RowData(i + 1) = Rs!id
Rs.MoveNext Next
Else
grdDetails.Rows = 1 End If
End Sub
Private Sub txtcno_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
txtSNo.SetFocus
ElseIf KeyAscii = 27 Then cmbBoy.SetFocus End If
End Sub
Private Sub txtDocument_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
txtFW.SetFocus
ElseIf KeyAscii = 27 Then txtSNo.SetFocus
End If End Sub
Private Sub txtParty_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
txtAmount.SetFocus ElseIf KeyAscii = 27 Then
txtFW.SetFocus End If
End Sub
Private Sub txtSno_Change() If grdDetails.Rows > 1 Then For i = 1 To grdDetails.Rows - 1
If Val(grdDetails.TextMatrix(i, 0)) = Val(txtSNo) Then txtDocument = grdDetails.TextMatrix(i, 1)
txtFW = grdDetails.TextMatrix(i, 2) txtParty = grdDetails.TextMatrix(i, 3) txtAmount = grdDetails.TextMatrix(i, 4) If grdDetails.TextMatrix(i, 5) = "Parsal" Then cmbType.ListIndex = 1
Else
cmbType.ListIndex = 0 End If
Exit Sub Else
txtDocument = ""
txtFW = ""
txtParty = ""
txtAmount = ""
cmbType.ListIndex = 0 End If
Next Else
txtSNo = ""
End If End Sub
Private Sub txtSno_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
txtDocument.SetFocus ElseIf KeyAscii = 27 Then txtCNo.SetFocus
End If End Sub
Private Sub txtFW_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
txtParty.SetFocus ElseIf KeyAscii = 27 Then txtDocument.SetFocus End If
End Sub
Sub ClearAll() txtCNo = ""
txtSNo = ""
txtDocument = ""
txtFW = ""
txtParty = ""
txtAmount = ""
cmbType.ListIndex = 0
grdDetails.Rows = 1 lstCNo.Clear
cmbCompany.SetFocus End Sub
Dim Flag As Boolean
Private Sub cmbCompany_Click() Dim Rs As New ADODB.Recordset If Rs.State = adStateOpen Then Rs.Close
End If
If cmbCompany.ListCount > 0 Then
Rs.Open "select * from companyprofile where id=" &
cmbCompany.ItemData(cmbCompany.ListIndex), Con, adOpenKeyset If Rs.RecordCount > 0 Then
txtPhone = Rs!phone & ""
txtMobile = Rs!mobile & ""
txtAddress = Rs!address & ""
txtState = Rs!State & ""
txtcity = Rs!city & ""
lstlaot.Clear
grdDetails.Rows = 1 End If
End If End Sub
Private Sub cmbCompany_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
dtpGCD.SetFocus End If
End Sub
Private Sub cmbCrDr_KeyPress(KeyAscii As Integer) Dim Rs As New ADODB.Recordset
If KeyAscii = 13 And Val(txtSNo) = 0 Then
If Trim(txtDocument) = "" Then
MsgBox "Document No. must Be There", vbOKOnly + vbInformation txtDocument.SetFocus
Exit Sub End If
If Trim(txtLaot) = "" Then
MsgBox "laot No. must Be There", vbOKOnly + vbInformation txtLaot.SetFocus
Exit Sub End If
grdDetails.Rows = grdDetails.Rows + 1
grdDetails.TextMatrix(grdDetails.Rows - 1, 0) = grdDetails.Rows - 1 grdDetails.TextMatrix(grdDetails.Rows - 1, 1) = Trim(txtDocument) grdDetails.TextMatrix(grdDetails.Rows - 1, 2) = Trim(cmbType.Text) grdDetails.TextMatrix(grdDetails.Rows - 1, 3) = Trim(txtWeight) grdDetails.TextMatrix(grdDetails.Rows - 1, 4) = Trim(cmbUrgent.Text) grdDetails.TextMatrix(grdDetails.Rows - 1, 5) = Trim(txtCharges) grdDetails.TextMatrix(grdDetails.Rows - 1, 6) = Trim(cmbCrDr.Text) If Trim(txtCharges) = "" Then
txtCharges = 0 End If
Con.Execute "insert into incominglaot
(cid,gcd,laotno,dno,type,weight,urgent,charges,drcr) values (" &
Val(cmbCompany.ItemData(cmbCompany.ListIndex)) & ",#" & dtpGCD.Value & "#,'"
& Trim(txtLaot) & "','" & Trim(txtDocument) & "','" & Trim(cmbType.Text) & "'," &
Val(txtWeight) & ",'" & Trim(cmbUrgent.Text) & "'," & Trim(txtCharges) & ",'" &
Rs.Open "select max(id) as max_ID from incominglaot", Con, adOpenKeyset If Rs.RecordCount > 0 Then
grdDetails.RowData(grdDetails.Rows - 1) = Rs!max_id End If txtDocument.SetFocus
ElseIf KeyAscii = 13 And Val(txtSNo) > 0 Then
grdDetails.TextMatrix(Val(txtSNo), 1) = Trim(txtDocument) grdDetails.TextMatrix(Val(txtSNo), 2) = Trim(cmbType.Text) grdDetails.TextMatrix(Val(txtSNo), 3) = Trim(txtWeight) grdDetails.TextMatrix(Val(txtSNo), 4) = Trim(cmbUrgent.Text) grdDetails.TextMatrix(Val(txtSNo), 5) = Trim(txtCharges) grdDetails.TextMatrix(Val(txtSNo), 6) = Trim(cmbCrDr.Text)
Con.Execute "update incominglaot set dno='" & Trim(txtDocument) & "',type='" &
Trim(cmbType.Text) & "',weight=" & Val(txtWeight) & ",urgent='" &
Trim(cmbUrgent.Text) & "',charges=" & Val(txtCharges) & ",drcr='" &
Trim(cmbCrDr.Text) & "' where id=" & grdDetails.RowData(Val(txtSNo))
txtSNo = ""
txtDocument = ""
cmbType.ListIndex = 0 txtWeight = ""
cmbUrgent.ListIndex = 0 txtCharges = ""
cmbCrDr.ListIndex = 0 txtDocument.SetFocus ElseIf KeyAscii = 27 Then txtCharges.SetFocus End If
End Sub
Private Sub cmbType_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
txtWeight.SetFocus ElseIf KeyAscii = 27 Then txtDocument.SetFocus End If
End Sub
Private Sub cmbUrgent_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
txtCharges.SetFocus ElseIf KeyAscii = 27 Then txtWeight.SetFocus End If
End Sub
Private Sub cmdClear_Click()
ClearAll End Sub
Private Sub cmdExit_Click() Unload Me
End Sub
Private Sub dtpGCD_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then
txtLaot.SetFocus
ElseIf KeyCode = 27 Then cmbCompany.SetFocus End If
End Sub
Private Sub dtpGCD_LostFocus() Dim Rs As New ADODB.Recordset If Rs.State = adStateOpen Then Rs.Close
End If
Rs.Open "select distinct laotno from incominglaot where gcd=#" & dtpGCD.Value & "#
and cid=" & cmbCompany.ItemData(cmbCompany.ListIndex), Con, adOpenKeyset If Rs.RecordCount > 0 Then
lstlaot.Clear
For i = 0 To Rs.RecordCount - 1 lstlaot.AddItem Rs!laotno & ""
Rs.MoveNext Next
Label18 = "Total " & Rs.RecordCount & " Laot No. Found"
End If End Sub
Private Sub Form_Load()
Dim Rs As New ADODB.Recordset
grdDetails.ColWidth(0) = 525
grdDetails.TextMatrix(0, 0) = "S.No."
grdDetails.ColWidth(1) = 1400
grdDetails.TextMatrix(0, 1) = "Doc. No."
grdDetails.ColWidth(2) = 1215 grdDetails.TextMatrix(0, 2) = "Type"
grdDetails.ColWidth(3) = 1075
grdDetails.TextMatrix(0, 3) = "Weight"
grdDetails.ColWidth(4) = 1045
grdDetails.TextMatrix(0, 4) = "Urgent"
grdDetails.ColWidth(5) = 1075
grdDetails.TextMatrix(0, 5) = "Charges"
grdDetails.ColWidth(6) = 1035 grdDetails.TextMatrix(0, 6) = "Dr/Cr"
grdDetails.Rows = 1
If Rs.State = adStateOpen Then Rs.Close
End If
Rs.Open "select id,company from companyprofile order by company", Con, adOpenKeyset
If Rs.RecordCount > 0 Then
If Rs.RecordCount > 0 Then