316
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 1

BCA PROJECT ON COURIER MANAGEMENT SYSTEM

Embed Size (px)

Citation preview

Page 1: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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 STUDIESNH-24, ADHYATMIK NAGAR,DASNA, GHAZIABAD -201001

1

Page 2: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 3: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 4: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

CONTENTS1. 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 22-28

1. Diagram

2. Requirement analysis and specification

3. Designing

4. Coding

5. Testing

6. Implementation

7. Maintenance.

4

Page 5: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

7. CONCLUSION 29-30

8. SOURCE CODE 31-228

9. OUTPUT 229-243

10. BIBLIOGRAPHY 244-245

5

Page 6: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

1

CATEGORY OF PROJECT

6

Page 7: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 8: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

2

AREA OF PROJECT

8

Page 9: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

AREA OF PROJECT

SERVICES

9

Page 10: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

3

INTRODUCTION

10

Page 11: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 12: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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.

12

Page 13: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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.

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.

13

Page 14: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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.

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

Page 15: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

15

Page 16: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

4

REQUIRMENT16

Page 17: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

17

Page 18: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

Back end MS-access

5

18

Page 19: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

DIAGRAMS

1-CONTEXT FLOW DIAGRAM

Response

Material Information Material Search data Bill

19

Custom

Employe

CourierService Customer

Page 20: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

Payment

Information

CONTEXT FLOW DIAGRAM

Response

Packet Information

Bill

20

Cust

CourierManagemen

t system stomer

Page 21: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

Payment

2-SYSTEM DATA FLOW DIAGRAM

Information saved Input packet and Saved information Search data Record Display

21

User

User

CourierService

Information

Of

Page 22: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

6

SOFTWARE

22

Page 23: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

DEVELOPMENT LIFE CYCLE

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.

23

Page 24: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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.

1-DIAGRAM OF SOFTWARE

DEVELOPMENT LIFE CYCLE

24

Requirement, analysis

and specification

Designing

Page 25: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

25

Coding

Testing

Maintenance

Implementatio

n

Page 26: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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.

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.

26

Page 27: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

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,

27

Page 28: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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.

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

28

Page 29: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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.

7

29

Page 30: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

CONCLUSION

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.

30

Page 31: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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.

8

31

Page 32: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

SOURCE CODE

CODING

Dim Flag As Boolean

Private Sub cmdClear_Click()

ClearAll

End Sub

32

Page 33: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

Private Sub cmdExit_Click()

Unload Me

End Sub

Private Sub cmdPrint_Click()

Dim Rs As New ADODB.Recordset

If Rs.State = adStateOpen Then

Rs.Close

End If

Rs.Open "select bank,address,state,city,phone,mobile from bankprofile order by bank",

Con, adOpenKeyset

If Rs.RecordCount > 0 Then

Set dsrClient.DataSource = Rs

dsrClient.Show

dsrClient.Refresh

End If

End Sub

Private Sub cmdSubmit_Click()

Dim Rs As New ADODB.Recordset

If Trim(txtBN) <> "" And Flag = False Then

For i = 0 To lstBN.ListCount - 1

If Trim(UCase(txtBN)) = Trim(UCase(lstBN.List(i))) Then

MsgBox "Bank Already Exist", vbOKOnly + vbInformation

txtBN.SetFocus

Exit Sub

End If

Next

33

Page 34: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

Con.Execute "insert into Bankprofile (Bank,address,city,state,phone,mobile) values ('"

& Trim(txtBN) & "','" & Trim(txtAddress) & "','" & Trim(txtCP) & "','" & Trim(txtSD)

& "','" & Trim(txtPhone) & "','" & Trim(txtMobile) & "')"

If Rs.State = adStateOpen Then

Rs.Close

End If

Rs.Open "select max(id) as max_id from Bankprofile", Con, adOpenKeyset

If Rs.RecordCount > 0 Then

lstBN.AddItem Trim(txtBN)

lstBN.ItemData(lstBN.ListCount - 1) = Rs!max_id

ClearAll

End If

ElseIf Trim(txtBN) <> "" And Flag = True Then

Con.Execute "update Bankprofile set Bank='" & Trim(txtBN) & "',address='" &

Trim(txtAddress) & "',state='" & Trim(txtSD) & "',city='" & Trim(txtCP) & "',phone='"

& Trim(txtPhone) & "',mobile='" & Trim(txtMobile) & "' where id=" & Val(txtBN.Tag)

ClearAll

End If

End Sub

