BCA PROJECT ON COURIER MANAGEMENT SYSTEM
January 7, 2017 | Author: nhnavneet | Category: N/A
Short Description
Download BCA PROJECT ON COURIER MANAGEMENT SYSTEM...
Description
PROJECT REPORT 2006-09
COURIER MANAGEMENT SYSTEM
Submitted in the partial fulfillment of the requirement for the award of the degree OF BACHELOR OF COMPUTER APPLICATIONS
SUBMITTED BY: Navneet kumar (9350094)
UNDER THE GUIDANCE OF INTERNAL GUIDE: MR. UMESH CHAND
INSTITUTE OF MANAGEMENT STUDIES NH-24, ADHYATMIK NAGAR, DASNA, GHAZIABAD -201001
1
DECLARATION I Nishant Jain declare that the BCA project entitled “Courier Management System” is a original piece of work done by me and has not been submitted to any other institute/college/university in any manner possible.
NAVNEET KUMAR
2
ACKNOWLEDGEMENT No task however small can be completed in a hostile & uninspiring environment. Thus I wish to thanks every person who directly or indirectly helped to create a congenital atmosphere for me to work in & successfully complete our project. I express my highly indebted heartful gratitude to Mr.Manoj Kumar, Chairperson (B.C.A.), I.M.S., Ghaziabad for giving me the opportunity to do the project in I.M.S. & for providing me with his great learning experience. I express my deep sense of gratitude,whole hearted thanks to Mr.Umesh Chand,Faculty member,I.M.S. for her invaluable all around guidance & encouragement,which has played the major role in the completion of this project. Her encouragement from time to time helped me to travel along with the project & eventually to the completion of this project. Special thanks to Mr. Yudhister Yadav for helping us satisfy our queries regarding project on time.
Nishant Jain
3
CONTENTS 1.
CATEGORY OF PROJECT
5-7
2.
AREA OF PROJECT.
8-9
3.
INTRODUCTION OF THE PROJECT
10-15
1. Introduction 2. Existing System a . How Existing System Works. b. Limitation 3. Proposed System and Advantages
4.
REQUIREMENT
16-17
1. Hardware Requirement. 2. Software Requirement.
5.
DIAGRAMS
18-21
1. Context Flow Diagram 2. Data Flow Diagram 6.
SOFTWARE DEVELOPMENT LIFE CYCLE 1. Diagram 2. Requirement analysis and specification 3. Designing 4. Coding 5. Testing 6. Implementation 7. Maintenance.
4
22-28
7.
CONCLUSION
29-30
8.
SOURCE CODE
31-228
9.
OUTPUT
229-243
BIBLIOGRAPHY
244-245
10.
5
1 CATEGORY OF PROJECT
6
CATEGORY OF PROJECT
CLIENT –SERVER
Client-server describes the relationship between two computer programs in which one program, the client program, makes a service request to another, the server program. Standard networked functions such as email exchange, web access and database access, are based on the client-server model. For example, a web browser is a client program at the user computer that may access information at any web server in the world. To check your bank account from your computer, a web browser client program in your computer forwards your request to a web server program at the bank. That program may in turn forward the request to its own database client program that sends a request to a database server at another bank computer to retrieve your account balance. The balance is returned to the bank database client, which in turn serves it back to the web browser client in your personal computer, which displays the information for you.
7
2 AREA OF PROJECT
8
AREA OF PROJECT
SERVICES
9
3
INTRODUCTION
10
1-INTRODUCTION Today’s world is very fast and competitive. To achieve the success in this competitive world, one should be aware of the computer and the information related to the concerned business because computer and the information plays an important weeks manually. Right information available at the right place makes the decision process efficient. Hence the identification of the current and future requirement becomes a basic need of any flexible information system Courier management system is software which is used manage the work regarding the services of the courier in an effective & efficient manner. Basically it stores the information regarding the customer and his material, which has to be couriered.
11
2- EXISTING SYSTEM The courier system involves a lot of the employees at the office. The data for a particular courier maintained in a proper file. A person summarizes all the data of the courier in a register, this work require a high-level of attention since it has to be taken care that no wring entry goes into the register. This repetitive work may lead to errors in the entry thus resulting in the wrong entry of courier packed data. Since the data is maintained in the registers, the modification of data cannot done easily. The previous information has to be erased and overwritten or a new page has to be allocated so that both the old and new information can be written on the same page. The summarizing of the data i.e. preparation of an up to data report is very complex, it require a lot of hard work and searching through the different register so as to condense the data for presentation.
LIMITATION
From the client site, the entire work was achieved manually and they manage all their billing and services manually. Because of the manual system there are so many problems occurred in the existing system: -
It involves managing a huge number of data each having separate data items. All the work is done at a very large volume, so we have a possibility of loosing the data. To look for a particular problem the entire system is searched, so the process becomes more time consuming.
12
a-HOW EXISTING SYSTEM WORKS: The present courier system involves a lot of the employees at the office. The data of a particular courier maintained in a proper file. A person summarizes all the data of the courier in a register, this work of making a summary of the courier in the register require a high-level of attention since it has to be taken care that no wring entry goes into the register. This repetitive work may lead to errors in the entry thus resulting in the wrong entry of courier packed data. Since the data is maintained in the registers, the modification of data cannot do easily. The previous information has to be erased and overwritten or a new page has to be allocated so that both the old and new information can be written on the same page. The summarizing of the data i.e. preparation of an up to data report is very complex, it require a lot of hard work and searching through the different register so as to condense the data for presentation.
b-LIMITATIONS OF EXISTING SYSTEM: From the client site, the entire work was achieved manually and they manage all their billing and services manually. Because of the manual system there are so many problems occurred in the existing system: It involves managing a huge amount of data each having separate data items. All the work is done at a very large volume, so we have a possibility of loosing the data. To look for a particular problem the entire system is searched, so the process becomes more time consuming.
13
In Today’s fast and competitive WORLD to achieve the success in this, one should be aware of the computer and the information related to the concerned business because computer and the information play an important work. Right information available at the right place makes the decision process efficient. Hence the identification of the current and future requirement becomes a basic need of any flexible information system. So there is a need of a courier management system that can overcome the limitations of the existing courier system.
Courier management system is software which is used manage the work regarding the services of the courier in an effective & efficient manner. Basically it stores the information regarding the customer and his material, which has to be couriered.
14
3- PROPOSED SYSTEM
After a detailed study of the existing system, it is evident that is does not fulfill the objective of the organization. To make the objective possible for the organisaton, it is required to have a computerized information system with the help of which all tasks can be processed more accurately and quickly. To achieve this, it is necessary to design and develop a new system. Proposed system is being designed in such a way that many users can have a view with the system simultaneously. it makes effective and perfect utilization of man power and resources.
ADVANTAGES
Easy in maintaining information: As new information is being added to and released from their respective courses every year, it will be highly user friendly to track and maintain the presentation of all students.
User satisfaction: The system is such that is stands up to the user expectations like easy and faster retrieval of information.
Safety: The system will be accessible by only the authorized users. As information being the most crucial for the organization, then the safety of information is importation.
Highly accurate: resources being used by the system will be compatible with the latest technologies available in the market, as proposed system uses highly technically compatible resources, there will be very very lass wear and tear.
. Less time consuming: work carried out by the staff at various stages will be less time consuming
15
4
REQUIRMENT
16
1-HARDWARE REQUIREMENT Processor
Pentium IV
Main memory
64MB RAM
Hard disk drive
40 MB
2-SOFTWARE REQUIREMENT Operating system
WINDOWS 95 /XP/ 2000/ NT
Front end
Visual basic 6.0
Back end
MS-access
17
5
DIAGRAMS
18
1-CONTEXT FLOW DIAGRAM
Response Material Information Material
Custom
Search data
Bill Courier Service Payment
Employe Information
19
Customer
CONTEXT FLOW DIAGRAM
Response Packet Information
Cust
Courier Managemen t system
Bill
20
stomer Payment
2-SYSTEM DATA FLOW DIAGRAM
Information saved Input packet and Savedrinformation Search data
Record Courier Service Display
er
21
Information Of
6 SOFTWARE DEVELOPMENT LIFE CYCLE
22
SYSTEM DEVELOPMENT LIFE CYCLE The software also said to have a life cycle that is composed of several phases. Each of these phases is the development of either a part of the system or something associated with system such as a test plan & user manual. Each phase has well define starting and ending point, with clearly identifiable input to the next phase. Or we can say that output of every phase will be the input to the next phase. A software development life cycle consists of following phase: Requirement, analysis and specification. Designing Coding Testing. Implementation. Maintenance.
23
1-DIAGRAM OF SOFTWARE DEVELOPMENT LIFE CYCLE
Requirement, analysis and specification Designing Coding Testing Implementatio
n Maintenance
24
2-Requirement analysis & specification Requirement is concerned with identification the basic function of the software component in hardware / software / people system. It is related to getting the requirements and the various specifications, which are, require for developing particular software. The basic idea behind of requirement analysis is to know about what the customer wants all the details and information concerning to the software to be developed are taken from the client either by going to his place or getting the information pertaining to employees etc. this phase of system development life cycle if of almost important because it carries with a huge amount of relevant data which will be used in developing a software. If this phase is not carried out properly then there are changes that there will be shortcomings or bugs in the software, which is going to be developed by the programmers.
25
3-Designing Design consists of architectural design and detail design. Architectural design involves identifying the s/w component, developing and decomposing them in processing modules and conceptual data structure, and specifying interconnection between the component. Detail design is concerned with the details of “how to” package the processing modules and how to implement the processing algorithm, data structure and interconnection among the modules and data structures.
4-Coding
The coding phase of s/w development involves translation of design specification into source code and debugging, documentation unit testing of the source code. In this phase the programmer develops the software by using various methologies which are available for developing software. The programmer writes the code in a certain language and development team consists of various programmers who are efficient in their respective do
26
5-Testing This phase related to the testing of the software after it has been developed. In this phase the testing engineers carriers out various testing strategies and tools to check whether the software developed by the programmer is following the predefined standard and the quality of the software is upto the level to which it is require. The various techniques used for testing by a testing engineers are white box testing, black box testing, unit testing etc. there are technique are useful in getting rid of the shortcoming or feature which are there on the part of programmer. If certain features are encountered they are informed to the programmers and he has to eliminate those failures from software. This is how the software is developed which is all together free from the bugs and is ready for implementation on the client side.
27
6-Implementation This phase related to installing the software on the client side. The various procedure are involved for implementing a software which include giving documentation of the software to the client which consist of basic as well as technical part. It also includes giving proper training sessions and presentations to the client regarding the working of the software. It also includes checking of various hardware resources available with the client and making sure the software is running properly on this machine.
7-Maintenance In this phase the programmer or some other technical employers of the company, which is developing the software in order to manage the hanging requirements of the client from time to time, do review. If there is any failure in the software or the client is nit able to access the database then the same is intimated to the developer who has to take care of it within the certain amount of time.
28
7
CONCLUSION
29
CONCLUSION 1. The courier services are automated as hand written documentation is minimized to a bare minimum the software is fully implemented. 2. The data can be easily backed up onto a reliable media so that no or minimal data lass is there in case of system crash. 3.
Unauthorized access to the data is nearly eliminated by providing password authentication system.
This project has made us require a professional outlook towards problem statement and solving it to the best and maximum.
30
8
SOURCE CODE
31
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
32
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
33
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
34
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
35
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 = ""
36
txtBN.Tag = "" txtAddress = "" txtSD = "" txtCP = "" txtPhone = "" txtMobile = "" txtBN.SetFocus End Sub
37
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()
38
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
39
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"
40
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
41
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
42
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
43
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
44
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
45
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
46
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
47
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 = ""
48
txtAddress = "" txtSD = "" txtCP = "" txtPhone = "" txtMobile = "" txtCN.SetFocus End Sub
49
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()
50
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
51
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 = ""
52
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()
53
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
54
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"
55
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 & ""
56
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
57
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)
58
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
59
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
60
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
61
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
62
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) & "'," &
63
Val(txtWeight) & ",'" & Trim(cmbUrgent.Text) & "'," & Trim(txtCharges) & ",'" & Trim(cmbCrDr.Text) & "')" If Rs.State = adStateOpen Then Rs.Close End If 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 txtSNo = "" txtDocument = "" cmbType.ListIndex = 0 txtWeight = "" cmbUrgent.ListIndex = 0 txtCharges = "" cmbCrDr.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(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))
64
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()
65
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
66
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
67
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 cmbUrgent.ListIndex = 0 cmbCrDr.ListIndex = 0 End If dtpGCD.Value = Date End Sub Private Sub lstlaot_DblClick() Dim Rs As New ADODB.Recordset If Rs.State = adStateOpen Then Rs.Close End If Rs.Open "select * from incominglaot where gcd=#" & dtpGCD.Value & "# and cid=" & cmbCompany.ItemData(cmbCompany.ListIndex) & " and laotno='" & lstlaot.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) = Rs!dno & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 2) = Rs!Type & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 3) = Rs!Weight & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 4) = Rs!urgent & ""
68
grdDetails.TextMatrix(grdDetails.Rows - 1, 5) = Rs!charges & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 6) = Rs!drcr & "" grdDetails.RowData(i + 1) = Rs!id Rs.MoveNext Next Flag = True End If End Sub Private Sub txtCharges_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then cmbCrDr.SetFocus ElseIf KeyAscii = 27 Then cmbUrgent.SetFocus End If End Sub Private Sub txtDocument_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then cmbType.SetFocus ElseIf KeyAscii = 27 Then txtSNo.SetFocus End If End Sub Private Sub txtLaot_Change() Dim Rs As New ADODB.Recordset If Rs.State = adStateOpen Then Rs.Close End If
69
Rs.Open "select * from incominglaot where gcd=#" & dtpGCD.Value & "# and cid=" & cmbCompany.ItemData(cmbCompany.ListIndex) & " and laotno='" & Trim(txtLaot) & "'", 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) = Rs!dno & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 2) = Rs!Type & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 3) = Rs!Weight & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 4) = Rs!urgent & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 5) = Rs!charges & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 6) = Rs!drcr & "" grdDetails.RowData(i + 1) = Rs!id Rs.MoveNext Next Flag = True Else grdDetails.Rows = 1 End If End Sub Private Sub txtLaot_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtSNo.SetFocus ElseIf KeyAscii = 27 Then dtpGCD.SetFocus End If End Sub
70
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) If grdDetails.TextMatrix(i, 2) = "Parsal" Then cmbType.ListIndex = 1 Else cmbType.ListIndex = 0 End If txtWeight = grdDetails.TextMatrix(i, 3) If grdDetails.TextMatrix(i, 4) = "No" Then cmbUrgent.ListIndex = 0 Else cmbUrgent.ListIndex = 1 End If txtCharges = grdDetails.TextMatrix(i, 5) If grdDetails.TextMatrix(i, 6) = "Dr" Then cmbCrDr.ListIndex = 0 Else cmbCrDr.ListIndex = 1 End If Exit Sub Else txtDocument = "" cmbType.ListIndex = 0 txtWeight = "" cmbUrgent.ListIndex = 0 txtCharges = ""
71
cmbCrDr.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 txtLaot.SetFocus End If End Sub Private Sub txtWeight_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then cmbUrgent.SetFocus ElseIf KeyAscii = 27 Then cmbType.SetFocus End If End Sub Sub ClearAll() txtLaot = "" txtSNo = "" txtDocument = "" cmbType.ListIndex = 0 txtWeight = "" cmbUrgent.ListIndex = 0
72
txtCharges = "" cmbCrDr.ListIndex = 0 grdDetails.Rows = 1 lstlaot.Clear cmbCompany.SetFocus End Sub
73
Private Sub cmbBoy_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then cmdSearch.SetFocus ElseIf KeyAscii = 27 Then optSelected.SetFocus 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 & "" grdDetails.Rows = 1 Else txtPhone = "" txtMobile = "" txtAddress = "" txtState = "" txtcity = "" grdDetails.Rows = 1
74
End If End If End Sub Private Sub cmbCompany_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then optAll.SetFocus End If End Sub Private Sub cmdClear_Click() ClearAll End Sub Private Sub cmdExit_Click() Unload Me End Sub Private Sub cmdSearch_Click() Dim Rs As New ADODB.Recordset If Rs.State = adStateOpen Then Rs.Close End If grdDetails.Rows = 1 If optAll.Value = True Then If cmbCompany.Text = "All" And cmbBoy.Text = "All" Then Rs.Open "select companyprofile.company,staff.empname,delivery.* from companyprofile,Delivery,staff where sig='RTO' and staff.id=delivery.boyid and companyprofile.id=delivery.cid", Con, adOpenKeyset ElseIf cmbCompany.Text = "All" And cmbBoy.Text "All" Then
75
Rs.Open "select companyprofile.company,staff.empname,delivery.* from companyprofile,Delivery,staff where sig='RTO' and staff.id=" & cmbBoy.ItemData(cmbBoy.ListIndex) & " and delivery.boyid=" & cmbBoy.ItemData(cmbBoy.ListIndex) & " and companyprofile.id=delivery.cid", Con, adOpenKeyset ElseIf cmbCompany.Text "All" And cmbBoy.Text = "All" Then Rs.Open "select companyprofile.company,staff.empname,delivery.* from companyprofile,Delivery,staff where sig='RTO' and staff.id=delivery.boyid and companyprofile.id=" & cmbCompany.ItemData(cmbCompany.ListIndex) & " and delivery.cid=" & cmbCompany.ItemData(cmbCompany.ListIndex), Con, adOpenKeyset ElseIf cmbCompany.Text "All" And cmbBoy.Text "All" Then Rs.Open "select companyprofile.company,staff.empname,delivery.* from companyprofile,Delivery,staff where sig='RTO' and staff.id=" & cmbBoy.ItemData(cmbBoy.ListIndex) & " and delivery.boyid=" & cmbBoy.ItemData(cmbBoy.ListIndex) & " and companyprofile.id=" & cmbCompany.ItemData(cmbCompany.ListIndex) & " and delivery.cid=" & cmbCompany.ItemData(cmbCompany.ListIndex), Con, adOpenKeyset End If ElseIf optSelected.Value = True Then If cmbCompany.Text = "All" And cmbBoy.Text = "All" Then Rs.Open "select companyprofile.company,staff.empname,delivery.* from companyprofile,Delivery,staff where sig='RTO' and staff.id=delivery.boyid and companyprofile.id=delivery.cid and delivery.d_date between #" & dtpFrom.Value & "# and #" & dtpTo.Value & "#", Con, adOpenKeyset ElseIf cmbCompany.Text = "All" And cmbBoy.Text "All" Then Rs.Open "select companyprofile.company,staff.empname,delivery.* from companyprofile,Delivery,staff where sig='RTO' and staff.id=" & cmbBoy.ItemData(cmbBoy.ListIndex) & " and delivery.boyid=" &
76
cmbBoy.ItemData(cmbBoy.ListIndex) & " and companyprofile.id=delivery.cid and delivery.d_date between #" & dtpFrom.Value & "# and #" & dtpTo.Value & "#", Con, adOpenKeyset ElseIf cmbCompany.Text "All" And cmbBoy.Text = "All" Then Rs.Open "select companyprofile.company,staff.empname,delivery.* from companyprofile,Delivery,staff where sig='RTO' and staff.id=delivery.boyid and companyprofile.id=" & cmbCompany.ItemData(cmbCompany.ListIndex) & " and delivery.cid=" & cmbCompany.ItemData(cmbCompany.ListIndex) & " and delivery.d_date between #" & dtpFrom.Value & "# and #" & dtpTo.Value & "#", Con, adOpenKeyset ElseIf cmbCompany.Text "All" And cmbBoy.Text "All" Then Rs.Open "select companyprofile.company,staff.empname,delivery.* from companyprofile,Delivery,staff where sig='RTO' and staff.id=" & cmbBoy.ItemData(cmbBoy.ListIndex) & " and delivery.boyid=" & cmbBoy.ItemData(cmbBoy.ListIndex) & " and companyprofile.id=" & cmbCompany.ItemData(cmbCompany.ListIndex) & " and delivery.cid=" & cmbCompany.ItemData(cmbCompany.ListIndex) & " and delivery.d_date between #" & dtpFrom.Value & "# and #" & dtpTo.Value & "#", Con, adOpenKeyset End If End If If Rs.RecordCount > 0 Then 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) = Rs!company & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 2) = Rs!d_date & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 3) = Rs!empname & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 4) = Rs!cno & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 5) = Rs!dno & ""
77
grdDetails.TextMatrix(grdDetails.Rows - 1, 6) = Rs!FW & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 7) = Rs!Party & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 8) = Rs!amount & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 9) = Rs!Type & "" Rs.MoveNext Next End If End Sub Private Sub dtpFrom_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then dtpTo.SetFocus ElseIf KeyCode = 27 Then optSelected.SetFocus End If End Sub Private Sub dtpTo_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then cmbBoy.SetFocus ElseIf KeyCode = 27 Then dtpFrom.SetFocus End If End Sub Private Sub Form_Load() Dim Rs As New ADODB.Recordset grdDetails.ColWidth(0) = 525 grdDetails.TextMatrix(0, 0) = "S.No."
78
grdDetails.ColWidth(1) = 1400 grdDetails.TextMatrix(0, 1) = "company" grdDetails.ColWidth(2) = 1000 grdDetails.TextMatrix(0, 2) = "Date" grdDetails.ColWidth(3) = 1400 grdDetails.TextMatrix(0, 3) = "Boy Name" grdDetails.ColWidth(4) = 600 grdDetails.TextMatrix(0, 4) = "C.No." grdDetails.ColWidth(5) = 1000 grdDetails.TextMatrix(0, 5) = "Doc. No." grdDetails.ColWidth(6) = 1400 grdDetails.TextMatrix(0, 6) = "From Where" grdDetails.ColWidth(7) = 1400 grdDetails.TextMatrix(0, 7) = "Party" grdDetails.ColWidth(8) = 800 grdDetails.TextMatrix(0, 8) = "Amount" grdDetails.ColWidth(9) = 800 grdDetails.TextMatrix(0, 9) = "Type"
grdDetails.Rows = 1 grdDetails.ColWidth(6) = 1095
79
grdDetails.TextMatrix(0, 6) = "Sig" 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 cmbBoy.AddItem "All" For i = 0 To Rs.RecordCount - 1 cmbBoy.AddItem Rs!empname & "" cmbBoy.ItemData(i + 1) = 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 cmbCompany.AddItem "All" For i = 0 To Rs.RecordCount - 1 cmbCompany.AddItem Rs!company & "" cmbCompany.ItemData(i + 1) = Rs!id Rs.MoveNext Next cmbCompany.ListIndex = 0 End If dtpFrom.Value = Date
80
dtpTo.Value = Date End Sub Sub ClearAll() grdDetails.Rows = 1 cmbCompany.SetFocus End Sub Private Sub optAll_Click() dtpFrom.Enabled = False dtpTo.Enabled = False End Sub Private Sub optAll_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then optSelected.SetFocus ElseIf KeyCode = 27 Then cmbCompany.SetFocus End If End Sub Private Sub optSelected_Click() dtpFrom.Enabled = True dtpTo.Enabled = True End Sub Private Sub optSelected_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 And dtpFrom.Enabled = False Then cmbBoy.SetFocus ElseIf KeyCode = 13 And dtpFrom.Enabled = True Then dtpFrom.SetFocus
81
ElseIf KeyCode = 27 Then optAll.SetFocus End If End Sub
82
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 dtpPFM.SetFocus ElseIf KeyAscii = 27 Then cmbCompany.SetFocus End If End Sub Private Sub cmbCompany_Click() Dim Rs As New ADODB.Recordset If Rs.State = adStateOpen Then
83
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 & "" grdDetails.Rows = 1 End If End If End Sub Private Sub cmbCompany_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then cmbBank.SetFocus End If End Sub Private Sub cmbPN_KeyPress(KeyAscii As Integer) Dim Rs As New ADODB.Recordset If KeyAscii = 13 And Val(txtSno) = 0 Then If Trim(txtCNo) = "" Then Exit Sub End If grdDetails.Rows = grdDetails.Rows + 1
84
grdDetails.TextMatrix(grdDetails.Rows - 1, 0) = grdDetails.Rows - 1 grdDetails.TextMatrix(grdDetails.Rows - 1, 1) = Format(dtpDate.Value, "dd MMM yyyy") grdDetails.TextMatrix(grdDetails.Rows - 1, 2) = Trim(txtCNo) grdDetails.TextMatrix(grdDetails.Rows - 1, 3) = Trim(txtWeight) grdDetails.TextMatrix(grdDetails.Rows - 1, 4) = Trim(txtStation) grdDetails.TextMatrix(grdDetails.Rows - 1, 5) = Trim(txtAmount) grdDetails.TextMatrix(grdDetails.Rows - 1, 6) = Trim(txtToStation) grdDetails.TextMatrix(grdDetails.Rows - 1, 7) = Trim(txtPOD) grdDetails.TextMatrix(grdDetails.Rows - 1, 8) = Trim(cmbUrgent.Text) grdDetails.TextMatrix(grdDetails.Rows - 1, 9) = Trim(cmbPN.Text) Con.Execute "insert into pfm (cid,bid,datepfm,currentdate,sno,weight,station,amount,tostation,pod,urgent,PN) values (" & Val(cmbCompany.ItemData(cmbCompany.ListIndex)) & "," & Val(cmbBank.ItemData(cmbBank.ListIndex)) & ",#" & dtpPFM.Value & "#,#" & dtpDate.Value & "#,'" & Trim(txtCNo) & "'," & Val(txtWeight) & ",'" & Trim(txtStation) & "'," & Val(txtAmount) & ",'" & Trim(txtToStation) & "','" & Trim(txtPOD) & "','" & Trim(cmbUrgent.Text) & "','" & Trim(cmbPN.Text) & "')" If Rs.State = adStateOpen Then Rs.Close End If Rs.Open "select max(id) as max_ID from pfm", Con, adOpenKeyset If Rs.RecordCount > 0 Then grdDetails.RowData(grdDetails.Rows - 1) = Rs!max_id End If txtSno = "" txtCNo = "" txtWeight = "" txtStation = ""
85
txtAmount = "" txtToStation = "" txtPOD = "" cmbUrgent.ListIndex = 0 cmbPN.ListIndex = 0 dtpDate.SetFocus ElseIf KeyAscii = 13 And Val(txtSno) > 0 Then grdDetails.TextMatrix(Val(txtSno), 1) = Format(dtpDate.Value, "dd MMM yyyy") grdDetails.TextMatrix(Val(txtSno), 2) = Trim(txtCNo) grdDetails.TextMatrix(Val(txtSno), 3) = Trim(txtWeight) grdDetails.TextMatrix(Val(txtSno), 4) = Trim(txtStation) grdDetails.TextMatrix(Val(txtSno), 5) = Trim(txtAmount) grdDetails.TextMatrix(Val(txtSno), 6) = Trim(txtToStation) grdDetails.TextMatrix(Val(txtSno), 7) = Trim(txtPOD) grdDetails.TextMatrix(Val(txtSno), 8) = Trim(cmbUrgent.Text) grdDetails.TextMatrix(Val(txtSno), 9) = Trim(cmbPN.Text) Con.Execute "update pfm set currentdate=#" & dtpDate.Value & "#,sno='" & Trim(txtCNo) & "',weight=" & Val(txtWeight) & ",station='" & Trim(txtStation) & "',amount=" & Val(txtAmount) & ",tostation='" & Trim(txtToStation) & "',pod='" & Trim(txtPOD) & "',urgent='" & cmbUrgent.Text & "',pn='" & Trim(cmbPN.Text) & "' where id=" & grdDetails.RowData(Val(txtSno)) txtSno = "" txtCNo = "" txtWeight = "" txtStatiosn = "" txtAmount = "" txtToStation = "" txtPOD = "" cmbUrgent.ListIndex = 0 cmbPN.ListIndex = 1
86
dtpDate.SetFocus
ElseIf KeyAscii = 27 Then cmbUrgent.SetFocus End If End Sub Private Sub cmbUrgent_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then cmbPN.SetFocus ElseIf KeyAscii = 27 Then txtPOD.SetFocus End If End Sub Private Sub cmdClear_Click() ClearAll End Sub Private Sub cmdExit_Click() Unload Me End Sub Private Sub dtpDate_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then txtCNo.SetFocus ElseIf KeyCode = 27 Then txtSno.SetFocus End If End Sub
87
Private Sub dtpPFM_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then dtpDate.SetFocus ElseIf KeyCode = 27 Then cmbBank.SetFocus End If End Sub Private Sub dtpPFM_LostFocus() Dim Rs As New ADODB.Recordset If Rs.State = adStateOpen Then Rs.Close End If Rs.Open "select * from pfm where datepfm=#" & dtpPFM.Value & "# and cid=" & cmbCompany.ItemData(cmbCompany.ListIndex) & " 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!station) grdDetails.TextMatrix(grdDetails.Rows - 1, 5) = Trim(Rs!amount) grdDetails.TextMatrix(grdDetails.Rows - 1, 6) = Trim(Rs!tostation) grdDetails.TextMatrix(grdDetails.Rows - 1, 7) = Trim(Rs!pod) grdDetails.TextMatrix(grdDetails.Rows - 1, 8) = Trim(Rs!urgent)
88
grdDetails.TextMatrix(grdDetails.Rows - 1, 9) = Trim(Rs!pn) & "" grdDetails.RowData(i + 1) = Rs!id Rs.MoveNext Next End If End Sub Private Sub Form_Load() Dim Rs As New ADODB.Recordset grdDetails.ColWidth(0) = 475 grdDetails.TextMatrix(0, 0) = "S.no" grdDetails.ColWidth(1) = 1360 grdDetails.TextMatrix(0, 1) = "Date" grdDetails.ColWidth(2) = 715 grdDetails.TextMatrix(0, 2) = "C.No." grdDetails.ColWidth(3) = 805 grdDetails.TextMatrix(0, 3) = "Weight" grdDetails.ColWidth(4) = 1675 grdDetails.TextMatrix(0, 4) = "Station" grdDetails.ColWidth(5) = 865 grdDetails.TextMatrix(0, 5) = "Amount" grdDetails.ColWidth(6) = 1675 grdDetails.TextMatrix(0, 6) = "To Station"
89
grdDetails.ColWidth(7) = 475 grdDetails.TextMatrix(0, 7) = "POD" grdDetails.ColWidth(8) = 880 grdDetails.TextMatrix(0, 8) = "Urgent" grdDetails.ColWidth(9) = 1570 grdDetails.TextMatrix(0, 9) = "Print Name" 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 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
90
cmbCompany.AddItem Rs!company & "" cmbCompany.ItemData(i) = Rs!id Rs.MoveNext Next cmbCompany.ListIndex = 0 cmbUrgent.ListIndex = 0 cmbPN.ListIndex = 0 End If dtpDate.Value = Date dtpPFM.Value = Date End Sub Private Sub txtAmount_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtToStation.SetFocus ElseIf KeyAscii = 27 Then txtStation.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 dtpDate.Value = grdDetails.TextMatrix(i, 1) txtCNo = grdDetails.TextMatrix(i, 2) txtWeight = grdDetails.TextMatrix(i, 3) txtStation = grdDetails.TextMatrix(i, 4) txtAmount = grdDetails.TextMatrix(i, 5) txtToStation = grdDetails.TextMatrix(i, 6) txtPOD = grdDetails.TextMatrix(i, 7)
91
If grdDetails.TextMatrix(i, 8) = "No" Then cmbUrgent.ListIndex = 0 Else cmbUrgent.ListIndex = 1 End If If grdDetails.TextMatrix(i, 9) = "Origin" Then cmbPN.ListIndex = 0 Else cmbPN.ListIndex = 1 End If Exit Sub Else txtCNo = "" txtWeight = "" txtStation = "" txtAmount = "" txtToStation = "" txtPOD = "" cmbUrgent.ListIndex = 0 cmbPN.ListIndex = 0 End If Next Else txtSno = "" End If End Sub Private Sub txtSno_KeyPress(KeyAscii As Integer)
92
If KeyAscii = 13 Then dtpDate.SetFocus ElseIf KeyAscii = 27 Then dtpPFM.SetFocus End If End Sub Private Sub txtToStation_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtPOD.SetFocus ElseIf KeyAscii = 27 Then txtAmount.SetFocus End If End Sub Private Sub txtWeight_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtStation.SetFocus ElseIf KeyAscii = 27 Then txtCNo.SetFocus End If End Sub Private Sub txtPOD_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then cmbUrgent.SetFocus ElseIf KeyAscii = 27 Then txtToStation.SetFocus End If End Sub
93
'''''Private Sub txtcno_Change() '''''End Sub Private Sub txtcno_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtWeight.SetFocus ElseIf KeyAscii = 27 Then dtpDate.SetFocus End If End Sub Private Sub txtstation_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtAmount.SetFocus ElseIf KeyAscii = 27 Then txtWeight.SetFocus End If End Sub Sub ClearAll() txtSno = "" txtCNo = "" txtWeight = "" txtStation = "" txtAmount = "" txtToStation = "" txtPOD = "" cmbUrgent.ListIndex = 0 cmbPN.ListIndex = 0 grdDetails.Rows = 1 cmbCompany.SetFocus End Sub
94
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 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 cmbCompany_Click() Dim Rs As New ADODB.Recordset If Rs.State = adStateOpen Then Rs.Close End If
95
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 cmbSig_KeyPress(KeyAscii As Integer) If KeyAscii = 13 And Val(txtSNo) > 0 Then grdDetails.TextMatrix(Val(txtSNo), 6) = cmbSig.Text Con.Execute "update Delivery set sig='" & Trim(cmbSig.Text) & "' where id=" & grdDetails.RowData(Val(txtSNo)) txtSNo = "" txtDocument = "" txtFW = "" txtParty = "" txtAmount = ""
96
txtType = "" cmbSig.ListIndex = 0 txtSNo.SetFocus ElseIf KeyAscii = 27 Then txtSNo.SetFocus End If End Sub Private Sub cmdClear_Click() ClearAll End Sub Private Sub cmdExit_Click() Unload Me 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
97
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) = 1810 grdDetails.TextMatrix(0, 2) = "From Where" grdDetails.ColWidth(3) = 1810 grdDetails.TextMatrix(0, 3) = "Party Name" grdDetails.ColWidth(4) = 1075 grdDetails.TextMatrix(0, 4) = "Amount" grdDetails.ColWidth(5) = 1175 grdDetails.TextMatrix(0, 5) = "Type" grdDetails.ColWidth(6) = 1095
98
grdDetails.TextMatrix(0, 6) = "Sig" 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 cmbSig.ListIndex = 0 End If
99
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 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.TextMatrix(grdDetails.Rows - 1, 6) = Trim(Rs!SIG) 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
100
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 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.TextMatrix(grdDetails.Rows - 1, 6) = Trim(Rs!SIG) & "" grdDetails.RowData(i + 1) = Rs!id Rs.MoveNext Next Else grdDetails.Rows = 1 End If
101
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
102
txtDocument = grdDetails.TextMatrix(i, 1) txtFW = grdDetails.TextMatrix(i, 2) txtParty = grdDetails.TextMatrix(i, 3) txtAmount = grdDetails.TextMatrix(i, 4) txtType = grdDetails.TextMatrix(i, 5) If grdDetails.TextMatrix(i, 6) = "Sig" Then cmbSig.ListIndex = 0 ElseIf grdDetails.TextMatrix(i, 6) = "Stamp" Then cmbSig.ListIndex = 1 ElseIf grdDetails.TextMatrix(i, 6) = "RTO" Then cmbSig.ListIndex = 2 End If Exit Sub Else txtDocument = "" txtFW = "" txtParty = "" txtAmount = "" txtType = "" cmbSig.ListIndex = 0 End If Next Else txtSNo = "" End If End Sub Private Sub txtSno_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then cmbSig.SetFocus ElseIf KeyAscii = 27 Then
103
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 = "" txtType = "" cmbSig.ListIndex = 0 grdDetails.Rows = 1 lstCNo.Clear cmbCompany.SetFocus End Sub
104
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 & "" lstID.Clear grdDetails.Rows = 1 End If End If End Sub Private Sub cmbCompany_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then dtpDate.SetFocus End If End Sub Private Sub cmbDrCr_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then cmbUrgent.SetFocus ElseIf KeyAscii = 27 Then txtReason.SetFocus
105
End If End Sub Private Sub cmbRto_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtReason.SetFocus ElseIf KeyAscii = 27 Then txtAmount.SetFocus End If End Sub Private Sub cmbUrgent_KeyPress(KeyAscii As Integer) Dim Rs As New ADODB.Recordset If KeyAscii = 13 And Val(txtSNo) = 0 Then If Trim(txtDestination) = "" Then 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(txtWeight) grdDetails.TextMatrix(grdDetails.Rows - 1, 3) = Trim(txtDestination) grdDetails.TextMatrix(grdDetails.Rows - 1, 4) = Trim(txtAmount) grdDetails.TextMatrix(grdDetails.Rows - 1, 5) = Trim(cmbRto.Text) grdDetails.TextMatrix(grdDetails.Rows - 1, 6) = Trim(txtReason) grdDetails.TextMatrix(grdDetails.Rows - 1, 7) = Trim(cmbDrCr.Text) grdDetails.TextMatrix(grdDetails.Rows - 1, 8) = Trim(cmbUrgent.Text) Con.Execute "insert into rtd (cid,currentdate,sno,mrt,mrtto,doc,weight,destination,amount,rto,reason,drcr,urgent)
106
values (" & Val(cmbCompany.ItemData(cmbCompany.ListIndex)) & ",#" & dtpDate.Value & "#,'" & Trim(txtID) & "','" & Trim(txtMeerut) & "','" & Trim(txtTo) & "','" & Trim(txtDocument) & "'," & Val(txtWeight) & ",'" & Trim(txtDestination) & "'," & Val(txtAmount) & ",'" & Trim(cmbRto.Text) & "','" & Trim(txtReason) & "','" & Trim(cmbDrCr.Text) & "','" & Trim(cmbUrgent.Text) & "')" If Rs.State = adStateOpen Then Rs.Close End If Rs.Open "select max(id) as max_id from rtd", Con, adOpenKeyset If Rs.RecordCount > 0 Then grdDetails.RowData(grdDetails.Rows - 1) = Rs!max_id End If txtSNo = "" txtDocument = "" txtWeight = "" txtDestination = "" txtAmount = "" cmbRto.ListIndex = 0 txtReason = "" cmbDrCr.ListIndex = 0 cmbUrgent.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(txtWeight) grdDetails.TextMatrix(Val(txtSNo), 3) = Trim(txtDestination) grdDetails.TextMatrix(Val(txtSNo), 4) = Trim(txtAmount) grdDetails.TextMatrix(Val(txtSNo), 5) = Trim(cmbRto.Text) grdDetails.TextMatrix(Val(txtSNo), 6) = Trim(txtReason) grdDetails.TextMatrix(Val(txtSNo), 7) = Trim(cmbDrCr.Text)
107
grdDetails.TextMatrix(Val(txtSNo), 8) = Trim(cmbUrgent.Text) Con.Execute "update rtd set mrt='" & Trim(txtMeerut) & "',mrtto='" & Trim(txtTo) & "',doc='" & Trim(txtDocument) & "',weight=" & Val(txtWeight) & ",destination='" & Trim(txtDestination) & "',amount=" & Val(txtAmount) & ",rto='" & Trim(cmbRto.Text) & "',reason='" & Trim(txtReason) & "',drcr='" & Trim(cmbDrCr.Text) & "',urgent='" & Trim(cmbUrgent.Text) & "' where id=" & grdDetails.RowData(Val(txtSNo)) txtSNo = "" txtDocument = "" txtWeight = "" txtDestination = "" txtAmount = "" cmbRto.ListIndex = 0 txtReason = "" cmbDrCr.ListIndex = 0 cmbUrgent.ListIndex = 0 txtDocument.SetFocus ElseIf KeyAscii = 27 Then cmbDrCr.SetFocus End If End Sub Private Sub cmdClear_Click() ClearAll End Sub Private Sub cmdExit_Click() Unload Me End Sub
108
Private Sub cmdPrint_Click() Dim Rs As New ADODB.Recordset If grdDetails.Rows > 0 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, 3)) & "','" & Trim(grdDetails.TextMatrix(i, 2)) & "')" If Rs.State = adStateOpen Then Rs.Close End If Rs.Open "select sno,dno,fw,party from dump order by sno", Con, adOpenKeyset If Rs.RecordCount > 0 Then dsrOutgoing.Sections("section4").Controls("label10").Caption = txtID dsrOutgoing.Sections("section4").Controls("label11").Caption = "Dated >> " & Format(dtpDate.Value, "dd mmm yyyy") dsrOutgoing.Sections("section4").Controls("label15").Caption = txtMeerut dsrOutgoing.Sections("section4").Controls("label17").Caption = txtTo Set dsrOutgoing.DataSource = Rs dsrOutgoing.Show dsrOutgoing.Refresh End If Next End If End Sub Private Sub dtpDate_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then txtID.SetFocus ElseIf KeyCode = 27 Then
109
cmbCompany.SetFocus End If End Sub Private Sub dtpDate_LostFocus() Dim Rs As New ADODB.Recordset If Rs.State = adStateOpen Then Rs.Close End If Rs.Open "select distinct sno from rtd where currentdate=#" & dtpDate.Value & "# and cid=" & cmbCompany.ItemData(cmbCompany.ListIndex), Con, adOpenKeyset If Rs.RecordCount > 0 Then For i = 0 To Rs.RecordCount - 1 lstID.AddItem Rs!sno Rs.MoveNext Next End If End Sub Private Sub Form_Load() Dim Rs As New ADODB.Recordset grdDetails.ColWidth(0) = 535 grdDetails.TextMatrix(0, 0) = "S.No." grdDetails.ColWidth(1) = 805 grdDetails.TextMatrix(0, 1) = "Doc. No." grdDetails.ColWidth(2) = 775 grdDetails.TextMatrix(0, 2) = "Weight"
110
grdDetails.ColWidth(3) = 1750 grdDetails.TextMatrix(0, 3) = "Destination" grdDetails.ColWidth(4) = 880 grdDetails.TextMatrix(0, 4) = "Amount" grdDetails.ColWidth(5) = 895 grdDetails.TextMatrix(0, 5) = "RTO" grdDetails.ColWidth(6) = 2110 grdDetails.TextMatrix(0, 6) = "Reason" grdDetails.ColWidth(7) = 880 grdDetails.TextMatrix(0, 7) = "Dr/Cr" grdDetails.ColWidth(8) = 870 grdDetails.TextMatrix(0, 8) = "Urgent" 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 For i = 0 To Rs.RecordCount - 1 cmbCompany.AddItem Rs!company & "" cmbCompany.ItemData(i) = Rs!id Rs.MoveNext
111
Next cmbCompany.ListIndex = 0 cmbUrgent.ListIndex = 0 End If dtpDate.Value = Date End Sub Private Sub lstid_DblClick() Dim Rs As New ADODB.Recordset If Rs.State = adStateOpen Then Rs.Close End If Rs.Open "select * from rtd where currentdate=#" & dtpDate.Value & "# and cid=" & cmbCompany.ItemData(cmbCompany.ListIndex) & " and sno=" & Val(lstID.Text), Con, adOpenKeyset If Rs.RecordCount > 0 Then grdDetails.Rows = 1 txtMeerut = Rs!mrt & "" txtTo = Rs!mrtto & "" 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) = Rs!doc & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 2) = Rs!Weight & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 3) = Rs!designation & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 4) = Rs!amount & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 5) = Rs!rto & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 6) = Rs!reason & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 7) = Rs!drcr & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 8) = Rs!urgent & "" grdDetails.RowData(i + 1) = Rs!id
112
Rs.MoveNext Next End If End Sub Private Sub txtAmount_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then cmbRto.SetFocus ElseIf KeyAscii = 27 Then txtDestination.SetFocus End If End Sub Private Sub txtDocument_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtWeight.SetFocus ElseIf KeyAscii = 27 Then txtSNo.SetFocus End If End Sub Private Sub txtID_Change() Dim Rs As New ADODB.Recordset If Rs.State = adStateOpen Then Rs.Close End If Rs.Open "select * from rtd where currentdate=#" & dtpDate.Value & "# and cid=" & cmbCompany.ItemData(cmbCompany.ListIndex) & " and sno='" & Trim(txtID) & "'", Con, adOpenKeyset If Rs.RecordCount > 0 Then grdDetails.Rows = 1
113
txtMeerut = Rs!mrt & "" txtTo = Rs!mrtto & "" 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) = Rs!doc & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 2) = Rs!Weight grdDetails.TextMatrix(grdDetails.Rows - 1, 3) = Rs!destination & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 4) = Rs!amount grdDetails.TextMatrix(grdDetails.Rows - 1, 5) = Rs!rto & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 6) = Rs!reason & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 7) = Rs!drcr & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 8) = Rs!urgent & "" grdDetails.RowData(i + 1) = Rs!id Rs.MoveNext Next Else txtMeerut = "" txtTo = "" txtSNo = "" txtDocument = "" txtWeight = "" txtDestination = "" txtAmount = "" cmbRto.ListIndex = 0 txtReason = "" cmbDrCr.ListIndex = 0 cmbUrgent.ListIndex = 0 grdDetails.Rows = 1 End If End Sub
114
Private Sub txtID_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtMeerut.SetFocus ElseIf KeyAscii = 27 Then dtpDate.SetFocus End If End Sub Private Sub txtMeerut_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtTo.SetFocus ElseIf KeyAscii = 27 Then txtID.SetFocus End If End Sub Private Sub txtTo_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtWeight.SetFocus ElseIf KeyAscii = 27 Then txtMeerut.SetFocus End If End Sub Private Sub txtWeight_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtDestination.SetFocus ElseIf KeyAscii = 27 Then txtDocument.SetFocus End If
115
End Sub Private Sub txtReason_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then cmbDrCr.SetFocus ElseIf KeyAscii = 27 Then cmbRto.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) txtWeight = grdDetails.TextMatrix(i, 2) txtDestination = grdDetails.TextMatrix(i, 3) txtAmount = grdDetails.TextMatrix(i, 4) If grdDetails.TextMatrix(i, 5) = "No" Then cmbRto.ListIndex = 0 Else cmbRto.ListIndex = 1 End If txtReason = grdDetails.TextMatrix(i, 6) If grdDetails.TextMatrix(i, 7) = "Dr" Then cmbDrCr.ListIndex = 0 Else
116
cmbDrCr.ListIndex = 1 End If If grdDetails.TextMatrix(i, 8) = "Parsal" Then cmbUrgent.ListIndex = 1 Else cmbUrgent.ListIndex = 0 End If Exit Sub Else txtDocument = "" txtWeight = "" txtDestination = "" txtAmount = "" cmbRto.ListIndex = 0 txtReason = "" cmbDrCr.ListIndex = 0 cmbUrgent.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 dtpDate.SetFocus End If
117
End Sub Private Sub txtDestination_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtAmount.SetFocus ElseIf KeyAscii = 27 Then txtWeight.SetFocus End If End Sub Sub ClearAll() txtMeerut = "" txtTo = "" txtID = "" txtSNo = "" txtDocument = "" txtWeight = "" txtDestination = "" txtAmount = "" cmbRto.ListIndex = 0 txtReason = "" cmbDrCr.ListIndex = 0 cmbUrgent.ListIndex = 0 txtWeight.SetFocus grdDetails.Rows = 1 lstID.Clear cmbCompany.SetFocus End Sub
118
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 staff.empname,staff.dob,staff.address1,staff.address2,staff.city,staff.phone,staff.mobile,st aff.joining,staff.intime,staff.outtime,salary.totalsalary from staff,salary where staff.id=salary.id order by staff.empname", Con, adOpenKeyset If Rs.RecordCount > 0 Then Set dsrStaff.DataSource = Rs dsrStaff.Show dsrStaff.Refresh End If End Sub Private Sub cmdSubmit_Click() Dim Rs As New ADODB.Recordset If Trim(txtEmpName) = "" Then
119
MsgBox "Employee Name must Be There", vbOKOnly + vbInformation txtEmpName.SetFocus Exit Sub End If If Val(txtBasic) 0 Then
120
lstBoys.Clear For i = 0 To Rs.RecordCount - 1 lstBoys.AddItem Rs!empname & "" lstBoys.ItemData(i) = Rs!id Rs.MoveNext Next End If ClearAll ElseIf Flag = True Then Con.Execute "update staff set empname='" & Trim(txtEmpName) & "',dob=#" & dtpDOB.Value & "#,address1='" & Trim(txtAddress1) & "',address2='" & Trim(txtAddress2) & "',city='" & Trim(txtCity) & "',phone='" & Trim(txtPhone) & "',mobile='" & Trim(txtMobile) & "',joining=#" & dtpJoiningDate.Value & "#,intime=#" & dtpTimeIn.Value & "#,outtime=#" & dtpTimeOut.Value & "# where id=" & Val(txtEmpName.Tag) Con.Execute "update salary set basic=" & Val(txtBasic) & ",da=" & Val(txtDAllowence) & ",medical=" & Val(txtMedical) & ",cca=" & Val(txtCCA) & ",hra=" & Val(txtHRA) & ",arrear=" & Val(txtArrear) & ",pf=" & Val(txtPF) & ",totalsalary=" & Val(txtTotalSalary) & " where id=" & Val(txtEmpName.Tag) ClearAll Flag = False End If End Sub Private Sub dtpDOB_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then txtAddress1.SetFocus ElseIf KeyCode = 27 Then txtEmpName.SetFocus End If
121
End Sub Private Sub dtpJoiningDate_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then dtpTimeIn.SetFocus ElseIf KeyCode = 27 Then txtMobile.SetFocus End If End Sub Private Sub dtpTimeIn_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then dtpTimeOut.SetFocus ElseIf KeyCode = 27 Then dtpJoiningDate.SetFocus End If End Sub Private Sub dtpTimeOut_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then txtBasic.SetFocus ElseIf KeyCode = 27 Then dtpTimeIn.SetFocus End If End Sub Private Sub Form_Load() Dim Rs As New ADODB.Recordset If Rs.State = adStateOpen Then Rs.Close End If
122
Rs.Open "select id,empname from staff order by empname", Con, adOpenKeyset If Rs.RecordCount > 0 Then For i = 0 To Rs.RecordCount - 1 lstBoys.AddItem Rs!empname & "" lstBoys.ItemData(i) = Rs!id Rs.MoveNext Next End If End Sub Private Sub lstBoys_DblClick() Dim Rs As New ADODB.Recordset If lstBoys.ListIndex > -1 Then If Rs.State = adStateOpen Then Rs.Close End If Rs.Open "select staff.*,salary.* from staff,salary where staff.id=" & Val(lstBoys.ItemData(lstBoys.ListIndex)) & " and salary.id=" & Val(lstBoys.ItemData(lstBoys.ListIndex)), Con, adOpenKeyset If Rs.RecordCount > 0 Then txtEmpName = Rs!empname & "" txtEmpName.Tag = lstBoys.ItemData(lstBoys.ListIndex) dtpDOB.Value = Rs!dob & "" txtAddress1 = Rs!address1 & "" txtAddress2 = Rs!address2 & "" txtCity = Rs!city & "" txtPhone = Rs!phone & "" txtMobile = Rs!mobile & "" dtpJoiningDate.Value = Rs!joining & "" dtpTimeIn.Value = Rs!intime & ""
123
dtpTimeOut.Value = Rs!outtime & "" txtBasic = Rs!basic & "" txtDAllowence = Rs!da & "" txtMedical = Rs!medical & "" txtCCA = Rs!cca & "" txtHRA = Rs!hra & "" txtArrear = Rs!arrear & "" txtPF = Rs!pf & "" txtTotalSalary = Rs!totalsalary & "" Flag = True End If End If
End Sub Private Sub txtAddress1_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtAddress2.SetFocus ElseIf KeyAscii = 27 Then dtpDOB.SetFocus End If End Sub Private Sub txtAddress2_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtCity.SetFocus ElseIf KeyAscii = 27 Then txtAddress1.SetFocus End If
124
End Sub Private Sub txtArrear_Change() txtTotalSalary = Val(txtBasic) + Val(txtDAllowence) + Val(txtMedical) + Val(txtCCA) + Val(txtHRA) + Val(txtArrear) + Val(txtPF) End Sub Private Sub txtArrear_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtPF.SetFocus ElseIf KeyAscii = 27 Then txtHRA.SetFocus End If End Sub Private Sub txtBasic_Change() txtTotalSalary = Val(txtBasic) + Val(txtDAllowence) + Val(txtMedical) + Val(txtCCA) + Val(txtHRA) + Val(txtArrear) + Val(txtPF) End Sub Private Sub txtBasic_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtDAllowence.SetFocus ElseIf KeyAscii = 27 Then dtpTimeOut.SetFocus End If End Sub Private Sub txtCCA_Change() txtTotalSalary = Val(txtBasic) + Val(txtDAllowence) + Val(txtMedical) + Val(txtCCA) + Val(txtHRA) + Val(txtArrear) + Val(txtPF)
125
End Sub Private Sub txtCCA_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtHRA.SetFocus ElseIf KeyAscii = 27 Then txtMedical.SetFocus End If End Sub Private Sub txtDAllowence_Change() txtTotalSalary = Val(txtBasic) + Val(txtDAllowence) + Val(txtMedical) + Val(txtCCA) + Val(txtHRA) + Val(txtArrear) + Val(txtPF) End Sub Private Sub txtCity_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtPhone.SetFocus ElseIf KeyAscii = 27 Then txtAddress2.SetFocus End If End Sub Private Sub txtDAllowence_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtMedical.SetFocus ElseIf KeyAscii = 27 Then txtBasic.SetFocus End If End Sub
126
Private Sub txtEmpName_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then dtpDOB.SetFocus ElseIf KeyAscii = 27 Then lstBoys.SetFocus End If End Sub Private Sub txtHRA_Change() txtTotalSalary = Val(txtBasic) + Val(txtDAllowence) + Val(txtMedical) + Val(txtCCA) + Val(txtHRA) + Val(txtArrear) + Val(txtPF) End Sub Private Sub txtHRA_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtArrear.SetFocus ElseIf KeyAscii = 27 Then txtCCA.SetFocus End If End Sub Private Sub txtMedical_Change() txtTotalSalary = Val(txtBasic) + Val(txtDAllowence) + Val(txtMedical) + Val(txtCCA) + Val(txtHRA) + Val(txtArrear) + Val(txtPF) End Sub Private Sub txtMedical_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtCCA.SetFocus ElseIf KeyAscii = 27 Then txtDAllowence.SetFocus
127
End If End Sub Private Sub txtMobile_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then dtpJoiningDate.SetFocus ElseIf KeyAscii = 27 Then txtPhone.SetFocus End If End Sub Private Sub txtPF_Change() txtTotalSalary = Val(txtBasic) + Val(txtDAllowence) + Val(txtMedical) + Val(txtCCA) + Val(txtHRA) + Val(txtArrear) + Val(txtPF) End Sub Private Sub txtPF_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then cmdSubmit.SetFocus ElseIf KeyAscii = 27 Then txtArrear.SetFocus End If End Sub Private Sub txtPhone_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtMobile.SetFocus ElseIf KeyAscii = 27 Then txtCity.SetFocus End If End Sub
128
Sub ClearAll() txtEmpName = "" txtAddress1 = "" txtAddress2 = "" txtCity = "" txtPhone = "" txtMobile = "" dtpJoiningDate = Date txtBasic = "" txtDAllowence = "0.00" txtMedical = "0.00" txtCCA = "0.00" txtHRA = "0.00" txtArrear = "0.00" txtPF = "0.00" txtTotalSalary = "" txtEmpName.SetFocus Flag = False End Sub
129
Private Sub cmbAttendance_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then cmbEAttendance.SetFocus ElseIf KeyAscii = 27 Then txtCB.SetFocus End If End Sub Private Sub cmbBoy_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtComP.SetFocus ElseIf KeyAscii = 27 Then txtSNo.SetFocus End If End Sub Private Sub cmbEAttendance_KeyPress(KeyAscii As Integer) Dim Rs As New ADODB.Recordset Dim TAmt As Double If KeyAscii = 13 And Val(txtSNo) = 0 Then grdDetails.Rows = grdDetails.Rows + 1 grdDetails.TextMatrix(grdDetails.Rows - 1, 0) = grdDetails.Rows - 1 grdDetails.TextMatrix(grdDetails.Rows - 1, 1) = Trim(cmbBoy.Text) grdDetails.TextMatrix(grdDetails.Rows - 1, 2) = Trim(txtComP) grdDetails.TextMatrix(grdDetails.Rows - 1, 3) = Trim(txtComRs) grdDetails.TextMatrix(grdDetails.Rows - 1, 4) = Trim(txtOT) grdDetails.TextMatrix(grdDetails.Rows - 1, 5) = Trim(txtAdvance) grdDetails.TextMatrix(grdDetails.Rows - 1, 6) = Trim(txtReturn) grdDetails.TextMatrix(grdDetails.Rows - 1, 7) = Trim(txtCB) grdDetails.TextMatrix(grdDetails.Rows - 1, 8) = Trim(cmbAttendance.Text)
130
grdDetails.TextMatrix(grdDetails.Rows - 1, 9) = Trim(cmbEAttendance.Text) tamp = "" TAmt = Val(txtComRs) + Val(txtOT) + Val(txtReturn) - Val(txtAdvance) grdDetails.TextMatrix(grdDetails.Rows - 1, 10) = TAmt Con.Execute "insert into DailyAcc (dailydate,boyid,comper,comrs,ot,advance,return,cb,attendance,eattendance,tamt) values (#" & dtpDate.Value & "#," & cmbBoy.ItemData(cmbBoy.ListIndex) & "," & Val(txtComP) & "," & Val(txtComRs) & "," & Val(txtOT) & "," & Val(txtAdvance) & "," & Val(txtReturn) & "," & Val(txtCB) & ",'" & Trim(cmbAttendance.Text) & "','" & Trim(cmbEAttendance.Text) & "'," & TAmt & ")" If Rs.State = adStateOpen Then Rs.Close End If Rs.Open "select max(id) as max_id from DailyAcc", Con, adOpenKeyset If Rs.RecordCount > 0 Then grdDetails.RowData(grdDetails.Rows - 1) = Rs!max_id End If txtSNo = "" cmbBoy.ListIndex = 0 txtComP = "" txtComRs = "" txtOT = "" txtAdvance = "" txtReturn = "" txtCB = "" cmbAttendance.ListIndex = 0 cmbEAttendance.ListIndex = 0 cmbBoy.SetFocus ElseIf KeyAscii = 13 And Val(txtSNo) > 0 Then
131
grdDetails.TextMatrix(Val(txtSNo), 1) = Trim(cmbBoy.Text) grdDetails.TextMatrix(Val(txtSNo), 2) = Trim(txtComP) grdDetails.TextMatrix(Val(txtSNo), 3) = Trim(txtComRs) grdDetails.TextMatrix(Val(txtSNo), 4) = Trim(txtOT) grdDetails.TextMatrix(Val(txtSNo), 5) = Trim(txtAdvance) grdDetails.TextMatrix(Val(txtSNo), 6) = Trim(txtReturn) grdDetails.TextMatrix(Val(txtSNo), 7) = Trim(txtCB) grdDetails.TextMatrix(Val(txtSNo), 8) = Trim(cmbAttendance.Text) grdDetails.TextMatrix(Val(txtSNo), 9) = Trim(cmbEAttendance.Text) tamp = "" TAmt = Val(txtComRs) + Val(txtOT) + Val(txtReturn) - Val(txtAdvance) grdDetails.TextMatrix(Val(txtSNo), 10) = TAmt Con.Execute "update DailyAcc set boyid=" & Val(cmbBoy.ItemData(cmbBoy.ListIndex)) & ",comper=" & Val(txtComP) & ",comrs=" & Val(txtComRs) & ",ot=" & Val(txtOT) & ",advance=" & Val(txtAdvance) & ",return=" & Val(txtReturn) & ",cb=" & Val(txtCB) & ",attendance='" & Trim(cmbAttendance.Text) & "',eattendance='" & Trim(cmbEAttendance.Text) & "',tamt=" & TAmt & " where id=" & grdDetails.RowData(Val(txtSNo)) txtSNo = "" cmbBoy.ListIndex = 0 txtComP = "" txtComRs = "" txtOT = "" txtAdvance = "" txtReturn = "" txtCB = "" cmbAttendance.ListIndex = 0 cmbEAttendance.ListIndex = 0
132
cmbBoy.SetFocus ElseIf KeyAscii = 27 Then cmbAttendance.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 If Rs.State = adStateOpen Then Rs.Close End If Rs.Open "select dailyacc.*,staff.empname from staff,dailyacc where dailyacc.dailydate=#" & dtpDate.Value & "# and staff.id=dailyacc.boyid", Con, adOpenKeyset If Rs.RecordCount > 0 Then dsrAttendance.Sections("section4").Controls("label3").Caption = Format(dtpDate.Value, "dd mmm yyyy") Set dsrAttendance.DataSource = Rs dsrAttendance.Show dsrAttendance.Refresh
133
End If End If End Sub Private Sub dtpDate_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 dailyacc.*,staff.empname from staff,dailyacc where dailyacc.dailydate=#" & dtpDate.Value & "# and staff.id=dailyacc.boyid", 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) = Rs!empname & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 2) = Rs!comper & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 3) = Rs!comrs & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 4) = Rs!ot & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 5) = Rs!advance & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 6) = Rs!return & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 7) = Rs!cb & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 8) = Rs!attendance & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 9) = Rs!eattendance & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 10) = Rs!TAmt grdDetails.RowData(i) = Rs!id
134
Rs.MoveNext Next End If cmbBoy.SetFocus Else grdDetails.Rows = 1 End If End Sub Private Sub Form_Load() Dim Rs As New ADODB.Recordset grdDetails.ColWidth(0) = 535 grdDetails.TextMatrix(0, 0) = "S.No." grdDetails.ColWidth(1) = 1675 grdDetails.TextMatrix(0, 1) = "Boy Name" grdDetails.ColWidth(2) = 775 grdDetails.TextMatrix(0, 2) = "Com(%)" grdDetails.ColWidth(3) = 775 grdDetails.TextMatrix(0, 3) = "Com(Rs)" grdDetails.ColWidth(4) = 805 grdDetails.TextMatrix(0, 4) = "OT" grdDetails.ColWidth(5) = 880 grdDetails.TextMatrix(0, 5) = "Advance" grdDetails.ColWidth(6) = 880
135
grdDetails.TextMatrix(0, 6) = "Return" grdDetails.ColWidth(7) = 880 grdDetails.TextMatrix(0, 7) = "Cash" grdDetails.ColWidth(8) = 1060 grdDetails.TextMatrix(0, 8) = "Att." grdDetails.ColWidth(9) = 1040 grdDetails.TextMatrix(0, 9) = "E. Att." grdDetails.Rows = 1 dtpDate.Value = Date 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
136
Rs.Open "select dailyacc.*,staff.empname from staff,dailyacc where dailyacc.dailydate=#" & dtpDate.Value & "# and staff.id=dailyacc.boyid", Con, adOpenKeyset If Rs.RecordCount > 0 Then 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) = Rs!empname & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 2) = Rs!comper & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 3) = Rs!comrs & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 4) = Rs!ot & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 5) = Rs!advance & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 6) = Rs!return & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 7) = Rs!cb & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 8) = Rs!attendance & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 9) = Rs!eattendance & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 10) = Rs!TAmt & "" grdDetails.RowData(i) = Rs!id Rs.MoveNext Next Else grdDetails.Rows = 1 End If dtpDate.Value = Date End Sub Private Sub txtAdvance_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtReturn.SetFocus ElseIf KeyAscii = 27 Then txtOT.SetFocus
137
End If End Sub Private Sub txtCB_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then cmbAttendance.SetFocus ElseIf KeyAscii = 27 Then txtReturn.SetFocus End If End Sub Private Sub txtComP_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtComRs.SetFocus ElseIf KeyAscii = 27 Then cmbBoy.SetFocus End If End Sub Private Sub txtComRs_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtOT.SetFocus ElseIf KeyAscii = 27 Then txtComP.SetFocus End If End Sub Private Sub txtOT_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtAdvance.SetFocus ElseIf KeyAscii = 27 Then
138
txtComRs.SetFocus End If End Sub Private Sub txtReturn_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtCB.SetFocus ElseIf KeyAscii = 27 Then txtAdvance.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 For j = 0 To cmbBoy.ListCount - 1 If grdDetails.TextMatrix(Val(txtSNo), 1) = cmbBoy.List(j) Then cmbBoy.ListIndex = j Exit For End If Next txtComP = grdDetails.TextMatrix(i, 2) txtComRs = grdDetails.TextMatrix(i, 3) txtOT = grdDetails.TextMatrix(i, 4) txtAdvance = grdDetails.TextMatrix(i, 5) txtReturn = grdDetails.TextMatrix(i, 6) txtCB = grdDetails.TextMatrix(i, 7) If grdDetails.TextMatrix(i, 8) = "P" Then cmbAttendance.ListIndex = 0 Else
139
cmbAttendance.ListIndex = 1 End If If grdDetails.TextMatrix(i, 9) = "P" Then cmbEAttendance.ListIndex = 0 Else cmbEAttendance.ListIndex = 1 End If Exit Sub Else cmbBoy.ListIndex = 0 txtComP = "" txtComRs = "" txtOT = "" txtAdvance = "" txtReturn = "" txtCB = "" cmbAttendance.ListIndex = 0 cmbEAttendance.ListIndex = 0 End If Next Else txtSNo = "" End If End Sub Private Sub txtSno_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then cmbBoy.SetFocus ElseIf KeyAscii = 27 Then dtpDate.SetFocus
140
End If End Sub Sub ClearAll() txtSNo = "" cmbBoy.ListIndex = 0 txtComP = "" txtComRs = "" txtOT = "" txtAdvance = "" txtReturn = "" txtCB = "" cmbAttendance.ListIndex = 0 cmbEAttendance.ListIndex = 0 grdDetails.Rows = 1 End Sub
141
Private Sub cmbAttendance_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then cmbEAttendance.SetFocus ElseIf KeyAscii = 27 Then txtCB.SetFocus End If End Sub Private Sub cmbBoy_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtComP.SetFocus ElseIf KeyAscii = 27 Then txtSNo.SetFocus End If End Sub Private Sub cmbEAttendance_KeyPress(KeyAscii As Integer) Dim Rs As New ADODB.Recordset Dim TAmt As Double If KeyAscii = 13 And Val(txtSNo) = 0 Then grdDetails.Rows = grdDetails.Rows + 1 grdDetails.TextMatrix(grdDetails.Rows - 1, 0) = grdDetails.Rows 1 grdDetails.TextMatrix(grdDetails.Rows - 1, 1) = Trim(cmbBoy.Text) grdDetails.TextMatrix(grdDetails.Rows - 1, 2) = Trim(txtComP) grdDetails.TextMatrix(grdDetails.Rows - 1, 3) = Trim(txtComRs) grdDetails.TextMatrix(grdDetails.Rows - 1, 4) = Trim(txtOT) grdDetails.TextMatrix(grdDetails.Rows - 1, 5) = Trim(txtAdvance) grdDetails.TextMatrix(grdDetails.Rows - 1, 6) = Trim(txtReturn) grdDetails.TextMatrix(grdDetails.Rows - 1, 7) = Trim(txtCB) grdDetails.TextMatrix(grdDetails.Rows - 1, 8) = Trim(cmbAttendance.Text) grdDetails.TextMatrix(grdDetails.Rows - 1, 9) = Trim(cmbEAttendance.Text) tamp = "" TAmt = Val(txtComRs) + Val(txtOT) + Val(txtReturn) Val(txtAdvance) grdDetails.TextMatrix(grdDetails.Rows - 1, 10) = TAmt
142
Con.Execute "insert into DailyAcc (dailydate,boyid,comper,comrs,ot,advance,return,cb,attendance,eattendance, tamt) values (#" & dtpDate.Value & "#," & cmbBoy.ItemData(cmbBoy.ListIndex) & "," & Val(txtComP) & "," & Val(txtComRs) & "," & Val(txtOT) & "," & Val(txtAdvance) & "," & Val(txtReturn) & "," & Val(txtCB) & ",'" & Trim(cmbAttendance.Text) & "','" & Trim(cmbEAttendance.Text) & "'," & TAmt & ")" If Rs.State = adStateOpen Then Rs.Close End If Rs.Open "select max(id) as max_id from DailyAcc", Con, adOpenKeyset If Rs.RecordCount > 0 Then grdDetails.RowData(grdDetails.Rows - 1) = Rs!max_id End If txtSNo = "" cmbBoy.ListIndex = 0 txtComP = "" txtComRs = "" txtOT = "" txtAdvance = "" txtReturn = "" txtCB = "" cmbAttendance.ListIndex = 0 cmbEAttendance.ListIndex = 0 cmbBoy.SetFocus ElseIf KeyAscii = 13 And Val(txtSNo) > 0 Then grdDetails.TextMatrix(Val(txtSNo), 1) = Trim(cmbBoy.Text) grdDetails.TextMatrix(Val(txtSNo), 2) = Trim(txtComP) grdDetails.TextMatrix(Val(txtSNo), 3) = Trim(txtComRs) grdDetails.TextMatrix(Val(txtSNo), 4) = Trim(txtOT) grdDetails.TextMatrix(Val(txtSNo), 5) = Trim(txtAdvance) grdDetails.TextMatrix(Val(txtSNo), 6) = Trim(txtReturn) grdDetails.TextMatrix(Val(txtSNo), 7) = Trim(txtCB) grdDetails.TextMatrix(Val(txtSNo), 8) = Trim(cmbAttendance.Text) grdDetails.TextMatrix(Val(txtSNo), 9) = Trim(cmbEAttendance.Text) tamp = "" TAmt = Val(txtComRs) + Val(txtOT) + Val(txtReturn) Val(txtAdvance) grdDetails.TextMatrix(Val(txtSNo), 10) = TAmt
143
Con.Execute "update DailyAcc set boyid=" & Val(cmbBoy.ItemData(cmbBoy.ListIndex)) & ",comper=" & Val(txtComP) & ",comrs=" & Val(txtComRs) & ",ot=" & Val(txtOT) & ",advance=" & Val(txtAdvance) & ",return=" & Val(txtReturn) & ",cb=" & Val(txtCB) & ",attendance='" & Trim(cmbAttendance.Text) & "',eattendance='" & Trim(cmbEAttendance.Text) & "',tamt=" & TAmt & " where id=" & grdDetails.RowData(Val(txtSNo)) txtSNo = "" cmbBoy.ListIndex = 0 txtComP = "" txtComRs = "" txtOT = "" txtAdvance = "" txtReturn = "" txtCB = "" cmbAttendance.ListIndex = 0 cmbEAttendance.ListIndex = 0 cmbBoy.SetFocus ElseIf KeyAscii = 27 Then cmbAttendance.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 If Rs.State = adStateOpen Then Rs.Close End If Rs.Open "select dailyacc.*,staff.empname from staff,dailyacc where dailyacc.dailydate=#" & dtpDate.Value & "# and staff.id=dailyacc.boyid", Con, adOpenKeyset If Rs.RecordCount > 0 Then dsrAttendance.Sections("section4").Controls("label3").Caption = Format(dtpDate.Value, "dd mmm yyyy")
144
Set dsrAttendance.DataSource = Rs dsrAttendance.Show dsrAttendance.Refresh End If End If End Sub Private Sub dtpDate_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 dailyacc.*,staff.empname from staff,dailyacc where dailyacc.dailydate=#" & dtpDate.Value & "# and staff.id=dailyacc.boyid", 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) = Rs!empname & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 2) = Rs!comper & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 3) = Rs!comrs & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 4) = Rs!ot & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 5) = Rs!advance & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 6) = Rs!return & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 7) = Rs!cb & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 8) = Rs!attendance & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 9) = Rs! eattendance & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 10) = Rs!TAmt grdDetails.RowData(i) = Rs!id Rs.MoveNext Next End If
145
cmbBoy.SetFocus Else grdDetails.Rows = 1 End If End Sub Private Sub Form_Load() Dim Rs As New ADODB.Recordset grdDetails.ColWidth(0) = 535 grdDetails.TextMatrix(0, 0) = "S.No." grdDetails.ColWidth(1) = 1675 grdDetails.TextMatrix(0, 1) = "Boy Name" grdDetails.ColWidth(2) = 775 grdDetails.TextMatrix(0, 2) = "Com(%)" grdDetails.ColWidth(3) = 775 grdDetails.TextMatrix(0, 3) = "Com(Rs)" grdDetails.ColWidth(4) = 805 grdDetails.TextMatrix(0, 4) = "OT" grdDetails.ColWidth(5) = 880 grdDetails.TextMatrix(0, 5) = "Advance" grdDetails.ColWidth(6) = 880 grdDetails.TextMatrix(0, 6) = "Return" grdDetails.ColWidth(7) = 880 grdDetails.TextMatrix(0, 7) = "Cash" grdDetails.ColWidth(8) = 1060 grdDetails.TextMatrix(0, 8) = "Att." grdDetails.ColWidth(9) = 1040 grdDetails.TextMatrix(0, 9) = "E. Att." grdDetails.Rows = 1 dtpDate.Value = Date If Rs.State = adStateOpen Then Rs.Close End If
146
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 dailyacc.*,staff.empname from staff,dailyacc where dailyacc.dailydate=#" & dtpDate.Value & "# and staff.id=dailyacc.boyid", Con, adOpenKeyset If Rs.RecordCount > 0 Then 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) = Rs!empname & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 2) = Rs!comper & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 3) = Rs!comrs & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 4) = Rs!ot & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 5) = Rs!advance & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 6) = Rs!return & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 7) = Rs!cb & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 8) = Rs!attendance & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 9) = Rs!eattendance & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 10) = Rs!TAmt & "" grdDetails.RowData(i) = Rs!id Rs.MoveNext Next Else grdDetails.Rows = 1 End If dtpDate.Value = Date End Sub
147
Private Sub txtAdvance_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtReturn.SetFocus ElseIf KeyAscii = 27 Then txtOT.SetFocus End If End Sub Private Sub txtCB_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then cmbAttendance.SetFocus ElseIf KeyAscii = 27 Then txtReturn.SetFocus End If End Sub Private Sub txtComP_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtComRs.SetFocus ElseIf KeyAscii = 27 Then cmbBoy.SetFocus End If End Sub Private Sub txtComRs_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtOT.SetFocus ElseIf KeyAscii = 27 Then txtComP.SetFocus End If End Sub Private Sub txtOT_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtAdvance.SetFocus ElseIf KeyAscii = 27 Then txtComRs.SetFocus End If End Sub Private Sub txtReturn_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtCB.SetFocus ElseIf KeyAscii = 27 Then txtAdvance.SetFocus End If
148
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 For j = 0 To cmbBoy.ListCount - 1 If grdDetails.TextMatrix(Val(txtSNo), 1) = cmbBoy.List(j) Then cmbBoy.ListIndex = j Exit For End If Next txtComP = grdDetails.TextMatrix(i, 2) txtComRs = grdDetails.TextMatrix(i, 3) txtOT = grdDetails.TextMatrix(i, 4) txtAdvance = grdDetails.TextMatrix(i, 5) txtReturn = grdDetails.TextMatrix(i, 6) txtCB = grdDetails.TextMatrix(i, 7) If grdDetails.TextMatrix(i, 8) = "P" Then cmbAttendance.ListIndex = 0 Else cmbAttendance.ListIndex = 1 End If If grdDetails.TextMatrix(i, 9) = "P" Then cmbEAttendance.ListIndex = 0 Else cmbEAttendance.ListIndex = 1 End If Exit Sub Else cmbBoy.ListIndex = 0 txtComP = "" txtComRs = "" txtOT = "" txtAdvance = "" txtReturn = "" txtCB = "" cmbAttendance.ListIndex = 0 cmbEAttendance.ListIndex = 0 End If Next Else txtSNo = "" End If
149
End Sub Private Sub txtSno_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then cmbBoy.SetFocus ElseIf KeyAscii = 27 Then dtpDate.SetFocus End If End Sub Sub ClearAll() txtSNo = "" cmbBoy.ListIndex = 0 txtComP = "" txtComRs = "" txtOT = "" txtAdvance = "" txtReturn = "" txtCB = "" cmbAttendance.ListIndex = 0 cmbEAttendance.ListIndex = 0 grdDetails.Rows = 1 End Sub
150
Dim PerDaySal As Double Private Sub cmbBoy_KeyPress(KeyAscii As Integer) Dim Rs As New ADODB.Recordset Dim Rs1 As New ADODB.Recordset If KeyAscii = 13 Then If Rs.State = adStateOpen Then Rs.Close End If Rs.Open "select dailyacc.*,salary.totalsalary from dailyacc,salary where month(dailyacc.dailydate)=" & Month(dtpDate.Value) & " and year(dailyacc.dailydate)=" & Year(dtpDate.Value) & " and dailyacc.boyid=" & cmbBoy.ItemData(cmbBoy.ListIndex) & " and salary.id=" & cmbBoy.ItemData(cmbBoy.ListIndex), Con, adOpenKeyset If Rs.RecordCount > 0 Then grdDetails.Rows = 1 txtComRs = "" txtOT = "" txtAdvance = "" txtReturn = "" txtCB = "" txtAttendance = "" txtEAttendance = "" txtTotalSalary = "" txtSalary = "" txtNetSalary = Rs!totalsalary PerDaySal = Val(Rs!totalsalary) / 30 If Rs1.State = adStateOpen Then Rs1.Close End If 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) = Rs!comper & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 2) = Rs!comrs & "" txtComRs = Val(txtComRs) + Val(Rs!comrs) grdDetails.TextMatrix(grdDetails.Rows - 1, 3) = Rs!ot & "" txtOT = Val(txtOT) + Val(Rs!ot)
151
grdDetails.TextMatrix(grdDetails.Rows - 1, 4) = Rs!advance & "" txtAdvance = Val(txtAdvance) + Val(Rs!advance) grdDetails.TextMatrix(grdDetails.Rows - 1, 5) = Rs!return & "" txtReturn = Val(txtReturn) + Val(Rs!return) grdDetails.TextMatrix(grdDetails.Rows - 1, 6) = Rs!cb & "" txtCB = Val(txtCB) + Rs!cb grdDetails.TextMatrix(grdDetails.Rows - 1, 7) = Rs!attendance & "" If Rs!attendance = "A" Then txtAttendance = Val(txtAdvance) + 1 End If grdDetails.TextMatrix(grdDetails.Rows - 1, 8) = Rs! eattendance & "" If Rs!eattendance = "A" Then txtEAttendance = Val(txtEAttendance) + 1 End If Rs.MoveNext Next Else grdDetails.Rows = 1 txtComRs = "" txtOT = "" txtAdvance = "" txtReturn = "" txtCB = "" txtAttendance = "" txtEAttendance = "" txtTotalSalary = "" txtSalary = "" End If If Rs.State = adStateOpen Then Rs.Close End If Rs.Open "select * from lastsalary where month(salarydate)=" & Month(dtpDate.Value) & " and year(salarydate)=" & Year(dtpDate.Value) & " and boyid=" & cmbBoy.ItemData(cmbBoy.ListIndex), Con, adOpenKeyset If Rs.RecordCount > 0 Then End If If Rs.State = adStateOpen Then
152
Rs.Close End If Rs.Open "select * from dueamount where boyid=" & cmbBoy.ItemData(cmbBoy.ListIndex), Con, adOpenKeyset If Rs.RecordCount > 0 Then txtLastDue = Rs!amount Else txtLastDue = 0 End If txtSalary.SetFocus ElseIf KeyAscii = 27 Then dtpDate.SetFocus End If End Sub Private Sub cmdClear_Click() grdDetails.Rows = 1 txtComRs = "" txtOT = "" txtAdvance = "" txtReturn = "" txtCB = "" txtAttendance = "" txtEAttendance = "" txtTotalSalary = "" txtSalary = "" End Sub Private Sub cmdExit_Click() Unload Me End Sub Private Sub dtpDate_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then cmbBoy.SetFocus End If End Sub Private Sub Form_Load() Dim Rs As New ADODB.Recordset grdDetails.ColWidth(0) = 535 grdDetails.TextMatrix(0, 0) = "S.No."
153
grdDetails.ColWidth(1) = 775 grdDetails.TextMatrix(0, 1) = "Com(%)" grdDetails.ColWidth(2) = 775 grdDetails.TextMatrix(0, 2) = "Com(Rs)" grdDetails.ColWidth(3) = 805 grdDetails.TextMatrix(0, 3) = "OT" grdDetails.ColWidth(4) = 880 grdDetails.TextMatrix(0, 4) = "Advance" grdDetails.ColWidth(5) = 880 grdDetails.TextMatrix(0, 5) = "Return" grdDetails.ColWidth(6) = 880 grdDetails.TextMatrix(0, 6) = "Cash" grdDetails.ColWidth(7) = 1060 grdDetails.TextMatrix(0, 7) = "Att." grdDetails.ColWidth(8) = 1040 grdDetails.TextMatrix(0, 8) = "E. Att." 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 dtpDate.Value = Date End Sub Private Sub txtAdvance_Change() txtTotalSalary = (Val(txtNetSalary) + Val(txtComRs) + Val(txtOT) + Val(txtReturn)) - Val(txtAdvance) - Val(txtTARS) - Val(txtEARS) + Val(txtLastDue)
154
End Sub Private Sub txtAttendance_Change() txtEARS = Format(PerDaySal * Val(txtEAttendance), "###0.00") End Sub Private Sub txtComRs_Change() txtTotalSalary = (Val(txtNetSalary) + Val(txtComRs) + Val(txtOT) + Val(txtReturn)) - Val(txtAdvance) - Val(txtTARS) - Val(txtEARS) End Sub Private Sub txtEARS_Change() txtTotalSalary = (Val(txtNetSalary) + Val(txtComRs) + Val(txtOT) + Val(txtReturn)) - Val(txtAdvance) - Val(txtTARS) - Val(txtEARS) End Sub Private Sub txtEAttendance_Change() txtEARS = Format((PerDaySal / 2) * Val(txtEAttendance), "###0.00") End Sub Private Sub txtLastDue_Change() 'txtTotalSalary = (Val(txtNetSalary) + Val(txtComRs) + Val(txtOT) + Val(txtReturn)) - Val(txtAdvance) - Val(txtTARS) - Val(txtEARS) End Sub Private Sub txtOT_Change() txtTotalSalary = (Val(txtNetSalary) + Val(txtComRs) + Val(txtOT) + Val(txtReturn)) - Val(txtAdvance) - Val(txtTARS) - Val(txtEARS) End Sub Private Sub txtReturn_Change() txtTotalSalary = (Val(txtNetSalary) + Val(txtComRs) + Val(txtOT) + Val(txtReturn)) - Val(txtAdvance) - Val(txtTARS) - Val(txtEARS) End Sub Private Sub txtSalary_KeyPress(KeyAscii As Integer) Dim Rs As New ADODB.Recordset If KeyAscii = 13 Then If grdDetails.Rows > 1 Then Con.Execute "insert into lastsalary (boyid,totalsalary,givensalary) values (" & cmbBoy.ItemData(cmbBoy.ListIndex) & "," & Val(txtTotalSalary) & "," & Val(txtSalary) & ")" If Rs.State = adStateOpen Then
155
Rs.Close End If Rs.Open "select * from dueamount where boyid=" & cmbBoy.ItemData(cmbBoy.ListIndex), Con, adOpenKeyset If Rs.RecordCount > 0 Then Con.Execute "update dueamount set amount= " & (Val(txtTotalSalary) - Val(txtSalary)) & " where boyid=" & cmbBoy.ItemData(cmbBoy.ListIndex) Else Con.Execute "insert into dueamount (boyid,amount) values (" & cmbBoy.ItemData(cmbBoy.ListIndex) & "," & (Val(txtTotalSalary) Val(txtSalary)) & ")" End If End If ElseIf KeyAscii = 27 Then cmbBoy.SetFocus End If End Sub Private Sub txtTARS_Change() txtTotalSalary = (Val(txtNetSalary) + Val(txtComRs) + Val(txtOT) + Val(txtReturn)) - Val(txtAdvance) - Val(txtTARS) - Val(txtEARS) + Val(txtLastDue) End Sub
156
Private Sub cmdAdmin_Click() PopupMenu mnuAdmin End Sub Private Sub cmdExit_Click() Unload Me End Sub Private Sub cmdFile_Click() PopupMenu mnuFile End Sub Private Sub cmdPersonal_Click() PopupMenu mnuPersonal End Sub Private Sub mnuBill_Click() frmBill.Top = 100 frmBill.Left = 450 frmBill.Show End Sub Private Sub mnuBP_Click() FrmBankProfile.Top = 500 FrmBankProfile.Left = 1000 FrmBankProfile.Show End Sub Private Sub mnuCP_Click() frmCompanyProfile.Top = 500 frmCompanyProfile.Left = 1000 frmCompanyProfile.Show End Sub Private Sub mnuDelivery_Click() frmDelivery.Top = 100 frmDelivery.Left = 450 frmDelivery.Show End Sub Private Sub mnuExit_Click() Unload Me End Sub Private Sub mnuICL_Click() frmInComingLaot.Top = 100
157
frmInComingLaot.Left = 450 frmInComingLaot.Show End Sub Private Sub mnuPending_Click() frmPending.Top = 100 frmPending.Left = 450 frmPending.Show End Sub Private Sub mnuPFM_Click() frmPFM.Top = 100 frmPFM.Left = 450 frmPFM.Show End Sub Private Sub mnuReturn_Click() frmReturn.Top = 100 frmReturn.Left = 450 frmReturn.Show End Sub Private Sub mnuRTD_Click() frmRTD.Top = 100 frmRTD.Left = 450 frmRTD.Show End Sub Private Sub mnuSP_Click() frmStaff.Top = 500 frmStaff.Left = 1000 frmStaff.Show End Sub Private Sub mnuSS_Click() frmStaffSalary.Top = 500 frmStaffSalary.Left = 450 frmStaffSalary.Show End Sub Private Sub mnuST_Click() frmStaffAtt.Top = 500 frmStaffAtt.Left = 450 frmStaffAtt.Show End Sub
158
MODULE Public Con As ADODB.Connection
Sub main() Set Con = New ADODB.Connection Con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Couriers.mdb;" Con.Open mdiCourier.Show End Sub
159
CODING OF MDI FORM Private Sub cmdAdmin_Click() PopupMenu mnuAdmin End Sub Private Sub cmdExit_Click() Unload Me End Sub Private Sub cmdFile_Click() PopupMenu mnuFile End Sub Private Sub cmdPersonal_Click() PopupMenu mnuPersonal End Sub Private Sub mnuBill_Click() frmBill.Top = 100 frmBill.Left = 450 frmBill.Show End Sub Private Sub mnuBP_Click() FrmBankProfile.Top = 500 FrmBankProfile.Left = 1000 FrmBankProfile.Show End Sub Private Sub mnuCP_Click() frmCompanyProfile.Top = 500 frmCompanyProfile.Left = 1000 frmCompanyProfile.Show End Sub Private Sub mnuDelivery_Click() frmDelivery.Top = 100 frmDelivery.Left = 450 frmDelivery.Show End Sub Private Sub mnuExit_Click() Unload Me
160
End Sub Private Sub mnuICL_Click() frmInComingLaot.Top = 100 frmInComingLaot.Left = 450 frmInComingLaot.Show End Sub Private Sub mnuPending_Click() frmPending.Top = 100 frmPending.Left = 450 frmPending.Show End Sub Private Sub mnuPFM_Click() frmPFM.Top = 100 frmPFM.Left = 450 frmPFM.Show End Sub Private Sub mnuReturn_Click() frmReturn.Top = 100 frmReturn.Left = 450 frmReturn.Show End Sub Private Sub mnuRTD_Click() frmRTD.Top = 100 frmRTD.Left = 450 frmRTD.Show End Sub Private Sub mnuSP_Click() frmStaff.Top = 500 frmStaff.Left = 1000 frmStaff.Show End Sub Private Sub mnuSS_Click() frmStaffSalary.Top = 500 frmStaffSalary.Left = 450 frmStaffSalary.Show End Sub Private Sub mnuST_Click() frmStaffAtt.Top = 500 frmStaffAtt.Left = 450 frmStaffAtt.Show End Sub
161
Company Profile 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
162
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
163
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
164
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
165
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 = ""
166
txtSD = "" txtCP = "" txtPhone = "" txtMobile = "" txtCN.SetFocus End Sub
167
Bank Profile 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
168
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
169
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
170
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)
171
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
172
Staff 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 staff.empname,staff.dob,staff.address1,staff.address2,staff.city,staff.phone,staff.mobile,st aff.joining,staff.intime,staff.outtime,salary.totalsalary from staff,salary where staff.id=salary.id order by staff.empname", Con, adOpenKeyset If Rs.RecordCount > 0 Then Set dsrStaff.DataSource = Rs dsrStaff.Show dsrStaff.Refresh End If End Sub Private Sub cmdSubmit_Click() Dim Rs As New ADODB.Recordset If Trim(txtEmpName) = "" Then MsgBox "Employee Name must Be There", vbOKOnly + vbInformation
173
txtEmpName.SetFocus Exit Sub End If If Val(txtBasic) 0 Then lstBoys.Clear For i = 0 To Rs.RecordCount - 1 lstBoys.AddItem Rs!empname & ""
174
lstBoys.ItemData(i) = Rs!id Rs.MoveNext Next End If ClearAll ElseIf Flag = True Then Con.Execute "update staff set empname='" & Trim(txtEmpName) & "',dob=#" & dtpDOB.Value & "#,address1='" & Trim(txtAddress1) & "',address2='" & Trim(txtAddress2) & "',city='" & Trim(txtCity) & "',phone='" & Trim(txtPhone) & "',mobile='" & Trim(txtMobile) & "',joining=#" & dtpJoiningDate.Value & "#,intime=#" & dtpTimeIn.Value & "#,outtime=#" & dtpTimeOut.Value & "# where id=" & Val(txtEmpName.Tag) Con.Execute "update salary set basic=" & Val(txtBasic) & ",da=" & Val(txtDAllowence) & ",medical=" & Val(txtMedical) & ",cca=" & Val(txtCCA) & ",hra=" & Val(txtHRA) & ",arrear=" & Val(txtArrear) & ",pf=" & Val(txtPF) & ",totalsalary=" & Val(txtTotalSalary) & " where id=" & Val(txtEmpName.Tag) ClearAll Flag = False End If End Sub Private Sub dtpDOB_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then txtAddress1.SetFocus ElseIf KeyCode = 27 Then txtEmpName.SetFocus End If End Sub Private Sub dtpJoiningDate_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then
175
dtpTimeIn.SetFocus ElseIf KeyCode = 27 Then txtMobile.SetFocus End If End Sub Private Sub dtpTimeIn_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then dtpTimeOut.SetFocus ElseIf KeyCode = 27 Then dtpJoiningDate.SetFocus End If End Sub Private Sub dtpTimeOut_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then txtBasic.SetFocus ElseIf KeyCode = 27 Then dtpTimeIn.SetFocus 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,empname from staff order by empname", Con, adOpenKeyset If Rs.RecordCount > 0 Then For i = 0 To Rs.RecordCount - 1 lstBoys.AddItem Rs!empname & ""
176
lstBoys.ItemData(i) = Rs!id Rs.MoveNext Next End If End Sub Private Sub lstBoys_DblClick() Dim Rs As New ADODB.Recordset If lstBoys.ListIndex > -1 Then If Rs.State = adStateOpen Then Rs.Close End If Rs.Open "select staff.*,salary.* from staff,salary where staff.id=" & Val(lstBoys.ItemData(lstBoys.ListIndex)) & " and salary.id=" & Val(lstBoys.ItemData(lstBoys.ListIndex)), Con, adOpenKeyset If Rs.RecordCount > 0 Then txtEmpName = Rs!empname & "" txtEmpName.Tag = lstBoys.ItemData(lstBoys.ListIndex) dtpDOB.Value = Rs!dob & "" txtAddress1 = Rs!address1 & "" txtAddress2 = Rs!address2 & "" txtCity = Rs!city & "" txtPhone = Rs!phone & "" txtMobile = Rs!mobile & "" dtpJoiningDate.Value = Rs!joining & "" dtpTimeIn.Value = Rs!intime & "" dtpTimeOut.Value = Rs!outtime & "" txtBasic = Rs!basic & "" txtDAllowence = Rs!da & "" txtMedical = Rs!medical & "" txtCCA = Rs!cca & ""
177
txtHRA = Rs!hra & "" txtArrear = Rs!arrear & "" txtPF = Rs!pf & "" txtTotalSalary = Rs!totalsalary & "" Flag = True End If End If End Sub Private Sub txtAddress1_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtAddress2.SetFocus ElseIf KeyAscii = 27 Then dtpDOB.SetFocus End If End Sub Private Sub txtAddress2_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtCity.SetFocus ElseIf KeyAscii = 27 Then txtAddress1.SetFocus End If End Sub Private Sub txtArrear_Change() txtTotalSalary = Val(txtBasic) + Val(txtDAllowence) + Val(txtMedical) + Val(txtCCA) + Val(txtHRA) + Val(txtArrear) + Val(txtPF) End Sub Private Sub txtArrear_KeyPress(KeyAscii As Integer)
178
If KeyAscii = 13 Then txtPF.SetFocus ElseIf KeyAscii = 27 Then txtHRA.SetFocus End If End Sub Private Sub txtBasic_Change() txtTotalSalary = Val(txtBasic) + Val(txtDAllowence) + Val(txtMedical) + Val(txtCCA) + Val(txtHRA) + Val(txtArrear) + Val(txtPF) End Sub Private Sub txtBasic_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtDAllowence.SetFocus ElseIf KeyAscii = 27 Then dtpTimeOut.SetFocus End If End Sub Private Sub txtCCA_Change() txtTotalSalary = Val(txtBasic) + Val(txtDAllowence) + Val(txtMedical) + Val(txtCCA) + Val(txtHRA) + Val(txtArrear) + Val(txtPF) End Sub Private Sub txtCCA_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtHRA.SetFocus ElseIf KeyAscii = 27 Then txtMedical.SetFocus End If End Sub
179
Private Sub txtDAllowence_Change() txtTotalSalary = Val(txtBasic) + Val(txtDAllowence) + Val(txtMedical) + Val(txtCCA) + Val(txtHRA) + Val(txtArrear) + Val(txtPF) End Sub Private Sub txtCity_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtPhone.SetFocus ElseIf KeyAscii = 27 Then txtAddress2.SetFocus End If End Sub Private Sub txtDAllowence_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtMedical.SetFocus ElseIf KeyAscii = 27 Then txtBasic.SetFocus End If End Sub Private Sub txtEmpName_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then dtpDOB.SetFocus ElseIf KeyAscii = 27 Then lstBoys.SetFocus End If End Sub Private Sub txtHRA_Change()
180
txtTotalSalary = Val(txtBasic) + Val(txtDAllowence) + Val(txtMedical) + Val(txtCCA) + Val(txtHRA) + Val(txtArrear) + Val(txtPF) End Sub Private Sub txtHRA_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtArrear.SetFocus ElseIf KeyAscii = 27 Then txtCCA.SetFocus End If End Sub Private Sub txtMedical_Change() txtTotalSalary = Val(txtBasic) + Val(txtDAllowence) + Val(txtMedical) + Val(txtCCA) + Val(txtHRA) + Val(txtArrear) + Val(txtPF) End Sub Private Sub txtMedical_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtCCA.SetFocus ElseIf KeyAscii = 27 Then txtDAllowence.SetFocus End If End Sub Private Sub txtMobile_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then dtpJoiningDate.SetFocus ElseIf KeyAscii = 27 Then txtPhone.SetFocus End If
181
End Sub Private Sub txtPF_Change() txtTotalSalary = Val(txtBasic) + Val(txtDAllowence) + Val(txtMedical) + Val(txtCCA) + Val(txtHRA) + Val(txtArrear) + Val(txtPF) End Sub Private Sub txtPF_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then cmdSubmit.SetFocus ElseIf KeyAscii = 27 Then txtArrear.SetFocus End If End Sub Private Sub txtPhone_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtMobile.SetFocus ElseIf KeyAscii = 27 Then txtCity.SetFocus End If End Sub Sub ClearAll() txtEmpName = "" txtAddress1 = "" txtAddress2 = "" txtCity = "" txtPhone = "" txtMobile = "" dtpJoiningDate = Date
182
txtBasic = "" txtDAllowence = "0.00" txtMedical = "0.00" txtCCA = "0.00" txtHRA = "0.00" txtArrear = "0.00" txtPF = "0.00" txtTotalSalary = "" txtEmpName.SetFocus Flag = False End Sub
183
InComing laot 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)
184
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) & ",'" & Trim(cmbCrDr.Text) & "')" If Rs.State = adStateOpen Then
185
Rs.Close End If 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 txtSNo = "" txtDocument = "" cmbType.ListIndex = 0 txtWeight = "" cmbUrgent.ListIndex = 0 txtCharges = "" cmbCrDr.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(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 = ""
186
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
187
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."
188
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 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 cmbUrgent.ListIndex = 0 cmbCrDr.ListIndex = 0 End If dtpGCD.Value = Date End Sub Private Sub lstlaot_DblClick()
189
Dim Rs As New ADODB.Recordset If Rs.State = adStateOpen Then Rs.Close End If Rs.Open "select * from incominglaot where gcd=#" & dtpGCD.Value & "# and cid=" & cmbCompany.ItemData(cmbCompany.ListIndex) & " and laotno='" & lstlaot.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) = Rs!dno & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 2) = Rs!Type & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 3) = Rs!Weight & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 4) = Rs!urgent & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 5) = Rs!charges & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 6) = Rs!drcr & "" grdDetails.RowData(i + 1) = Rs!id Rs.MoveNext Next Flag = True End If End Sub Private Sub txtCharges_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then cmbCrDr.SetFocus ElseIf KeyAscii = 27 Then cmbUrgent.SetFocus End If
190
End Sub Private Sub txtDocument_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then cmbType.SetFocus ElseIf KeyAscii = 27 Then txtSNo.SetFocus End If End Sub Private Sub txtLaot_Change() Dim Rs As New ADODB.Recordset If Rs.State = adStateOpen Then Rs.Close End If Rs.Open "select * from incominglaot where gcd=#" & dtpGCD.Value & "# and cid=" & cmbCompany.ItemData(cmbCompany.ListIndex) & " and laotno='" & Trim(txtLaot) & "'", 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) = Rs!dno & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 2) = Rs!Type & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 3) = Rs!Weight & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 4) = Rs!urgent & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 5) = Rs!charges & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 6) = Rs!drcr & "" grdDetails.RowData(i + 1) = Rs!id Rs.MoveNext
191
Next Flag = True Else grdDetails.Rows = 1 End If End Sub Private Sub txtLaot_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtSNo.SetFocus ElseIf KeyAscii = 27 Then dtpGCD.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) If grdDetails.TextMatrix(i, 2) = "Parsal" Then cmbType.ListIndex = 1 Else cmbType.ListIndex = 0 End If txtWeight = grdDetails.TextMatrix(i, 3) If grdDetails.TextMatrix(i, 4) = "No" Then cmbUrgent.ListIndex = 0 Else cmbUrgent.ListIndex = 1
192
End If txtCharges = grdDetails.TextMatrix(i, 5) If grdDetails.TextMatrix(i, 6) = "Dr" Then cmbCrDr.ListIndex = 0 Else cmbCrDr.ListIndex = 1 End If Exit Sub Else txtDocument = "" cmbType.ListIndex = 0 txtWeight = "" cmbUrgent.ListIndex = 0 txtCharges = "" cmbCrDr.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 txtLaot.SetFocus End If End Sub Private Sub txtWeight_KeyPress(KeyAscii As Integer)
193
If KeyAscii = 13 Then cmbUrgent.SetFocus ElseIf KeyAscii = 27 Then cmbType.SetFocus End If End Sub Sub ClearAll() txtLaot = "" txtSNo = "" txtDocument = "" cmbType.ListIndex = 0 txtWeight = "" cmbUrgent.ListIndex = 0 txtCharges = "" cmbCrDr.ListIndex = 0 grdDetails.Rows = 1 lstlaot.Clear cmbCompany.SetFocus End Sub
Delivery Private Sub cmbBoy_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then 194
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
195
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
196
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)
197
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"
198
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
199
'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
200
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
201
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
202
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)
203
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)
204
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
205
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
206
Return 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 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 cmbCompany_Click() Dim Rs As New ADODB.Recordset If Rs.State = adStateOpen Then Rs.Close End If 207
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 cmbSig_KeyPress(KeyAscii As Integer) If KeyAscii = 13 And Val(txtSNo) > 0 Then grdDetails.TextMatrix(Val(txtSNo), 6) = cmbSig.Text Con.Execute "update Delivery set sig='" & Trim(cmbSig.Text) & "' where id=" & grdDetails.RowData(Val(txtSNo)) txtSNo = "" txtDocument = "" txtFW = "" txtParty = "" txtAmount = ""
208
txtType = "" cmbSig.ListIndex = 0 txtSNo.SetFocus ElseIf KeyAscii = 27 Then txtSNo.SetFocus End If End Sub Private Sub cmdClear_Click() ClearAll End Sub Private Sub cmdExit_Click() Unload Me 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
209
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) = 1810 grdDetails.TextMatrix(0, 2) = "From Where" grdDetails.ColWidth(3) = 1810 grdDetails.TextMatrix(0, 3) = "Party Name" grdDetails.ColWidth(4) = 1075 grdDetails.TextMatrix(0, 4) = "Amount" grdDetails.ColWidth(5) = 1175 grdDetails.TextMatrix(0, 5) = "Type" grdDetails.ColWidth(6) = 1095
210
grdDetails.TextMatrix(0, 6) = "Sig" 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 cmbSig.ListIndex = 0 End If
211
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 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.TextMatrix(grdDetails.Rows - 1, 6) = Trim(Rs!SIG) 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
212
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 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.TextMatrix(grdDetails.Rows - 1, 6) = Trim(Rs!SIG) & "" grdDetails.RowData(i + 1) = Rs!id Rs.MoveNext Next Else grdDetails.Rows = 1 End If
213
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
214
txtDocument = grdDetails.TextMatrix(i, 1) txtFW = grdDetails.TextMatrix(i, 2) txtParty = grdDetails.TextMatrix(i, 3) txtAmount = grdDetails.TextMatrix(i, 4) txtType = grdDetails.TextMatrix(i, 5) If grdDetails.TextMatrix(i, 6) = "Sig" Then cmbSig.ListIndex = 0 ElseIf grdDetails.TextMatrix(i, 6) = "Stamp" Then cmbSig.ListIndex = 1 ElseIf grdDetails.TextMatrix(i, 6) = "RTO" Then cmbSig.ListIndex = 2 End If Exit Sub Else txtDocument = "" txtFW = "" txtParty = "" txtAmount = "" txtType = "" cmbSig.ListIndex = 0 End If Next Else txtSNo = "" End If End Sub Private Sub txtSno_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then cmbSig.SetFocus ElseIf KeyAscii = 27 Then
215
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 = "" txtType = "" cmbSig.ListIndex = 0 grdDetails.Rows = 1 lstCNo.Clear cmbCompany.SetFocus End Sub
216
Bill 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()
217
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
218
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
219
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)
220
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
221
Next cmbBank.ListIndex = 0 End If End Sub Sub ClearAll() grdDetails.Rows = 1 cmbCompany.SetFocus End Sub
222
Staff Salary Dim PerDaySal As Double Private Sub cmbBoy_KeyPress(KeyAscii As Integer) Dim Rs As New ADODB.Recordset Dim Rs1 As New ADODB.Recordset If KeyAscii = 13 Then If Rs.State = adStateOpen Then Rs.Close End If Rs.Open "select dailyacc.*,salary.totalsalary from dailyacc,salary where month(dailyacc.dailydate)=" & Month(dtpDate.Value) & " and year(dailyacc.dailydate)=" & Year(dtpDate.Value) & " and dailyacc.boyid=" & cmbBoy.ItemData(cmbBoy.ListIndex) & " and salary.id=" & cmbBoy.ItemData(cmbBoy.ListIndex), Con, adOpenKeyset If Rs.RecordCount > 0 Then grdDetails.Rows = 1 txtComRs = "" txtOT = "" txtAdvance = "" txtReturn = "" txtCB = "" txtAttendance = "" txtEAttendance = "" txtTotalSalary = "" txtSalary = "" txtNetSalary = Rs!totalsalary PerDaySal = Val(Rs!totalsalary) / 30 If Rs1.State = adStateOpen Then Rs1.Close End If 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) = Rs!comper & "" grdDetails.TextMatrix(grdDetails.Rows - 1, 2) = Rs!comrs & "" txtComRs = Val(txtComRs) + Val(Rs!comrs) grdDetails.TextMatrix(grdDetails.Rows - 1, 3) = Rs!ot & "" txtOT = Val(txtOT) + Val(Rs!ot) grdDetails.TextMatrix(grdDetails.Rows - 1, 4) = Rs!advance & "" txtAdvance = Val(txtAdvance) + Val(Rs!advance)
223
grdDetails.TextMatrix(grdDetails.Rows - 1, 5) = Rs!return & "" txtReturn = Val(txtReturn) + Val(Rs!return) grdDetails.TextMatrix(grdDetails.Rows - 1, 6) = Rs!cb & "" txtCB = Val(txtCB) + Rs!cb grdDetails.TextMatrix(grdDetails.Rows - 1, 7) = Rs!attendance & "" If Rs!attendance = "A" Then txtAttendance = Val(txtAdvance) + 1 End If grdDetails.TextMatrix(grdDetails.Rows - 1, 8) = Rs! eattendance & "" If Rs!eattendance = "A" Then txtEAttendance = Val(txtEAttendance) + 1 End If Rs.MoveNext Next Else grdDetails.Rows = 1 txtComRs = "" txtOT = "" txtAdvance = "" txtReturn = "" txtCB = "" txtAttendance = "" txtEAttendance = "" txtTotalSalary = "" txtSalary = "" End If If Rs.State = adStateOpen Then Rs.Close End If Rs.Open "select * from lastsalary where month(salarydate)=" & Month(dtpDate.Value) & " and year(salarydate)=" & Year(dtpDate.Value) & " and boyid=" & cmbBoy.ItemData(cmbBoy.ListIndex), Con, adOpenKeyset If Rs.RecordCount > 0 Then End If If Rs.State = adStateOpen Then Rs.Close End If Rs.Open "select * from dueamount where boyid=" & cmbBoy.ItemData(cmbBoy.ListIndex), Con, adOpenKeyset If Rs.RecordCount > 0 Then txtLastDue = Rs!amount Else
224
txtLastDue = 0 End If txtSalary.SetFocus ElseIf KeyAscii = 27 Then dtpDate.SetFocus End If End Sub Private Sub cmdClear_Click() grdDetails.Rows = 1 txtComRs = "" txtOT = "" txtAdvance = "" txtReturn = "" txtCB = "" txtAttendance = "" txtEAttendance = "" txtTotalSalary = "" txtSalary = "" End Sub Private Sub cmdExit_Click() Unload Me End Sub Private Sub dtpDate_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then cmbBoy.SetFocus End If End Sub Private Sub Form_Load() Dim Rs As New ADODB.Recordset grdDetails.ColWidth(0) = 535 grdDetails.TextMatrix(0, 0) = "S.No." grdDetails.ColWidth(1) = 775 grdDetails.TextMatrix(0, 1) = "Com(%)" grdDetails.ColWidth(2) = 775 grdDetails.TextMatrix(0, 2) = "Com(Rs)" grdDetails.ColWidth(3) = 805 grdDetails.TextMatrix(0, 3) = "OT" grdDetails.ColWidth(4) = 880 grdDetails.TextMatrix(0, 4) = "Advance" grdDetails.ColWidth(5) = 880 grdDetails.TextMatrix(0, 5) = "Return"
225
grdDetails.ColWidth(6) = 880 grdDetails.TextMatrix(0, 6) = "Cash" grdDetails.ColWidth(7) = 1060 grdDetails.TextMatrix(0, 7) = "Att." grdDetails.ColWidth(8) = 1040 grdDetails.TextMatrix(0, 8) = "E. Att." 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 dtpDate.Value = Date End Sub Private Sub txtAdvance_Change() txtTotalSalary = (Val(txtNetSalary) + Val(txtComRs) + Val(txtOT) + Val(txtReturn)) - Val(txtAdvance) - Val(txtTARS) - Val(txtEARS) + Val(txtLastDue) End Sub Private Sub txtAttendance_Change() txtEARS = Format(PerDaySal * Val(txtEAttendance), "###0.00") End Sub Private Sub txtComRs_Change() txtTotalSalary = (Val(txtNetSalary) + Val(txtComRs) + Val(txtOT) + Val(txtReturn)) - Val(txtAdvance) - Val(txtTARS) - Val(txtEARS) End Sub Private Sub txtEARS_Change() txtTotalSalary = (Val(txtNetSalary) + Val(txtComRs) + Val(txtOT) + Val(txtReturn)) - Val(txtAdvance) - Val(txtTARS) - Val(txtEARS) End Sub Private Sub txtEAttendance_Change() txtEARS = Format((PerDaySal / 2) * Val(txtEAttendance), "###0.00")
226
End Sub Private Sub txtLastDue_Change() 'txtTotalSalary = (Val(txtNetSalary) + Val(txtComRs) + Val(txtOT) + Val(txtReturn)) - Val(txtAdvance) - Val(txtTARS) - Val(txtEARS) End Sub Private Sub txtOT_Change() txtTotalSalary = (Val(txtNetSalary) + Val(txtComRs) + Val(txtOT) + Val(txtReturn)) - Val(txtAdvance) - Val(txtTARS) - Val(txtEARS) End Sub Private Sub txtReturn_Change() txtTotalSalary = (Val(txtNetSalary) + Val(txtComRs) + Val(txtOT) + Val(txtReturn)) - Val(txtAdvance) - Val(txtTARS) - Val(txtEARS) End Sub Private Sub txtSalary_KeyPress(KeyAscii As Integer) Dim Rs As New ADODB.Recordset If KeyAscii = 13 Then If grdDetails.Rows > 1 Then Con.Execute "insert into lastsalary (boyid,totalsalary,givensalary) values (" & cmbBoy.ItemData(cmbBoy.ListIndex) & "," & Val(txtTotalSalary) & "," & Val(txtSalary) & ")" If Rs.State = adStateOpen Then Rs.Close End If Rs.Open "select * from dueamount where boyid=" & cmbBoy.ItemData(cmbBoy.ListIndex), Con, adOpenKeyset If Rs.RecordCount > 0 Then Con.Execute "update dueamount set amount= " & (Val(txtTotalSalary) - Val(txtSalary)) & " where boyid=" & cmbBoy.ItemData(cmbBoy.ListIndex) Else Con.Execute "insert into dueamount (boyid,amount) values (" & cmbBoy.ItemData(cmbBoy.ListIndex) & "," & (Val(txtTotalSalary) Val(txtSalary)) & ")" End If End If ElseIf KeyAscii = 27 Then cmbBoy.SetFocus End If End Sub
227
Private Sub txtTARS_Change() txtTotalSalary = (Val(txtNetSalary) + Val(txtComRs) + Val(txtOT) + Val(txtReturn)) - Val(txtAdvance) - Val(txtTARS) - Val(txtEARS) + Val(txtLastDue) End Sub
Module Public Con As ADODB.Connection Sub main() Set Con = New ADODB.Connection Con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Couriers.mdb;" Con.Open mdiCourier.Show End Sub
228
9
OUTPUT
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
10
BIBLIOGRAPHY
244
BIBLOGRAPHY
Mastering visual basic 6.0 –
BY Evangelos Petroutsos
Visual basic 6.0 programming -
By Steven Holzner
Microsoft Access –
By Harkins, ETAL
245
View more...
Comments