Private Sub Form_Load()

Dim Rs As New ADODB.Recordset

If Rs.State = adStateOpen Then

Rs.Close

End If

Rs.Open "select id,Bank from Bankprofile order by Bank", Con, adOpenKeyset

If Rs.RecordCount > 0 Then

For i = 0 To Rs.RecordCount - 1

lstBN.AddItem Rs!Bank & ""

lstBN.ItemData(i) = Rs!id

34

Page 35: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

Rs.MoveNext

Next

End If

End Sub

Private Sub lstbn_DblClick()

Dim Rs As New ADODB.Recordset

If Rs.State = adStateOpen Then

Rs.Close

End If

If lstBN.ListIndex > -1 Then

Rs.Open "select * from Bankprofile where id=" & lstBN.ItemData(lstBN.ListIndex),

Con, adOpenKeyset

If Rs.RecordCount > 0 Then

txtBN = Rs!Bank & ""

txtBN.Tag = Rs!id & ""

txtAddress = Rs!address & ""

txtSD = Rs!State & ""

txtCP = Rs!city & ""

txtPhone = Rs!phone & ""

txtMobile = Rs!mobile & ""

Flag = True

End If

End If

End Sub

Private Sub lstbn_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

txtBN.SetFocus

End If

End Sub

35

Page 36: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

Private Sub txtAddress_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

txtSD.SetFocus

ElseIf KeyAscii = 27 Then

txtBN.SetFocus

End If

End Sub

Private Sub txtbn_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

txtAddress.SetFocus

ElseIf KeyAscii = 27 Then

lstBN.SetFocus

If lstBN.ListCount > 0 Then

lstBN.ListIndex = 0

End If

End If

End Sub

Private Sub txtCP_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

txtPhone.SetFocus

ElseIf KeyAscii = 27 Then

txtSD.SetFocus

End If

End Sub

Private Sub txtMobile_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

cmdSubmit.SetFocus

36

Page 37: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

37

Page 38: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 39: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 40: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 41: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 42: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 43: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 44: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 45: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 46: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 47: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 48: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 49: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

txtAddress = ""

txtSD = ""

txtCP = ""

txtPhone = ""

txtMobile = ""

txtCN.SetFocus

End Sub

49

Page 50: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 51: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 52: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 53: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 54: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 55: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 56: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 57: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 58: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 59: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 60: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 61: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 62: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 63: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 64: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 65: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 66: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 67: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 68: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 69: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 70: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 71: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 72: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 73: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

txtCharges = ""

cmbCrDr.ListIndex = 0

grdDetails.Rows = 1

lstlaot.Clear

cmbCompany.SetFocus

End Sub

73

Page 74: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 75: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 76: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 77: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 78: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 79: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 80: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 81: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 82: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

ElseIf KeyCode = 27 Then

optAll.SetFocus

End If

End Sub

82

Page 83: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 84: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 85: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 86: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 87: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 88: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 89: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 90: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 91: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 92: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 93: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 94: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

'''''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

Page 95: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 96: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 97: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 98: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 99: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 100: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 101: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 102: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 103: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 104: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 105: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 106: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 107: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 108: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 109: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 110: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 111: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 112: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 113: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 114: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 115: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 116: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 117: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 118: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 119: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 120: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

MsgBox "Employee Name must Be There", vbOKOnly + vbInformation

txtEmpName.SetFocus

Exit Sub

End If

If Val(txtBasic) <= 0 Then

MsgBox "Basic Salary must Be There", vbOKOnly + vbInformation

txtBasic.SetFocus

Exit Sub

End If

If Flag = False Then

Con.Execute "insert into staff

(empname,dob,address1,address2,city,phone,mobile,joining,intime,outtime) values ('" &

Trim(txtEmpName) & "',#" & Trim(dtpDOB.Value) & "#,'" & Trim(txtAddress1) & "','"

& Trim(txtAddress2) & "','" & Trim(txtCity) & "','" & Trim(txtPhone) & "','" &

Trim(txtMobile) & "',#" & Trim(dtpJoiningDate.Value) & "#,#" &

Trim(dtpTimeIn.Value) & "#,#" & Trim(dtpTimeOut.Value) & "#)"

If Rs.State = adStateOpen Then

Rs.Close

End If

Rs.Open "select max(id) as max_id from Staff", Con, adOpenKeyset

Con.Execute "insert into salary values (" & Val(Rs!max_id) & "," &

Val(txtDAllowence) & "," & Val(txtBasic) & "," & Val(txtMedical) & "," &

Val(txtCCA) & "," & Val(txtHRA) & "," & Val(txtArrear) & "," & Val(txtPF) & "," &

Val(txtTotalSalary) & ")"

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

120

Page 121: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 122: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 123: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 124: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 125: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 126: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 127: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 128: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 129: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 130: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 131: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 132: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 133: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 134: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 135: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 136: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 137: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 138: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 139: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 140: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 141: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 142: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

Private Sub cmbAttendance_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then cmbEAttendance.SetFocusElseIf KeyAscii = 27 Then txtCB.SetFocusEnd IfEnd Sub

Private Sub cmbBoy_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then txtComP.SetFocusElseIf KeyAscii = 27 Then txtSNo.SetFocusEnd IfEnd Sub

Private Sub cmbEAttendance_KeyPress(KeyAscii As Integer)Dim Rs As New ADODB.RecordsetDim 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

Page 143: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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.SetFocusElseIf 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

Page 144: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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.SetFocusElseIf KeyAscii = 27 Then cmbAttendance.SetFocusEnd IfEnd Sub

Private Sub cmdClear_Click()ClearAllEnd Sub

Private Sub cmdExit_Click()Unload MeEnd 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

Page 145: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

Set dsrAttendance.DataSource = Rs dsrAttendance.Show dsrAttendance.Refresh End IfEnd IfEnd 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

Page 146: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

cmbBoy.SetFocusElse grdDetails.Rows = 1End IfEnd Sub

Private Sub Form_Load()Dim Rs As New ADODB.Recordset

grdDetails.ColWidth(0) = 535grdDetails.TextMatrix(0, 0) = "S.No."

grdDetails.ColWidth(1) = 1675grdDetails.TextMatrix(0, 1) = "Boy Name"

grdDetails.ColWidth(2) = 775grdDetails.TextMatrix(0, 2) = "Com(%)"

grdDetails.ColWidth(3) = 775grdDetails.TextMatrix(0, 3) = "Com(Rs)"

grdDetails.ColWidth(4) = 805grdDetails.TextMatrix(0, 4) = "OT"

grdDetails.ColWidth(5) = 880grdDetails.TextMatrix(0, 5) = "Advance"

grdDetails.ColWidth(6) = 880grdDetails.TextMatrix(0, 6) = "Return"

grdDetails.ColWidth(7) = 880grdDetails.TextMatrix(0, 7) = "Cash"

grdDetails.ColWidth(8) = 1060grdDetails.TextMatrix(0, 8) = "Att."

grdDetails.ColWidth(9) = 1040grdDetails.TextMatrix(0, 9) = "E. Att."

grdDetails.Rows = 1dtpDate.Value = Date

If Rs.State = adStateOpen Then Rs.CloseEnd If

146

Page 147: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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 = 0End If

If Rs.State = adStateOpen Then Rs.CloseEnd 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 NextElse grdDetails.Rows = 1End IfdtpDate.Value = DateEnd Sub

147

Page 148: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

Private Sub txtAdvance_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then txtReturn.SetFocusElseIf KeyAscii = 27 Then txtOT.SetFocusEnd IfEnd Sub

Private Sub txtCB_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then cmbAttendance.SetFocusElseIf KeyAscii = 27 Then txtReturn.SetFocusEnd IfEnd Sub

Private Sub txtComP_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then txtComRs.SetFocusElseIf KeyAscii = 27 Then cmbBoy.SetFocusEnd IfEnd Sub

Private Sub txtComRs_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then txtOT.SetFocusElseIf KeyAscii = 27 Then txtComP.SetFocusEnd IfEnd Sub

Private Sub txtOT_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then txtAdvance.SetFocusElseIf KeyAscii = 27 Then txtComRs.SetFocusEnd IfEnd Sub

Private Sub txtReturn_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then txtCB.SetFocusElseIf KeyAscii = 27 Then txtAdvance.SetFocusEnd If

148

Page 149: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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 NextElse txtSNo = ""End If

149

Page 150: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

End Sub

Private Sub txtSno_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then cmbBoy.SetFocusElseIf KeyAscii = 27 Then dtpDate.SetFocusEnd IfEnd Sub

Sub ClearAll()txtSNo = ""cmbBoy.ListIndex = 0txtComP = ""txtComRs = ""txtOT = ""txtAdvance = ""txtReturn = ""txtCB = ""cmbAttendance.ListIndex = 0cmbEAttendance.ListIndex = 0grdDetails.Rows = 1End Sub

150

Page 151: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

Dim PerDaySal As Double

Private Sub cmbBoy_KeyPress(KeyAscii As Integer)Dim Rs As New ADODB.RecordsetDim 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

Page 152: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 153: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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.SetFocusElseIf KeyAscii = 27 Then dtpDate.SetFocusEnd IfEnd Sub

Private Sub cmdClear_Click()grdDetails.Rows = 1txtComRs = ""txtOT = ""txtAdvance = ""txtReturn = ""txtCB = ""txtAttendance = ""txtEAttendance = ""txtTotalSalary = ""txtSalary = ""End Sub

Private Sub cmdExit_Click()Unload MeEnd Sub

Private Sub dtpDate_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = 13 Then cmbBoy.SetFocusEnd IfEnd Sub

Private Sub Form_Load()Dim Rs As New ADODB.Recordset

grdDetails.ColWidth(0) = 535grdDetails.TextMatrix(0, 0) = "S.No."

153

Page 154: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

grdDetails.ColWidth(1) = 775grdDetails.TextMatrix(0, 1) = "Com(%)"

grdDetails.ColWidth(2) = 775grdDetails.TextMatrix(0, 2) = "Com(Rs)"

grdDetails.ColWidth(3) = 805grdDetails.TextMatrix(0, 3) = "OT"

grdDetails.ColWidth(4) = 880grdDetails.TextMatrix(0, 4) = "Advance"

grdDetails.ColWidth(5) = 880grdDetails.TextMatrix(0, 5) = "Return"

grdDetails.ColWidth(6) = 880grdDetails.TextMatrix(0, 6) = "Cash"

grdDetails.ColWidth(7) = 1060grdDetails.TextMatrix(0, 7) = "Att."

grdDetails.ColWidth(8) = 1040grdDetails.TextMatrix(0, 8) = "E. Att."

grdDetails.Rows = 1

If Rs.State = adStateOpen Then Rs.CloseEnd IfRs.Open "select id,empname from staff order by empname", Con,

adOpenKeysetIf 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 = 0End IfdtpDate.Value = DateEnd Sub

Private Sub txtAdvance_Change()txtTotalSalary = (Val(txtNetSalary) + Val(txtComRs) + Val(txtOT) +

Val(txtReturn)) - Val(txtAdvance) - Val(txtTARS) - Val(txtEARS) + Val(txtLastDue)

154

Page 155: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 156: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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 IfElseIf KeyAscii = 27 Then cmbBoy.SetFocusEnd IfEnd 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

Page 157: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

Private Sub cmdAdmin_Click()PopupMenu mnuAdminEnd Sub

Private Sub cmdExit_Click()Unload MeEnd Sub

Private Sub cmdFile_Click()PopupMenu mnuFileEnd Sub

Private Sub cmdPersonal_Click()PopupMenu mnuPersonalEnd Sub

Private Sub mnuBill_Click()frmBill.Top = 100frmBill.Left = 450frmBill.ShowEnd Sub

Private Sub mnuBP_Click()FrmBankProfile.Top = 500FrmBankProfile.Left = 1000FrmBankProfile.ShowEnd Sub

Private Sub mnuCP_Click()frmCompanyProfile.Top = 500frmCompanyProfile.Left = 1000frmCompanyProfile.ShowEnd Sub

Private Sub mnuDelivery_Click()frmDelivery.Top = 100frmDelivery.Left = 450frmDelivery.ShowEnd Sub

Private Sub mnuExit_Click()Unload MeEnd Sub

Private Sub mnuICL_Click()frmInComingLaot.Top = 100

157

Page 158: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

frmInComingLaot.Left = 450frmInComingLaot.ShowEnd Sub

Private Sub mnuPending_Click()frmPending.Top = 100frmPending.Left = 450frmPending.ShowEnd Sub

Private Sub mnuPFM_Click()frmPFM.Top = 100frmPFM.Left = 450frmPFM.ShowEnd Sub

Private Sub mnuReturn_Click()frmReturn.Top = 100frmReturn.Left = 450frmReturn.ShowEnd Sub

Private Sub mnuRTD_Click()frmRTD.Top = 100frmRTD.Left = 450frmRTD.ShowEnd Sub

Private Sub mnuSP_Click()frmStaff.Top = 500frmStaff.Left = 1000frmStaff.ShowEnd Sub

Private Sub mnuSS_Click()frmStaffSalary.Top = 500frmStaffSalary.Left = 450frmStaffSalary.ShowEnd Sub

Private Sub mnuST_Click()frmStaffAtt.Top = 500frmStaffAtt.Left = 450frmStaffAtt.ShowEnd Sub

158

Page 159: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

Page 160: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

CODING OF MDI FORM

Private Sub cmdAdmin_Click()PopupMenu mnuAdminEnd Sub

Private Sub cmdExit_Click()Unload MeEnd Sub

Private Sub cmdFile_Click()PopupMenu mnuFileEnd Sub

Private Sub cmdPersonal_Click()PopupMenu mnuPersonalEnd Sub

Private Sub mnuBill_Click()frmBill.Top = 100frmBill.Left = 450frmBill.ShowEnd Sub

Private Sub mnuBP_Click()FrmBankProfile.Top = 500FrmBankProfile.Left = 1000FrmBankProfile.ShowEnd Sub

Private Sub mnuCP_Click()frmCompanyProfile.Top = 500frmCompanyProfile.Left = 1000frmCompanyProfile.ShowEnd Sub

Private Sub mnuDelivery_Click()frmDelivery.Top = 100frmDelivery.Left = 450frmDelivery.ShowEnd Sub

Private Sub mnuExit_Click()

160

Page 161: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

Unload MeEnd SubPrivate Sub mnuICL_Click()frmInComingLaot.Top = 100frmInComingLaot.Left = 450frmInComingLaot.ShowEnd Sub

Private Sub mnuPending_Click()frmPending.Top = 100frmPending.Left = 450frmPending.ShowEnd SubPrivate Sub mnuPFM_Click()frmPFM.Top = 100frmPFM.Left = 450frmPFM.ShowEnd Sub

Private Sub mnuReturn_Click()frmReturn.Top = 100frmReturn.Left = 450frmReturn.ShowEnd Sub

Private Sub mnuRTD_Click()frmRTD.Top = 100frmRTD.Left = 450frmRTD.ShowEnd Sub

Private Sub mnuSP_Click()frmStaff.Top = 500frmStaff.Left = 1000frmStaff.ShowEnd Sub

Private Sub mnuSS_Click()frmStaffSalary.Top = 500frmStaffSalary.Left = 450frmStaffSalary.ShowEnd SubPrivate Sub mnuST_Click()frmStaffAtt.Top = 500frmStaffAtt.Left = 450frmStaffAtt.Show

161

Page 162: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

End Sub

162

Page 163: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

163

Page 164: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

164

Page 165: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

165

Page 166: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

166

Page 167: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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 = ""

167

Page 168: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

txtSD = ""

txtCP = ""

txtPhone = ""

txtMobile = ""

txtCN.SetFocus

End Sub

168

Page 169: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

169

Page 170: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

170

Page 171: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

171

Page 172: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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)

172

Page 173: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

173

Page 174: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

174

Page 175: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

txtEmpName.SetFocus

Exit Sub

End If

If Val(txtBasic) <= 0 Then

MsgBox "Basic Salary must Be There", vbOKOnly + vbInformation

txtBasic.SetFocus

Exit Sub

End If

If Flag = False Then

Con.Execute "insert into staff

(empname,dob,address1,address2,city,phone,mobile,joining,intime,outtime) values ('" &

Trim(txtEmpName) & "',#" & Trim(dtpDOB.Value) & "#,'" & Trim(txtAddress1) & "','"

& Trim(txtAddress2) & "','" & Trim(txtCity) & "','" & Trim(txtPhone) & "','" &

Trim(txtMobile) & "',#" & Trim(dtpJoiningDate.Value) & "#,#" &

Trim(dtpTimeIn.Value) & "#,#" & Trim(dtpTimeOut.Value) & "#)"

If Rs.State = adStateOpen Then

Rs.Close

End If

Rs.Open "select max(id) as max_id from Staff", Con, adOpenKeyset

Con.Execute "insert into salary values (" & Val(Rs!max_id) & "," &

Val(txtDAllowence) & "," & Val(txtBasic) & "," & Val(txtMedical) & "," &

Val(txtCCA) & "," & Val(txtHRA) & "," & Val(txtArrear) & "," & Val(txtPF) & "," &

Val(txtTotalSalary) & ")"

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

lstBoys.Clear

For i = 0 To Rs.RecordCount - 1

lstBoys.AddItem Rs!empname & ""

175

Page 176: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

176

Page 177: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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 & ""

177

Page 178: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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 & ""

178

Page 179: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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)

179

Page 180: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

180

Page 181: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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()

181

Page 182: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

182

Page 183: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

183

Page 184: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

184

Page 185: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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)

185

Page 186: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

186

Page 187: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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 = ""

187

Page 188: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

188

Page 189: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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."

189

Page 190: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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()

190

Page 191: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

191

Page 192: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

192

Page 193: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

193

Page 194: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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)

194

Page 195: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

DeliveryPrivate Sub cmbBoy_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

195

Page 196: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

196

Page 197: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

197

Page 198: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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)

198

Page 199: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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"

199

Page 200: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

200

Page 201: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

'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

201

Page 202: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

202

Page 203: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

203

Page 204: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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)

204

Page 205: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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)

205

Page 206: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

206

Page 207: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

207

Page 208: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

208

Page 209: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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 = ""

209

Page 210: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

210

Page 211: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

211

Page 212: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

212

Page 213: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

213

Page 214: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

214

Page 215: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

215

Page 216: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

216

Page 217: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

217

Page 218: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

BillPrivate 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()

218

Page 219: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

219

Page 220: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

220

Page 221: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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)

221

Page 222: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

222

Page 223: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

Next

cmbBank.ListIndex = 0

End If

End Sub

Sub ClearAll()

grdDetails.Rows = 1

cmbCompany.SetFocus

End Sub

223

Page 224: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

Staff SalaryDim PerDaySal As Double

Private Sub cmbBoy_KeyPress(KeyAscii As Integer)Dim Rs As New ADODB.RecordsetDim Rs1 As New ADODB.RecordsetIf 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)

224

Page 225: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

225

Page 226: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

txtLastDue = 0 End If txtSalary.SetFocusElseIf KeyAscii = 27 Then dtpDate.SetFocusEnd IfEnd Sub

Private Sub cmdClear_Click()grdDetails.Rows = 1txtComRs = ""txtOT = ""txtAdvance = ""txtReturn = ""txtCB = ""txtAttendance = ""txtEAttendance = ""txtTotalSalary = ""txtSalary = ""End Sub

Private Sub cmdExit_Click()Unload MeEnd Sub

Private Sub dtpDate_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = 13 Then cmbBoy.SetFocusEnd IfEnd Sub

Private Sub Form_Load()Dim Rs As New ADODB.RecordsetgrdDetails.ColWidth(0) = 535grdDetails.TextMatrix(0, 0) = "S.No."grdDetails.ColWidth(1) = 775grdDetails.TextMatrix(0, 1) = "Com(%)"grdDetails.ColWidth(2) = 775grdDetails.TextMatrix(0, 2) = "Com(Rs)"grdDetails.ColWidth(3) = 805grdDetails.TextMatrix(0, 3) = "OT"grdDetails.ColWidth(4) = 880grdDetails.TextMatrix(0, 4) = "Advance"grdDetails.ColWidth(5) = 880grdDetails.TextMatrix(0, 5) = "Return"

226

Page 227: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

grdDetails.ColWidth(6) = 880grdDetails.TextMatrix(0, 6) = "Cash"grdDetails.ColWidth(7) = 1060grdDetails.TextMatrix(0, 7) = "Att."grdDetails.ColWidth(8) = 1040grdDetails.TextMatrix(0, 8) = "E. Att."grdDetails.Rows = 1If Rs.State = adStateOpen Then Rs.CloseEnd IfRs.Open "select id,empname from staff order by empname", Con,

adOpenKeysetIf 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 = 0End IfdtpDate.Value = DateEnd 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")

227

Page 228: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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.RecordsetIf 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 IfElseIf KeyAscii = 27 Then cmbBoy.SetFocusEnd IfEnd Sub

228

Page 229: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

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

229

Page 230: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

9

OUTPUT

230

Page 231: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

231

Page 232: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

232

Page 233: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

233

Page 234: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

234

Page 235: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

235

Page 236: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

236

Page 237: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

237

Page 238: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

238

Page 239: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

239

Page 240: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

240

Page 241: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

241

Page 242: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

242

Page 243: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

243

Page 244: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

244

Page 245: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

10

BIBLIOGRAPHY

245

Page 246: BCA PROJECT ON COURIER MANAGEMENT SYSTEM

BIBLOGRAPHY

Mastering visual basic 6.0 – BY Evangelos Petroutsos

Visual basic 6.0 programming - By Steven Holzner

Microsoft Access – By Harkins, ETAL

246