Sunteți pe pagina 1din 112

STAFF MANAGEMENT SYSTEM

1.SYNOPSIS
The main objective of this Staff management System is to decrease the paper work and easier record maintenance by having a particular database for attendance, leaves and notice maintenance. Initially attendance is taken by using the attendance register in the college for staff. Staff needs to submit their leaves manually to their respected higher authorities. This increases the paper work at the same time maintaining the records is more tedious. Maintaining the notices in the records also increases the paper work. As the existing system increases the paper work and record maintenance tedious there is a need of new system which makes the record maintenance easy that is the common requirement the college attendance management system. So the completion of this project can successfully eliminate the existing problems with the present system.

2. PROJECT DESCRIPTION

The project entitled STAFF MANAGEMENT SYSTEM aims at automating the attendance maintenance of staff in a College. The proposed system has three main modules Staff Admin Backup

Staff Module Recording attendance Staff records their attendance at the beginning of each day. Any exceptions are highlighted when staff logs in on the next day. Staff can enter a justification for the exception and it is forwarded to supervisor for approval.

View Attendance Report Staff can query on their attendance for a given period. Apply Leave Staff can send a leave application to the higher authority with a reason for leave and number of days. Admin Module: This module is the higher authority for all.

Attendance reports of staff Can view and generate attendance reports of all staff members for a period of time. Daily Absent Report ADMIN can view the total number of absentees of a particular department for a given day. They can also enquire on the attendance history of an individual staff in a particular month. Registration Principal can register a staff at the time of recruitment and gives username and password generated automatically by the system. Backup Module This module is used to generate backup to store data such as Attendance Details Employee Details

3. SYSTEM ANALYSIS

System analysis is a process of gathering and interpreting facts, diagnosing problems and the information to recommend improvements on the system. It is a problem solving activity that requires intensive communication between the system users and system developers. System analysis or study is an important phase of any system development process. The system is studied to the minutest detail and analyzed. The system analyst plays the role of the interrogator and dwells deep into the working of the present system. The system is viewed as a whole and the input to the system are identified. The outputs from the organizations are traced to the various processes. System analysis is concerned with becoming aware of the problem, identifying the relevant and decisional variables, analyzing and synthesizing the various factors and determining an optimal or at least a satisfactory solution or program of action.

A detailed study of the process must be made by various techniques like interviews, questionnaires etc. The data collected by these sources must be scrutinized to arrive to a conclusion. The conclusion is an understanding of how the system functions. This system is called the existing system. Now the existing system is subjected to close study and problem areas are identified. The designer now functions as a problem solver and tries to sort out the difficulties that the enterprise faces. The solutions are given as proposals. The proposal is then weighed with the existing system analytically and the best one is selected. The proposal is presented to the user for an endorsement by the user. The proposal is reviewed on user request and suitable changes are made. This is loop that ends as soon as the user is satisfied with proposal.

Preliminary study is the process of gathering and interpreting facts, using the information for further studies on the system. Preliminary study is problem solving activity that requires intensive communication between the system users and system developers. It does various feasibility studies. In these studies a rough figure of the system activities can be obtained, from which the decision about the strategies to be followed for effective system study and analysis can be taken.

Here in the Staff Management System, a detailed study of existing system is carried along with all the steps in system analysis. An idea for creating a better project was carried and the next steps were followed.

3.1 EXISTING SYSTEM In the existing system the transactions are done only manually but in proposed system we have to computerize all the banking transaction using the software Online Banking. 3.1.1 PROBLEMS WITH EXISTING SYSTEM Lack of security of data. More man power. Time consuming. Consumes large volume of pare work. Needs manual calculations. No direct role for the higher officials. Damage of machines due to lack of attention.

To avoid all these limitations and make the working more accurately the system needs to be computerized.

3.2 PROPOSED SYSTEM The aim of proposed system is to develop a system of improved facilities. The proposed system can overcome all the limitations of the existing system. The system provides proper security and reduces the manual work. 3. 2. 1 ADVANTAGES OF THE PROPOSED SYSTEM The system is very simple in design and to implement. The system requires very low system resources and the system will work in almost all configurations. It has got following features Security of data. Ensure data accuracys. Proper control of the higher officials. Reduce the damages of the machines. Minimize manual data entry. Minimum time needed for the various processing. Greater efficiency. Better service. User friendliness and interactive. Minimum time required.

3.3. FEASIBILITY STUDY Feasibility study is made to see if the project on completion will serve the purpose of the organization for the amount of work, effort and the time that spend on it. Feasibility study lets the developer foresee the future of the project and the usefulness. A feasibility study of a system proposal is according to its workability, which is the impact on the organization, ability to meet their user needs and effective use of

resources. Thus when a new application is proposed it normally goes through a feasibility study before it is approved for development. The document provide the feasibility of the project that is being designed and lists various areas that were considered very carefully during the feasibility study of this project such as Technical, Economic and Operational feasibilities. The following are its features: 3.3.1. TECHNICAL FEASIBILITY The system must be evaluated from the technical point of view first. The assessment of this feasibility must be based on an outline design of the system requirement in the terms of input, output, programs and procedures. Having identified an outline system, the investigation must go on to suggest the type of equipment, required method developing the system, of running the system once it has been designed. Technical issues raised during the investigation are: Does the existing technology sufficient for the suggested one? Can the system expand if developed? The project should be developed such that the necessary functions and performance are achieved within the constraints. The project is developed within latest technology. Through the technology may become obsolete after some period of time, due to the fact that never version of same software supports older versions, the system may still be used. So there are minimal constraints involved with this project. The system has been developed using Java the project is technically feasible for development. 3.3.2. ECONOMIC FEASIBILITY

The developing system must be justified by cost and benefit. Criteria to ensure that effort is concentrated on project, which will give best, return at the earliest. One of the factors, which affect the development of a new system, is the cost it would require. The following are some of the important financial questions asked during preliminary investigation: The costs conduct a full system investigation. The cost of the hardware and software. The benefits in the form of reduced costs or fewer costly errors.

Since the system is developed as part of project work, there is no manual cost to spend for the proposed system. Also all the resources are already available, it give an indication of the system is economically possible for development.

3.3.3. BEHAVIORAL FEASIBILITY This includes the following questions: Is there sufficient support for the users? Will the proposed system cause harm? The project would be beneficial because it satisfies the objectives when developed and installed. All behavioral aspects are considered carefully and conclude that the project is behaviorally feasible.

4.SYSTEM REQUIREMENTS SPECIFICATION

4.1 Hardware Requirements

Machine type Processor RAM Hard Disk

-----

PII or above 300 Mhz or above 64 MB 600 MB or more

4.2 Software Requirements


Front End Tool Back End Tool Operating System Report ----Visual Basic 6.0. Access2000. Any 32 Bit Operating System. Data Report

4.2.1 VISUAL BASIC:

What is Visual Basic?


VISUAL BASIC is a high level programming language which evolved from the earlier DOS version called BASIC.BASIC means Beginners' All-purpose Symbolic Instruction Code. It is a very easy programming language to learn. The code looks a lot like English Language. Different software companies produced different versions of BASIC, such as Microsoft QBASIC, QUICKBASIC, GWBASIC, and IBM BASICA and so on. However, people prefer to use Microsoft Visual Basic today, as it is a well developed programming language and supporting resources are available everywhere. Now, there are many versions of VB exist in the market, the most popular one and still widely used by many VB programmers is none other than Visual Basic 6. We also have VB.net, VB2005, VB2008 and the latest VB2010. Both Vb2008 and VB2010 are fully object oriented programming (OOP) language. VISUAL BASIC is a VISUAL and events driven Programming Language. These are the main divergence from the old BASIC. In BASIC, programming is done in a text-only environment and the program is executed sequentially. In VB, programming is done in a graphical environment. In the old BASIC, you have to write program code for each graphical object you wish to display it on screen, including its position and its color. However, In VB, you just need to drag and drop any graphical object anywhere on the form, and you can change its color any time using the properties windows. On the other hand, because the user may click on a certain object randomly, so each object has to be programmed independently to be able to response to those actions (events). Therefore, a VB Program is made up of many subprograms, each has its own program code, and each can be executed independently and at the same time each can be linked together in one way or another.

10

Features of Visual Basic 6.0


Visual Basic was designed to be easily learned and used by beginner programmers. The language not only allows programmers to create simple GUI applications, but can also develop complex applications. Programming in VB is a combination of visually arranging components or controls on a form, specifying attributes and actions of those components, and writing additional lines of code for more functionality. Since default attributes and actions are defined for the components, a simple program can be created without the programmer having to write many lines of code. Performance problems were experienced by earlier versions, but with faster computers and native code compilation this has become less of an issue. Forms are created using drag-and-drop techniques. A tool is used to place controls (e.g., text boxes, buttons, etc.) on the form (window). Controls have attributes and event handlers associated with them. Default values are provided when the control is created, but may be changed by the programmer. Many attribute values can be modified during run time based on user actions or changes in the environment, providing a dynamic application. The Visual Basic compiler is shared with other Visual Studio languages (C, C++), but restrictions in the IDE do not allow the creation of some targets (Windows model DLLs) and threading models.

What programs can we create with Visual Basic 6?


With VB 6, you can create any program depending on your objective. For example, if you are a college or university lecturer, you can create educational programs to teach business, economics, engineering, computer science, accountancy, financial management, information system and more to make teaching more effective and interesting. If you are in business, you can also create business programs such as inventory management system, point-of-sale system, payroll system, financial program as well as accounting program to help manage your business and increase

11

productivity. For those of you who like games and working as games programmer, you can create those programs as well. Indeed, there is no limit to what program you can create! There are many such programs in this tutorial, so you must spend more time on the tutorial in order to learn how to create those programs.

What is GUI?
A GUI (usually pronounced GOO-ee) is a graphical (rather than purely textual) user interface to a computer. As you read this, you are looking at the GUI or graphical user interface of your particular Web browser. The term came into existence because the first interactive user interfaces to computers were not graphical; they were text-and-keyboard oriented and usually consisted of commands you had to remember and computer responses that were infamously brief. The command interface of the DOS operating system (which you can still get to from your Windows operating system) is an example of the typical user-computer interface before GUIs arrived. An intermediate step in user interfaces between the command line interface and the GUI was the nongraphical menu-based interface, which let you interact by using a mouse rather than by having to type in keyboard commands.

12

4.2.2 Microsoft Access


Microsoft Access is an application for creating, managing and formatting data. Microsoft, which makes Access, distributes the application as part of the Microsoft Office suite. Access' essential tools include screens for data entry, running queries, producing reports and other operations. Access' programming language is also vital because it allows users to extend the application's default functionality.

Features:
Users can create tables, queries, forms and reports, and connect them together with macros. Advanced users can use VBA to write rich solutions with advanced data manipulation and user control. Access also has report creation features that can work with any data source that Access can "access". The original concept of Access was for end users to be able to "access" data from any source. Other features include: the import and export of data to many formats including Excel, Outlook, ASCII, dBase, Paradox, FoxPro, SQL Server, Oracle, ODBC, etc. It also has the ability to link to data in its existing location and use it for viewing, querying, editing, and reporting. Microsoft Access is a file server-based database. Unlike clientserver relational database management systems (RDBMS), Microsoft Access does not implement database triggers, stored procedures, or transaction logging.

Data Entry Features


An intuitive way of entering data into an Access database is manual entry. An essential feature of Access that users choose for this operation is the tool for creating tables. Users click a toolbar button to create a new table, then define column labels for the fields in the table.

13

The navigation pane of Access is a feature that lets users quickly click to select tables they've created and saved. The navigation pane also allows users to select other objects, including reports and queries.

Import And Export


A feature for importing existing data is the set of tools under the "External Data" menu heading. One of these tools is labeled "Excel." By clicking it, Access users display a wizard that guides them through the process of moving data from an Excel spreadsheet to their Access database. A related feature is the toolset for exporting Access data to formats other applications can read, including Word, Excel and Web browsers. Access' import and export tools are vital to work teams that have data stored in different formats.

Reports
The Report Wizard is an Access feature that creates a report from a selected table or other data source with a single click. Users click a table in the navigation pane, then click the Report Wizard's icon in the toolbar to execute the wizard, which prompts users for parameters for defining the report. Users can then use another set of Access features for customizing the look and functionality of the report. Without reports, the ways in which Access users could view their data would be limited.

Queries
The query grid is a feature of Access that lets users fetch data from tables they've created. Access displays lists of tables from which users can choose a table to query with the grid. Users type names of the table's columns into the grid. They also type in the grid the criteria that data must meet for Access to include it in the query results.

14

The SQL window is a feature of Access that offers an alternative to the query grid. Users familiar with SQL syntax can enter their statements in this window, then run the statements by clicking the "Run" button on the toolbar. The Query Wizard is another feature for fetching data. When a user clicks the button for this feature, Access creates SQL statements in response to user input in the Wizard's screens. Access users rely on this tool and the query grid for retrieving their stored data.

15

5.1 STRUCTURED CHART

16

5.2 DATABASE DESIGN

Table Name: Attendance Entry

Field Name Dname Eno Ename Date2 Atype Avalue Dstart Dend Lstart Lend Totalhour Date1

Data type Text number text Date/Time Text Number Date/time Date/time Date/Time Date/Time Text Text

Table Name: Department name Table Field name Dname Data type Text

Table Name: Employee Entry Table Field Name Dname Data type text

17

Eno Ename Address City Pincode Phno Salary Jdate Edu Remark Phno_o Phno_m

AutoNumber Text Text text Text text number Date/time text text text text

Table Name: Pay Slip Table Field name Dept_name Emp_name Month1 P_day A_day Holi_day Total_wday Total_Salary Year1 Data type Text Text Text Number Number Number Number Text Text

5.3 DETAILED DESIGN 5.3.1 INTRODUCTION


System Design is the most creative and challenging phase in the system life cycle. Design is the first step into the development phase for any engineered product or system. Design is a creative process. A good design is the key to effective system. System design is a solution how to approach the creation of a new system. System design transforms a logic representation of what is required to do into the physical specification. The specification is converted into physical reality during development.

18

5.3.2 LOGICAL DESIGN


The logical flow of a system and define the boundaries of a system. It includes the following steps: Reviews the current physical system its data flows, file content, volumes, frequencies etc. Prepares output specifications that is, determines the format, content and Frequency of reports. Prepares input specifications format, content and most of the input functions. Prepares edit, security and control specifications. Specifies the implementation plan. Prepares a logical design walk through of the information flow, output, input, controls and implementation plan. Reviews benefits, costs, target dates and system constraints.

5.3.3

PHYSICAL DESIGN

Physical system produces the working systems by define the design specifications that tell the programmers exactly what the candidate system must do. It includes the following steps.

Design the physical system. Specify input and output media. Design the database and specify backup procedures.

19

Design physical information flow through the system and a physical design Walk through. Plan system implementation. Prepare a conversion schedule and target date. Determine training procedures, courses and timetable. Devise a test and implementation plan and specify any new hardware/software. Update benefits , costs , conversion date and system constraints

Design/Specification activities

Concept formulation. Problem understanding. High level requirements proposals. Feasibility study. Requirements engineering. Architectural design.

5.3.4

INPUT DESIGN
Input Design deals with what data should be given as input, how the data

should be arranged or code, the dialog to guide the operating personnel in providing input, methods for preparing input validations and steps to follow when error occur. Input Design is the process of converting a user-oriented description of the input into a computer-based system. This design is important to avoid errors in the data input process and show the correct direction to the management for getting correct information from the computerized system. It is achieved by creating user-friendly screens for the data entry to handle large volume of data. The goal of designing input

20

is to make data entry easier and to be free from errors. The data entry screen is designed in such a way that all the data manipulates can be performed. It also provides record viewing facilities. When the data is entered it will check for its validity. Data can be entered with the help of screens. Appropriate messages are provided as when needed so that the user will not be in maize of instant. Thus the objective of input design is to create an input layout that is easy to follow. In this project, the input design consists of a log in screen, tab for compression/ decompression, source and destination browsing button, a menu list for selecting the algorithm, Compress/Decompress option, compress/decompress button.

5.3.5 OUTPUT DESIGN


A quality output is one, which meets the requirements of the end user and presents the information clearly. The objective of output design is to convey information about past activities, current status or projections of the future, signal important events, opportunities, problems, or warnings, trigger an action, confirm an action etc. Efficient, intelligible output design should improve the systems relationship with the user and helps in decisions making. In output design the emphasis is on displaying the output on a CRT screen in a predefined format. The primary consideration in design of output is the information requirement and objectives of the end users. The major formation of the output is to convey the information and so its layout and design need a careful consideration. There is an output display screen for showing the compressed/ decompressed file or folder details (Original file size, Compressed/Decompressed file size, distinct characters)

5.3.6 Database Design

21

A database is an organized mechanism that has the capability of storing information through which a user can retrieve stored information in an effective and efficient manner. The data is the purpose of any database and must be protected. The database design is a two level process. In the first step, user requirements are gathered together and a database is designed which will meet these requirements as clearly as possible. This step is called Information Level Design and it is taken independent of any individual DBMS. In the second step, this Information level design is transferred into a design for the specific DBMS that will be used to implement the system in question. This step is called Physical Level Design, concerned with the characteristics of the specific DBMS that will be used. A database design runs parallel with the system design. The organization of the data in the database is aimed to achieve the following two major objectives. Data Integrity Data independence

Normalization is the process of decomposing the attributes in an application, which results in a set of tables with very simple structure. The purpose of normalization is to make tables as simple as possible. Normalization is carried out in this system for the following reasons. To structure the data so that there is no repetition of data , this helps in saving. To permit simple retrieval of data in response to query and report request. To simplify the maintenance of the data through updates, insertions, deletions.

22

To reduce the need to restructure or reorganize data which new application requirements arise. RELATIONAL DATABASE MANAGEMENT SYSTEM (RDBMS): A relational model represents the database as a collection of relations. Each relation resembles a table of values or file of records. In formal relational model terminology, a row is called a tuple, a column header is called an attribute and the table is called a relation. A relational database consists of a collection of tables, each of which is assigned a unique name. A row in a tale represents a set of related values.

RELATIONS, DOMAINS & ATTRIBUTES:


A table is a relation. The rows in a table are called tuples. A tuple is an ordered set of n elements. Columns are referred to as attributes. Relationships have been set between every table in the database. This ensures both Referential and Entity Relationship Integrity. A domain D is a set of atomic values. A common method of specifying a domain is to specify a data type from which the data values forming the domain are drawn. It is also useful to specify a name for the domain to help in interpreting its values. Every value in a relation is atomic, that is not decomposable.

RELATIONSHIPS:
Table relationships are established using Key. The two main keys of prime importance are Primary Key & Foreign Key. Entity Integrity and Referential Integrity Relationships can be established with these keys. Entity Integrity enforces that no Primary Key can have null values. Referential Integrity enforces that no Primary Key can have null values.

23

Referential Integrity for each distinct Foreign Key value, there must exist a matching Primary Key value in the same domain. Other key are Super Key and Candidate Keys. Relationships have been set between every table in the database. This ensures both Referential and Entity Relationship Integrity.

24

NORMALIZATION:
As the name implies, it denoted putting things in the normal form. The application developer via normalization tries to achieve a sensible organization of data into proper tables and columns and where names can be easily correlated to the data by the user. Normalization eliminates repeating groups at data and thereby avoids data redundancy which proves to be a great burden on the computer resources. These includes: Normalize the data. Choose proper names for the tables and columns. Choose the proper name for the data.

First Normal Form:


The First Normal Form states that the domain of an attribute must include only atomic values and that the value of any attribute in a tuple must be a single value from the domain of that attribute. In other words 1NF disallows relations within relations or relations as attribute values within tuples. The only attribute values permitted by 1NF are single atomic or indivisible values. The first step is to put the data into First Normal Form. This can be done by moving data into separate tables where the data is of similar type in each table. Each table is given a Primary Key or Foreign Key as per requirement of the project. In this we form new relations for each nonatomic attribute or nested relation. This eliminated repeating groups of data. A relation is said to be in first normal form if only if it satisfies the constraints that contain the primary key only.

25

Second Normal Form:


According to Second Normal Form, For relations where primary key contains multiple attributes, no nonkey attribute should be functionally dependent on a part of the primary key. In this we decompose and setup a new relation for each partial key with its dependent attributes. Make sure to keep a relation with the original primary key and any attributes that are fully functionally dependent on it. This step helps in taking out data that is only dependant on apart of the key. A relation is said to be in second normal form if and only if it satisfies all the first normal form conditions for the primary key and every non-primary key attributes of the relation is fully dependent on its primary key alone.

Third Normal Form:


According to Third Normal Form, Relation should not have a nonkey attribute functionally determined by another nonkey attribute or by a set of nonkey attributes. That is, there should be no transitive dependency on the primary key. In this we decompose and set up relation that includes the nonkey attributes that functionally determines other nonkey attributes. This step is taken to get rid of anything that does not depend entirely on the Primary Key. A relation is said to be in third normal form if only if it is in second normal form and more over the non key attributes of the relation should not be depend on other non key attribute.

26

6. SYSTEM IMPLEMENTATION

The implementation phase of software development is concerned with translating design specifications into source code. The primary goal of implementation is to write source code and internal documentation so that conformance of the code to its specifications can be easily verified, and so that debugging, testing and modification are eased. This goal can be achieved by making the source code as clear and straightforward as possible.

27

7. SYSTEM TESTING

System testing is an investigation conducted to provide stakeholders with information about the quality of the product or service under test. Software testing can also provide an objective, independent view of the software to allow the business to appreciate and understand the risks of software implementation. Test techniques include, but are not limited to, the process of executing a program or application with the intent of finding software bugs (errors or other defects).

System testing can be stated as the process of validating and verifying that a computer program/application/product: meets the requirements that guided its design and development, works as expected, can be implemented with the same characteristics, and Satisfies the needs of stakeholders.

A primary purpose of testing is to detect software failures so that defects may be discovered and corrected. The scope of software testing often includes examination of code as well as execution of that code in various environments and conditions as well as examining the aspects of code: does it do what it is supposed to do and do what it needs to do.

28

UNIT TESTING
Unit testing comprises the set of tests performed by an individual programmer prior to integration of the unit into large system. The situation is illustrated as follows: Coding &debugging ------ unit testing ----- integration testing A program unit is usually small enough that the programmer who developed it can test it in great detail, and certainly in greater detail that will be possible when the unit is integrated into an evolving software product. There are four categories of test that a programmer will typically perform on a program unit : o Functional Test o Performance Test o Stress Test o Structure Test

Functional Test Functional test cases involve exercising the code with nominal input values for which the expected results are known, as well as boundary values.

Performance Test Performance testing determines the amount of execution time spent in various parts of the unit, program throughput, response time and device utilization by the program unit.

29

Integration testing Integration testing is any type of software testing that seeks to verify the interfaces between components against a software design. Software components may be integrated in an iterative way or all together ("big bang"). Normally the former is considered a better practice since it allows interface issues to be localised more quickly and fixed.

Integration testing works to expose defects in the interfaces and interaction between integrated components (modules). Progressively larger groups of tested software components corresponding to elements of the architectural design are integrated and tested until the software works as a system.

30

8. CONCLUSION

The Staff Management System module has met its objectives. The system has been thoroughly tested with varied test data and was found to be fit for implementation. The system reliability is high and enough securities have been provided.

The use of computerization has very little chance of committing any data entry error since it has enough validation check. The system is flexible and changes can be made without any difficulties. The system is tested with possible sample data before any valid data is inputted.

The system is quite useful for the new entrants to the computer and also experienced users. The system is user friendly and menu driven.

31

9. FUTURE ENHANCEMENT

In the future, the project may be enhanced in such a way that when the staff login to the system attendance for the staff can be made automatically. Additional features like biometric authentication while logging in can be done in the Staff Management System. Biometric techniques like fingerprint recognition, Iris recognition are most suitable for this staff management system. So adding the biometric authentication in place of login makes this project complete.

32

10. BIBLIOGRAPHY

1. Mastering Visual Basic 6.0 Evangelos Petroutsos

2. Using Microsoft Access 2000 Susan Sales Harkins, Tom Gerhart, Ken Hansen

3. Database Management Systems Alexis Leon, Mathews Leon

4. Software Engineering Richard E. Fairley

ONLINE REFERENCE:

www.w3schools.com www.theserverside.com www.visual.com

33

SCREEN SHOTS

Main Form

34

Department Entry

35

Employee Entry Form

36

37

Employee Attendance

38

Pay Slip Details

Report of Pay Slip

39

Attendance for particular day

40

41

Employee Details

42

Back up Files

SAMPLE CODING
Main Form Private Sub areport_Click(Index As Integer)

43

Attendence_report.Show End Sub Private Sub backup_Click(Index As Integer) backup_fm.Show End Sub Private Sub dentry_Click(Index As Integer) Department_entry.Show End Sub Private Sub eattandence_Click(Index As Integer) Attendence_entry.Show End Sub Private Sub eentry_Click(Index As Integer) Employee_entry.Show Employee_entry.add.SetFocus End Sub Private Sub empdetail_Click(Index As Integer) Employee_detail_report.Show End Sub Private Sub exit_Click(Index As Integer) End End Sub Private Sub monthly_pay_report_Click(Index As Integer)

44

pay_slip_report.Show End Sub Private Sub pay_slip_Click(Index As Integer) pay_slip_fm.Show End Sub

Department Form Option Explicit Dim cd3 As ADODB.Connection Dim rs3 As ADODB.Recordset Dim flagcheck As Boolean

45

Private Sub exit2_Click() Unload Me End Sub

Private Sub Form_Load() Set cd3 = New ADODB.Connection cd3.Provider = "Microsoft.Jet.OLEDB.4.0" cd3.Open App.Path & "\db1.mdb" Set rs3 = New ADODB.Recordset rs3.Open "select * from departmentname", cd3, adOpenStatic, adLockOptimistic

Frame1.Enabled = False Me.saved.Enabled = False Me.deleted.Enabled = False End Sub

Private Sub newd_Click() Frame1.Enabled = True flagcheck = False Me.dname.Enabled = True Me.dname.SetFocus

46

Me.saved.Enabled = True Me.deleted.Enabled = True dname.Clear If (rs3.RecordCount = 0) Then Else rs3.MoveFirst While (rs3.EOF = False) Me.dname.AddItem (rs3.Fields(0)) rs3.MoveNext Wend End If End Sub Private Sub saved_Click() If (rs3.RecordCount = 0) Then Else rs3.MoveFirst While (rs3.EOF = False) If (rs3.Fields(0) = Me.dname.Text) Then flagcheck = True End If rs3.MoveNext Wend

47

End If If flagcheck = True Then MsgBox "department is already in the database" Frame1.Enabled = False newd.SetFocus Else rs3.AddNew rs3.Fields(0) = Me.dname.Text rs3.Update MsgBox "record has been saved" Me.dname.Enabled = False End If Me.saved.Enabled = False End Sub

Private Sub deleted_Click() Me.dname.Enabled = True If rs3.RecordCount > 0 Then rs3.MoveFirst While (rs3.EOF = False) If (rs3.Fields(0) = Me.dname.Text) Then rs3.delete adAffectCurrent

48

MsgBox "record has been deleted" End If rs3.MoveNext Wend Me.dname.Clear Me.Frame1.Enabled = False Me.deleted.Enabled = False End If End Sub

Employee Form Option Explicit Dim cd As ADODB.Connection Dim rsd As ADODB.Recordset Dim rse As ADODB.Recordset Dim rsen As ADODB.Recordset Dim rssearch As ADODB.Recordset Dim rsnamesearch As ADODB.Recordset Dim count1 As Integer

49

Dim flagedit, flagsave As Integer

Private Sub Form_Load() Me.eentry.Enabled = False Me.searchframe.Visible = False Me.delete.Enabled = False Me.save.Enabled = False Me.delete.Enabled = False Me.edit.Enabled = False flagedit = False flagsave = False Set cd = New ADODB.Connection cd.Provider = "Microsoft.Jet.OLEDB.4.0;" cd.Open App.Path & "\db1.mdb"

Set rse = New ADODB.Recordset rse.Open "select * from employeeentry", cd, adOpenStatic, adLockOptimistic rse.Requery Set rsen = New ADODB.Recordset rsen.Open "select * from employeeentry", cd, adOpenStatic, adLockOptimistic rsen.Requery Me.dname.Text = ""

50

Me.ename.Text = "" Me.address.Text = "" Me.city.Text = "" Me.pincode.Text = "" Me.phno_r.Text = "" Me.salary.Text = "" Me.jdate.Value = Now Me.edu.Text = "" Me.remark.Text = "" End Sub

Private Sub add_Click() Me.searchframe.Visible = False Me.eentry.Visible = True Me.eentry.Enabled = True Me.edit.Enabled = False

flagedit = False flagsave = False Me.dname.Enabled = True Me.ename.Enabled = True Me.address.Enabled = True

51

Me.city.Enabled = True Me.pincode.Enabled = True Me.phno_r.Enabled = True Me.salary.Enabled = True Me.edu.Enabled = True Me.remark.Enabled = True Me.phno_o.Enabled = True Me.phno_m.Enabled = True Me.dname.SetFocus Me.delete.Enabled = False Me.save.Enabled = True Set rsd = New ADODB.Recordset rsd.Open "select * from departmentname", cd, adOpenStatic, adLockOptimistic If rsd.RecordCount = 0 Then MsgBox "NO record for department" Exit Sub End If count1 = 0 rsd.Requery

If KeyAscii > 26 Then ' if it's not a control code If InStr(a, Chr(KeyAscii)) = 0 Then

52

KeyAscii = 0 End If End If End Sub

Private Sub ename_lostfocus() Set rse = New ADODB.Recordset rse.Open "select * from employeeentry where ename='" & ename.Text & "'", cd, adOpenStatic, adLockOptimistic If rse.RecordCount > 0 Then MsgBox "THIS NAME IS ALREADY STORED!!!" ename.SetFocus End If End Sub

Private Sub city_keypress(KeyAscii As Integer) Dim a As String a = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" KeyAscii = Asc(Chr(KeyAscii)) If KeyAscii > 26 Then ' if it's not a control code If InStr(a, Chr(KeyAscii)) = 0 Then KeyAscii = 0

53

End If End If End Sub

Private Sub pincode_KeyPress(KeyAscii As Integer) Dim strValid7 As String strValid7 = "0123456789" KeyAscii = Asc(Chr(KeyAscii)) If KeyAscii > 26 Then ' if it's not a control code If InStr(strValid7, Chr(KeyAscii)) = 0 Then KeyAscii = 0 End If End If End Sub

Private Sub phno_r_KeyPress(KeyAscii As Integer) Dim strValid7 As String strValid7 = "0123456789()-" KeyAscii = Asc(Chr(KeyAscii)) If KeyAscii > 26 Then ' if it's not a control code If InStr(strValid7, Chr(KeyAscii)) = 0 Then KeyAscii = 0

54

End If End If End Sub

Private Sub phno_o_KeyPress(KeyAscii As Integer) Dim strValid7 As String strValid7 = "0123456789()-" KeyAscii = Asc(Chr(KeyAscii)) If KeyAscii > 26 Then ' if it's not a control code If InStr(strValid7, Chr(KeyAscii)) = 0 Then KeyAscii = 0 End If End If End Sub Me.address.Text = "" Me.city.Text = "" Me.pincode.Text = "" Me.phno_r.Text = "" Me.salary.Text = "" Me.edu.Text = "" Me.remark.Text = "" Me.phno_o.Text = ""

55

Me.phno_m.Text = "" Me.add.SetFocus Me.eentry.Enabled = False

End Sub

Private Sub delete_Click() Dim employee_no, i As Integer i = MsgBox("Do You Want To Delete This Employee Name:" + Me.lstename.List(Me.lstename.ListIndex) + "", vbQuestion + vbYesNo, "Deleting Record") If (i = vbYes) Then If rse.RecordCount <> 0 Then While (rse.EOF) If (Me.lstename.Text = rse.Fields(2)) Then rse.delete rse.Update MsgBox "record has been deleted" End If rse.MoveNext Wend Me.lbladdress.Text = ""

56

Me.lblcity.Text = "" Me.lblpincode.Text = "" Me.lblphno_r.Text = "" Me.lblsalary.Text = "" Me.lbljdate.Text = "" Me.lbledu.Text = "" Me.lblremark.Text = "" Me.lblphno_o.Text = "" Me.lblphno_m.Text = "" End If End If Me.delete.Enabled = False Me.edit.Enabled = False End Sub

Private Sub next_Click() Me.delete.Enabled = False Me.edit.Enabled = False Me.searchframe.Visible = False Me.eentry.Enabled = True Me.eentry.Visible = True If (rsen.RecordCount = 0) Then

57

MsgBox "No record" Exit Sub End If rsen.MoveNext If (rsen.EOF = True) Then rsen.MoveLast End If Me.dname.List(0) = rsen.Fields(0) Me.ename.Text = rsen.Fields(2) Me.address.Text = rsen.Fields(3) Me.city.Text = rsen.Fields(4) Me.pincode.Text = rsen.Fields(5) Me.phno_r.Text = rsen.Fields(6) Me.salary.Text = rsen.Fields(7) Me.jdate.Value = Format$(rsen.Fields(8), "dd/mm/yyyy") Me.edu.Text = rsen.Fields(9) Me.remark.Text = rsen.Fields(10) Me.phno_o.Text = rsen.Fields(11) Me.phno_m.Text = rsen.Fields(12)

Me.dname.Enabled = False Me.ename.Enabled = False

58

Me.address.Enabled = False Me.city.Enabled = False Me.pincode.Enabled = False Me.phno_r.Enabled = False Me.salary.Enabled = False Me.edu.Enabled = False Me.remark.Enabled = False Me.phno_o.Enabled = False Me.phno_m.Enabled = False End Sub

Private Sub edit_Click() flagedit = True flagsave = False Me.save.Enabled = True Me.delete.Enabled = False Me.eentry.Enabled = False Me.eentry.Visible = False Me.searchframe.Visible = True Me.Text1.Visible = True Me.Text1.Text = Me.lstename.List(Me.lstename.ListIndex) Me.lbladdress.Enabled = True

59

Me.lblcity.Enabled = True Me.lblpincode.Enabled = True Me.lblphno_r.Enabled = True Me.lblsalary.Enabled = True Me.lbljdate.Enabled = True Me.lbledu.Enabled = True Me.lblremark.Enabled = True Me.lblphno_o.Enabled = True Me.lblphno_m.Enabled = True Me.Text1.SetFocus End Sub

Private Sub exit_Click() Unload Me End Sub

Private Sub cmdsearch_Click() Me.searchframe.Visible = True Me.searchframe.Enabled = True Me.eentry.Visible = False Me.delete.Enabled = True Me.edit.Enabled = True

60

Me.save.Enabled = False Me.lstdname.SetFocus Me.lstdname.Clear Set rssearch = New ADODB.Recordset rssearch.Open "Select * from departmentname", cd, adOpenStatic, adLockOptimistic While (rssearch.EOF = False) Me.lstdname.AddItem (rssearch.Fields(0)) rssearch.MoveNext Wend End Sub

Private Sub lstdname_click() Set rsnamesearch = New ADODB.Recordset rsnamesearch.Open adLockOptimistic rsnamesearch.MoveFirst Me.lstename.Clear While (rsnamesearch.EOF = False) If (rsnamesearch.Fields(0) = lstdname.Text) Then Me.lstename.AddItem (rsnamesearch.Fields(2)) End If rsnamesearch.MoveNext "Select * from employeeentry ", cd, adOpenStatic,

61

Wend Me.lbladdress.Text = "" Me.lblcity.Text = "" Me.lblpincode.Text = "" Me.lblphno_r.Text = "" Me.lblsalary.Text = "" Me.lbljdate.Text = "" Me.lbledu.Text = "" Me.lblremark.Text = "" Me.lblphno_o.Text = "" Me.lblphno_m.Text = "" End Sub

Private Sub lstename_click() rsnamesearch.MoveFirst rsnamesearch.Requery While (rsnamesearch.EOF = False) If (rsnamesearch.Fields(2) = Me.lstename.Text) Then Me.lbladdress.Text = rsnamesearch.Fields(3) Me.lblcity.Text = rsnamesearch.Fields(4) Me.lblpincode.Text = rsnamesearch.Fields(5) Me.lblphno_r.Text = rsnamesearch.Fields(6)

62

Me.lblsalary.Text = rsnamesearch.Fields(7) Me.lbljdate.Text = Format$(rsnamesearch.Fields(8), "dd/mm/yyyy") Me.lbledu.Text = rsnamesearch.Fields(9) Me.lblremark.Text = rsnamesearch.Fields(10) Me.lblphno_o.Text = rsnamesearch.Fields(11) Me.lblphno_m.Text = rsnamesearch.Fields(12) End If rsnamesearch.MoveNext Wend Me.lbladdress.Enabled = False Me.lblcity.Enabled = False Me.lblpincode.Enabled = False Me.lblphno_r.Enabled = False Me.lblsalary.Enabled = False Me.lbljdate.Enabled = False Me.lbledu.Enabled = False Me.lblremark.Enabled = False Me.lblphno_o.Enabled = False Me.lblphno_m.Enabled = False End Sub

63

Attendance Form Option Explicit Dim cd2 As ADODB.Connection Dim rs2 As ADODB.Recordset Dim rsd As ADODB.Recordset Dim rse, rsf, rsg, rsh, rsi, rsj As ADODB.Recordset Dim flagsave As Boolean Dim flagedit As Boolean Dim flagsearch As Boolean Dim lunchtime, daytime, totaltime, thour, totalminute As Integer Dim la, da As Date Dim lb, db As Date Dim strlunchtime As String Dim count1 As Integer

Private Sub exit1_Click() Unload Me End Sub

Private Sub Form_Load() Set cd2 = New ADODB.Connection

64

cd2.Provider = "Microsoft.Jet.OLEDB.4.0" cd2.Open App.Path & "\db1.mdb" Set rs2 = New ADODB.Recordset rs2.Open "select * from attendenceentry", cd2, adOpenStatic, adLockOptimistic Me.aentry.Enabled = False Me.searchframe.Visible = False Me.save.Enabled = False flagsave = False flagedit = False flagsearch = False Set rsd = New ADODB.Recordset rsd.Open "select * from departmentname", cd2, adOpenStatic, adLockOptimistic Set rse = New ADODB.Recordset rse.Open "select * from employeeentry", cd2, adOpenStatic, adLockOptimistic While (rsd.EOF = False) Me.dname.AddItem (rsd.Fields("dname")) rsd.MoveNext Wend Me.DTPicker1.Value = Now Me.DTPicker2.Value = Now Me.atype.AddItem ("AB") Me.atype.AddItem ("P")

65

Me.atype.AddItem ("HOLYDAY") End Sub

Private Sub add_Click() Me.searchframe.Visible = False Me.aentry.Visible = True Me.aentry.Enabled = True Me.save.Enabled = True Me.atype.Enabled = False Me.dname.SetFocus flagedit = False End Sub

Private Sub dname_Click() Me.searchframe.Visible = False Me.ename.Clear rse.MoveFirst While (rse.EOF = False) If (rse.Fields(0) = dname.Text) Then Me.ename.AddItem (rse.Fields(2)) End If rse.MoveNext

66

Wend End Sub

Private Sub ename_Click() Me.searchframe.Visible = False Me.dstart.Text = "00:00:00 AM" Me.dend.Text = "00:00:00 AM" Me.lstart.Text = "00:00:00 AM" Me.lend.Text = "00:00:00 AM" If flagedit = True Then Set rsf = New ADODB.Recordset rsf.Open "select * from attendenceentry where date1='" & Format$ (DTPicker1.Value, "d/M/yyyy") & "' and ename='" & ename.Text & "'", cd2, adOpenStatic, adLockOptimistic rsf.Requery If rsf.RecordCount = 0 Then Else rsf.MoveFirst count1 = 0 While (count1 < rsf.RecordCount) If ((Me.ename.Text) = (rsf.Fields(2))) Then Me.atype.Text = rsf.Fields(4)

67

Me.avalue.Text = rsf.Fields(5) If rsf.Fields(6) = "12:00:00 AM" Then Me.dstart.Text = "00:00:00 AM" Else Me.dstart.Text = rsf.Fields(6) End If If rsf.Fields(7) = "12:00:00 AM" Then Me.dend.Text = "00:00:00 AM" Else Me.dend.Text = rsf.Fields(7) End If If rsf.Fields(8) = "12:00:00 AM" Then Me.lstart.Text = "00:00:00 AM" Else Me.lstart.Text = rsf.Fields(8) End If If rsf.Fields(9) = "12:00:00 AM" Then Me.lend.Text = "00:00:00 AM" Else Me.lend.Text = rsf.Fields(9) End If Me.totalhour.Text = rsf.Fields(10)

68

End If count1 = count1 + 1 rsf.MoveNext Wend End If End If Me.atype.Enabled = True End Sub

Private Sub DTPicker1_closeup() Me.searchframe.Visible = False If flagedit = True Then Set rsf = New ADODB.Recordset rsf.Open "select * from attendenceentry where date1='" & Format$ (DTPicker1.Value, "d/M/yyyy") & "' and ename='" & ename.Text & "' ", cd2, adOpenStatic, adLockOptimistic rsf.Requery If rsf.RecordCount = 0 Then Me.dstart.Text = "" Me.dend.Text = "" Me.lstart.Text = "" Me.lend.Text = ""

69

Else rsf.MoveFirst count1 = 0 While (count1 < rsf.RecordCount) If ((Me.ename.Text) = (rsf.Fields(2))) Then Me.atype.Text = rsf.Fields(4) Me.avalue.Text = rsf.Fields(5) If rsf.Fields(6) = "12:00:00 AM" Then Me.dstart.Text = "00:00:00 AM" Else Me.dstart.Text = rsf.Fields(6) End If If rsf.Fields(7) = "12:00:00 AM" Then Me.dend.Text = "00:00:00 AM" Else Me.dend.Text = rsf.Fields(7) End If If rsf.Fields(8) = "12:00:00 AM" Then Me.lstart.Text = "00:00:00 AM" Else Me.lstart.Text = rsf.Fields(8) End If

70

If rsf.Fields(9) = "12:00:00 AM" Then Me.lend.Text = "00:00:00 AM" Else Me.lend.Text = rsf.Fields(9) End If Me.totalhour.Text = rsf.Fields(10) End If count1 = count1 + 1 rsf.MoveNext Wend End If End If Me.atype.Enabled = True End Sub

Private Sub DTPicker1_change() Me.searchframe.Visible = False If flagedit = True Then Set rsf = New ADODB.Recordset rsf.Open "select * from attendenceentry where date1='" & Format$ (DTPicker1.Value, "d/M/yyyy") & "' and ename='" & ename.Text & "' ", cd2, adOpenStatic, adLockOptimistic

71

rsf.Requery If rsf.RecordCount = 0 Then Me.dstart.Text = "" Me.dend.Text = "" Me.lstart.Text = "" Me.lend.Text = "" Else rsf.MoveFirst count1 = 0 While (count1 < rsf.RecordCount) If ((Me.ename.Text) = (rsf.Fields(2))) Then Me.atype.Text = rsf.Fields(4) Me.avalue.Text = rsf.Fields(5) If rsf.Fields(6) = "12:00:00 AM" Then Me.dstart.Text = "00:00:00 AM" Else Me.dstart.Text = rsf.Fields(6) End If If rsf.Fields(7) = "12:00:00 AM" Then Me.dend.Text = "00:00:00 AM" Else Me.dend.Text = rsf.Fields(7)

72

End If If rsf.Fields(8) = "12:00:00 AM" Then Me.lstart.Text = "00:00:00 AM" Else Me.lstart.Text = rsf.Fields(8) End If If rsf.Fields(9) = "12:00:00 AM" Then Me.lend.Text = "00:00:00 AM" Else Me.lend.Text = rsf.Fields(9) End If Me.totalhour.Text = rsf.Fields(10) End If count1 = count1 + 1 rsf.MoveNext Wend End If End If Me.atype.Enabled = True End Sub

Private Sub DTPicker1_lostfocus()

73

Me.searchframe.Visible = False If flagedit = True Then Set rsf = New ADODB.Recordset rsf.Open "select * from attendenceentry where date1='" & Format$ (DTPicker1.Value, "d/M/yyyy") & "' and ename='" & ename.Text & "'", cd2, adOpenStatic, adLockOptimistic rsf.Requery If rsf.RecordCount = 0 Then Me.dstart.Text = "" Me.dend.Text = "" Me.lstart.Text = "" Me.lend.Text = "" Else rsf.MoveFirst count1 = 0 While (count1 < rsf.RecordCount) If ((Me.ename.Text) = (rsf.Fields(2))) Then Me.atype.Text = rsf.Fields(4) Me.avalue.Text = rsf.Fields(5) If rsf.Fields(6) = "12:00:00 AM" Then Me.dstart.Text = "00:00:00 AM" Else

74

Me.dstart.Text = rsf.Fields(6) End If If rsf.Fields(7) = "12:00:00 AM" Then Me.dend.Text = "00:00:00 AM" Else Me.dend.Text = rsf.Fields(7) End If If rsf.Fields(8) = "12:00:00 AM" Then Me.lstart.Text = "00:00:00 AM" Else Me.lstart.Text = rsf.Fields(8) End If If rsf.Fields(9) = "12:00:00 AM" Then Me.lend.Text = "00:00:00 AM" Else Me.lend.Text = rsf.Fields(9) End If Me.totalhour.Text = rsf.Fields(10) End If count1 = count1 + 1 rsf.MoveNext Wend

75

End If End If 'end of flag edit stat Me.dstart.SetFocus Me.atype.Enabled = True End Sub

Private Sub atype_click() If (dstart.Text = "00:00:00 AM" Or dstart.Text = "00:00:00 PM" Or dend.Text = "00:00:00 AM" Or dend.Text = "00:00:00 PM") Then Me.totalhour.Text = "" Else If (lstart.Text = "00:00:00 AM" Or lstart.Text = "00:00:00 PM" Or lend.Text = "00:00:00 AM" Or lend.Text = "00:00:00 PM") Then lunchtime = 0 Else la = Format$(lstart.Text, "HH:mm") lb = Format$(lend.Text, "HH:mm") lunchtime = DateDiff("n", la, lb) End If da = Format$(dstart, "HH:mm") db = Format$(dend, "HH:mm") daytime = DateDiff("n", da, db)

76

totaltime = daytime - lunchtime

thour = (totaltime / 60) totalminute = (totaltime Mod 60) strlunchtime = "" + Str(thour) + " h" + Str(totalminute) + " m" Me.totalhour.Text = strlunchtime End If End Sub

Private Sub atype_gotfocus() If (dstart.Text = "00:00:00 AM" Or dstart.Text = "00:00:00 PM" Or dend.Text = "00:00:00 AM" Or dend.Text = "00:00:00 PM") Then Me.totalhour.Text = "" Else If (lstart.Text = "00:00:00 AM" Or lstart.Text = "00:00:00 PM" Or lend.Text = "00:00:00 AM" Or lend.Text = "00:00:00 PM") Then lunchtime = 0 Else la = Format$(lstart.Text, "HH:mm") lb = Format$(lend.Text, "HH:mm") lunchtime = DateDiff("n", la, lb) End If

77

db = Format$(dstart, "HH:mm") db = Format$(dend, "HH:mm") daytime = DateDiff("n", da, db)

totaltime = daytime - lunchtime thour = (totaltime / 60) totalminute = (totaltime Mod 60) strlunchtime = "" + Str(thour) + " h" + Str(totalminute) + " m" Me.totalhour.Text = strlunchtime End If End Sub

Private Sub avalue_click() Me.searchframe.Visible = False End Sub Private Sub avalue_gotfocus() Me.searchframe.Visible = False Me.avalue.Clear Me.avalue.AddItem ("1") Me.avalue.AddItem ("0.5") End Sub

78

Private Sub save_Click() If Me.dname.Text = "" Then MsgBox "ENTER ENOUGH DATA!!!" Me.dname.SetFocus Exit Sub End If If Me.ename.Text = "" Then MsgBox "ENTER ENOUGH DATA!!!" Me.ename.SetFocus Exit Sub End If If Me.atype.Text = "" Then Me.atype.Text = "-" End If If Me.avalue.Text = "" Then Me.avalue.Text = "0" End If If Me.dstart.Text = "" Then Me.dstart.Text = "00:00:00 AM" End If If Me.dend.Text = "" Then Me.dend.Text = "00:00:00 AM"

79

End If If Me.lstart.Text = "" Then Me.lstart.Text = "00:00:00 AM" End If If Me.lend.Text = "" Then Me.lend.Text = "00:00:00 AM" End If

If Me.totalhour.Text = "" Then Me.totalhour.Text = "0" End If If Me.atype.Text = "AB" Or Me.atype.Text = "HOLYDAY" Then Me.dstart.Text = "00:00:00 AM" Me.dend.Text = "00:00:00 AM" Me.lstart.Text = "00:00:00 AM" Me.lend.Text = "00:00:00 AM" Me.avalue.Enabled = False Else Me.avalue.Enabled = True End If If flagedit = False Then Set rsg = New ADODB.Recordset

80

rsg.Open "select * from attendenceentry where date1='" & Format$ (DTPicker1.Value, "d/m/yyyy") & "' ", cd2, adOpenStatic, adLockOptimistic rsg.Requery If (rsg.RecordCount = 0) Then Else rsg.MoveFirst count1 = 0 While (count1 < rsg.RecordCount) If ((Me.ename.Text) = (rsg.Fields(2))) Then MsgBox "already in record" Me.add.SetFocus GoTo here End If count1 = count1 + 1 rsg.MoveNext Wend End If rs2.AddNew rs2.Fields(0) = Me.dname.Text rs2.Fields(2) = Me.ename.Text rs2.Fields(3) = Format$(Me.DTPicker1.Value, "dd/mmm/yyyy") rs2.Fields(4) = Me.atype.Text

81

rs2.Fields(5) = Me.avalue.Text rs2.Fields(6) = Me.dstart.Text rs2.Fields(7) = Me.dend.Text rs2.Fields(8) = Me.lstart.Text rs2.Fields(9) = Me.lend.Text rs2.Fields(10) = Me.totalhour.Text rs2.Fields(11) = Format$(Me.DTPicker1.Value, "dd/M/yyyy") rs2.Update MsgBox "record has been saved" Me.save.Enabled = False ElseIf flagedit = True Then Set rsh = New ADODB.Recordset

rsh.Open "select * from attendenceentry where date1='" & Format$ (DTPicker1.Value, "d/M/yyyy") & "' ", cd2, adOpenStatic, adLockOptimistic count1 = 0 rsh.Requery While (count1 < rsh.RecordCount) If ((Me.ename.Text) = (rsh.Fields(2))) Then rsh.delete End If count1 = count1 + 1

82

rsh.MoveNext Wend rs2.AddNew rs2.Fields(0) = Me.dname.Text rs2.Fields(2) = Me.ename.Text rs2.Fields(3) = Format$(Me.DTPicker1.Value, "dd/mmm/yyyy") rs2.Fields(4) = Me.atype.Text rs2.Fields(5) = Me.avalue.Text rs2.Fields(6) = Me.dstart.Text rs2.Fields(7) = Me.dend.Text rs2.Fields(8) = Me.lstart.Text rs2.Fields(9) = Me.lend.Text rs2.Fields(10) = Me.totalhour.Text rs2.Fields(11) = Format$(Me.DTPicker1.Value, "dd/M/yyyy") rs2.Update MsgBox "record has been saved" End If End Sub

Private Sub edit_Click() Me.searchframe.Visible = False Me.aentry.Visible = True

83

aentry.Enabled = True Me.save.Enabled = True flagedit = True Me.dname.SetFocus End Sub

Private Sub search_Click() Me.searchframe.Visible = True Me.aentry.Visible = False Me.save.Enabled = False Me.cmbename.Clear rsd.Requery If (rsd.RecordCount = 0) Then Else rsd.MoveFirst While (rsd.EOF = False) Me.cmbdname.AddItem (rsd.Fields(0)) rsd.MoveNext Wend End If Me.cmbdname.SetFocus End Sub

84

Private Sub cmbdname_click() Me.cmbename.Clear If (rsd.RecordCount = 0) Then Else rse.MoveFirst While (rse.EOF = False) If (rse.Fields(0) = cmbdname.Text) Then Me.cmbename.AddItem (rse.Fields(2)) End If rse.MoveNext Wend End If End Sub

Private Sub DTPicker2_CLOSEUP() flagsearch = False Set rsi = New ADODB.Recordset rsi.Open "select * from attendenceentry where date1='" & Format$(DTPicker2.Value, "d/M/yyyy") & "' and ename='" & cmbename.Text & "'", cd2, adOpenStatic, adLockOptimistic

85

rsi.Requery If (rsi.RecordCount = 0) Then Me.txtdstart.Text = "" Me.txtdend.Text = "" Me.txtlstart.Text = "" Me.txtlend.Text = "" Me.txtatype.Text = "" Me.txtavalue.Text = "" Else count1 = 0 While (count1 < rsi.RecordCount) If (Me.cmbename.Text = rsi.Fields(2)) Then Me.txtatype.Text = rsi.Fields(4) Me.txtavalue.Text = rsi.Fields(5) If rsi.Fields(6) = "12:00:00 AM" Then Me.txtdstart.Text = "00:00:00 AM" Else Me.txtdstart.Text = rsi.Fields(6) End If If rsi.Fields(7) = "12:00:00 AM" Then Me.txtdend.Text = "00:00:00 AM" Else

86

Me.txtdend.Text = rsi.Fields(7) End If

If rsi.Fields(8) = "12:00:00 AM" Then Me.txtlstart.Text = "00:00:00 AM" Else Me.txtlstart.Text = rsi.Fields(8) End If If rsi.Fields(9) = "12:00:00 AM" Then Me.txtlend.Text = "00:00:00 AM" Else Me.txtlend.Text = rsi.Fields(9) End If Me.txttotalhour.Text = rsi.Fields(10) flagsearch = True End If count1 = count1 + 1 rsi.MoveNext Wend End If End Sub

87

Private Sub DTPicker2_change() flagsearch = False Set rsi = New ADODB.Recordset rsi.Open "select * from attendenceentry where date1='" & Format$

(DTPicker2.Value, "d/M/yyyy") & "' and ename='" & cmbename.Text & "'", cd2, adOpenStatic, adLockOptimistic rsi.Requery If (rsi.RecordCount = 0) Then Me.txtdstart.Text = "" Me.txtdend.Text = "" Me.txtlstart.Text = "" Me.txtlend.Text = "" Me.txtatype.Text = "" Me.txtavalue.Text = "" Else count1 = 0 While (count1 < rsi.RecordCount) If (rsi.Fields(2) = Me.cmbename.Text) Then Me.txtatype.Text = rsi.Fields(4) Me.txtavalue.Text = rsi.Fields(5) If rsi.Fields(6) = "12:00:00 AM" Then Me.txtdstart.Text = "00:00:00 AM"

88

Else Me.txtdstart.Text = rsi.Fields(6) End If If rsi.Fields(7) = "12:00:00 AM" Then Me.txtdend.Text = "00:00:00 AM" Else Me.txtdend.Text = rsi.Fields(7) End If If rsi.Fields(8) = "12:00:00 AM" Then Me.txtlstart.Text = "00:00:00 AM" Else Me.txtlstart.Text = rsi.Fields(8) End If If rsi.Fields(9) = "12:00:00 AM" Then Me.txtlend.Text = "00:00:00 AM" Else Me.txtlend.Text = rsi.Fields(9) End If Me.txttotalhour.Text = rsi.Fields(10) flagsearch = True End If count1 = count1 + 1

89

rsi.MoveNext Wend End If End Sub

Private Sub DTPicker2_lostfocus() flagsearch = False Set rsi = New ADODB.Recordset rsi.Open "select * from attendenceentry where date1='" & Format$

(DTPicker2.Value, "d/M/yyyy") & "' and ename='" & cmbename.Text & "' ", cd2, adOpenStatic, adLockOptimistic

rsi.Requery If (rsi.RecordCount = 0) Then Me.txtdstart.Text = "" Me.txtdend.Text = "" Me.txtlstart.Text = "" Me.txtlend.Text = "" Me.txtatype.Text = "" Me.txtavalue.Text = "" Else count1 = 0

90

While (count1 < rsi.RecordCount) If (rsi.Fields(2) = Me.cmbename.Text) Then Me.txtatype.Text = rsi.Fields(4) Me.txtavalue.Text = rsi.Fields(5) If rsi.Fields(6) = "12:00:00 AM" Then Me.txtdstart.Text = "00:00:00 AM" Else Me.txtdstart.Text = rsi.Fields(6) End If If rsi.Fields(7) = "12:00:00 AM" Then Me.txtdend.Text = "00:00:00 AM" Else Me.txtdend.Text = rsi.Fields(7) End If If rsi.Fields(8) = "12:00:00 AM" Then Me.txtlstart.Text = "00:00:00 AM" Else Me.txtlstart.Text = rsi.Fields(8) End If If rsi.Fields(9) = "12:00:00 AM" Then Me.txtlend.Text = "00:00:00 AM" Else

91

Me.txtlend.Text = rsi.Fields(9) End If Me.txttotalhour.Text = rsi.Fields(10) flagsearch = True End If count1 = count1 + 1 rsi.MoveNext Wend End If End Sub

92

Pay slip Form Option Explicit Dim cd_pay As ADODB.Connection Dim rs_pay As ADODB.Recordset Dim rs_pay_save As ADODB.Recordset Dim rsd As ADODB.Recordset Dim rse As ADODB.Recordset Dim count1 As Integer Dim pr_day, ab_day, holy_day As Integer

Private Sub Form_Load() Set cd_pay = New ADODB.Connection cd_pay.Provider = "Microsoft.Jet.OLEDB.4.0" cd_pay.Open App.Path & "\db1.mdb" Me.Frame1.Enabled = False Me.cmd_save.Enabled = False End Sub

93

Private Sub cmd_add_Click() Me.Frame1.Enabled = True Me.cmd_save.Enabled = True

Set rsd = New ADODB.Recordset rsd.Open "select * from departmentname ", cd_pay, adOpenStatic, adLockOptimistic count1 = 0 rsd.Requery Me.L_dname.Clear While (count1 < rsd.RecordCount) Me.L_dname.AddItem (rsd.Fields(0)) count1 = count1 + 1 rsd.MoveNext Wend Me.L_dname.SetFocus End Sub

Private Sub L_dname_click() Set rse = New ADODB.Recordset rse.Open "select * from employeeentry ", cd_pay, adOpenStatic, adLockOptimistic count1 = 0

94

rse.Requery Me.L_ename.Clear While (count1 < rse.RecordCount) If rse.Fields("dname") = Me.L_dname.Text Then Me.L_ename.AddItem (rse.Fields(2)) End If count1 = count1 + 1 rse.MoveNext Wend Me.L_ename.SetFocus End Sub

Private Sub L_ename_click() Me.L_month.AddItem ("JANUARY") Me.L_month.AddItem ("FEBRUARY") Me.L_month.AddItem ("MARCH") Me.L_month.AddItem ("APRIL") Me.L_month.AddItem ("MAY") Me.L_month.AddItem ("JUN") Me.L_month.AddItem ("JULY") Me.L_month.AddItem ("AUGUST") Me.L_month.AddItem ("SEPTEMBER")

95

Me.L_month.AddItem ("OCTOBER") Me.L_month.AddItem ("NOVEMBER") Me.L_month.AddItem ("DECEMBER") Me.L_month.ListIndex = 0 Me.L_year.AddItem ("2005") Me.L_year.AddItem ("2006") Me.L_year.AddItem ("2007") Me.L_year.AddItem ("2008") Me.L_year.AddItem ("2009") Me.L_year.AddItem ("2010") Me.L_year.ListIndex = 0 End Sub

Private Sub L_month_click() Set rs_pay = New ADODB.Recordset rs_pay.Open "select ename,date1,date2,atype from attendenceentry where ename='" & L_ename.Text & " ' ", cd_pay, adOpenStatic, adLockOptimistic pr_day = 0 ab_day = 0 holy_day = 0 count1 = 0 rs_pay.Requery

96

While (count1 < rs_pay.RecordCount) If Month(rs_pay.Fields("date2")) = (Me.L_month.ListIndex + 1) And Year(rs_pay.Fields("date2")) = (Me.L_year.Text) Then If (rs_pay.Fields("atype")) = "P" Then pr_day = pr_day + 1 ElseIf (rs_pay.Fields("atype")) = "AB" Then ab_day = ab_day + 1 ElseIf (rs_pay.Fields("atype")) = "HOLYDAY" Then holy_day = holy_day + 1 End If End If count1 = count1 + 1 rs_pay.MoveNext Wend Me.T_prday.Text = pr_day Me.T_abday.Text = ab_day Me.T_holiday.Text = holy_day Me.T_wday.Text = pr_day + holy_day Set rse = New ADODB.Recordset rse.Open "select * from employeeentry where ename='" & L_ename.Text & "'", cd_pay, adOpenStatic, adLockOptimistic Me.T_salary.Text = (rse.Fields("salary") / 30) * (Me.T_wday.Text)

97

Me.T_salary.Text = Format(Me.T_salary.Text, "0.00") End Sub

Private Sub L_year_click() Set rs_pay = New ADODB.Recordset rs_pay.Open "select ename,date1,date2,atype from attendenceentry where ename='" & L_ename.Text & " ' ", cd_pay, adOpenStatic, adLockOptimistic pr_day = 0 ab_day = 0 holy_day = 0 count1 = 0 rs_pay.Requery While (count1 < rs_pay.RecordCount) If Month(rs_pay.Fields("date2")) = (Me.L_month.ListIndex + 1) And Year(rs_pay.Fields("date2")) = (Me.L_year.Text) Then If (rs_pay.Fields("atype")) = "P" Then pr_day = pr_day + 1 ElseIf (rs_pay.Fields("atype")) = "AB" Then ab_day = ab_day + 1 ElseIf (rs_pay.Fields("atype")) = "HOLYDAY" Then holy_day = holy_day + 1 End If

98

End If count1 = count1 + 1 rs_pay.MoveNext Wend Me.T_prday.Text = pr_day Me.T_abday.Text = ab_day Me.T_holiday.Text = holy_day Me.T_wday.Text = pr_day + holy_day Set rse = New ADODB.Recordset rse.Open "select * from employeeentry where ename='" & L_ename.Text & "'", cd_pay, adOpenStatic, adLockOptimistic Me.T_salary.Text = (rse.Fields("salary") / 30) * (Me.T_wday.Text) End Sub

Private Sub cmd_save_Click() Set rs_pay_save = New ADODB.Recordset rs_pay_save.Open "select * from pay_slip WHERE Dept_name='" & L_dname.Text & "' and Emp_name='" & L_ename.Text & "' AND Month1='" & L_month.Text & "' AND Year1='" & Me.L_year.Text & "'", cd_pay, adOpenStatic, adLockOptimistic If rs_pay_save.RecordCount = 0 Then rs_pay_save.AddNew rs_pay_save.Fields(0) = Me.L_dname.Text

99

rs_pay_save.Fields(1) = Me.L_ename.Text rs_pay_save.Fields(2) = Me.L_month.Text rs_pay_save.Fields(3) = Me.T_prday.Text rs_pay_save.Fields(4) = Me.T_abday.Text rs_pay_save.Fields(5) = Me.T_holiday.Text rs_pay_save.Fields(6) = Me.T_wday.Text rs_pay_save.Fields(7) = Me.T_salary.Text rs_pay_save.Fields(8) = Me.L_year.Text rs_pay_save.Update MsgBox "RECORD SAVED!!" Else MsgBox "RECORD IS ALREADY SAVED!!" End If End Sub

Private Sub cmd_exit_click() Unload Me End Sub

Private Sub cmd_print_Click() DataEnvironment1.rsCommand3.Open "Select * from pay_slip where Emp_name= '" & Me.L_ename.Text & "' AND Dept_name='" & Me.L_dname.Text & "' AND

100

Month1='" & Me.L_month.Text & "' AND year1='" & Me.L_year.Text & "' ", cd_pay, adOpenStatic, adLockOptimistic pay_slip.Refresh pay_slip.Show DataEnvironment1.rsCommand3.Close End Sub

Private Sub cleartext() Me.L_dname.Text = "" Me.L_ename.Text = "" Me.L_month.Text = "" Me.T_prday.Text = "" Me.T_abday.Text = "" Me.T_holiday.Text = "" Me.T_wday.Text = "" Me.T_salary.Text = "" End Sub

101

Attendance for Particular Day Dim ds5 As Connection Dim rs5 As Recordset Dim rs As Recordset Dim rse As Recordset Private Sub Form_Load() Set ds5 = New Connection ds5.Provider = "Microsoft.Jet.OLEDB.4.0" ds5.Open App.Path & "\db1.mdb" Me.print2.Enabled = False Me.Combomonth.AddItem ("JANUARY") Me.Combomonth.AddItem ("FEBRUARY") Me.Combomonth.AddItem ("MARCH") Me.Combomonth.AddItem ("APRIL") Me.Combomonth.AddItem ("MAY") Me.Combomonth.AddItem ("JUNE") Me.Combomonth.AddItem ("JULY") Me.Combomonth.AddItem ("AUGUST") Me.Combomonth.AddItem ("SUPTEMBER") Me.Combomonth.AddItem ("OCTOBER") Me.Combomonth.AddItem ("NOVEMBER") Me.Combomonth.AddItem ("DECEMBER")

102

Me.Comboyear.AddItem ("2005") Me.Comboyear.AddItem ("2006") Me.Comboyear.AddItem ("2007") Me.Comboyear.AddItem ("2008") Me.Comboyear.AddItem ("2009") Set rs = New ADODB.Recordset rs.Open "select * from departmentname", ds5, adOpenStatic, adLockOptimistic While (rs.EOF = False) Me.List1.AddItem (rs.Fields("dname")) rs.MoveNext Wend End Sub

Private Sub List1_Click() Set rse = New ADODB.Recordset rse.Open "select * from employeeentry", ds5, adOpenStatic, adLockOptimistic Me.List2.Clear rse.MoveFirst While (rse.EOF = False) If (rse.Fields(0) = List1.Text) Then Me.List2.AddItem (rse.Fields(2)) End If

103

rse.MoveNext Wend End Sub

Private Sub search2_Click() Set rs5 = New Recordset If SSTab1.Caption = "Daily" Then rs5.Open dname,ename,date1,atype,avalue,dstart,dend,lstart,lend,totalhour order by date1", ds5, adOpenStatic, adLockOptimistic If rs5.EOF Then MsgBox ("NO RECORDS FOUND FOR SELECTED DATE!") Else Set MSHFlexGrid2.DataSource = rs5 Me.print2.Enabled = True End If ElseIf SSTab1.Caption = "Monthly" Then m = Me.Combomonth.ListIndex + 1 rs5.Open dname,ename,date1,atype,avalue,dstart,dend,lstart,lend,totalhour "select from "select from

attendenceentry where date1 = '" & Format$(DTPicker1.Value, "d/M/yyyy") & "'

attendenceentry where month(date2) = '" & m & "' and year(date2) = '" & Comboyear.Text & "'And dname = '" & List1.Text & "' And ename = '" & List2.Text & "' order by date2", ds5, adOpenStatic, adLockOptimistic

104

If rs5.EOF Then MsgBox ("NO RECORDS FOUND FOR SELECTED DATE!") Else Set MSHFlexGrid2.DataSource = rs5 Me.print2.Enabled = True End If End If End Sub

Private Sub print2_Click() If SSTab1.Caption = "Daily" Then DataEnvironment1.rsCommand2.Open dname,ename,date1,atype,avalue,dstart,dend,lstart,lend,totalhour order by date1", ds5, adOpenStatic, adLockOptimistic While (Not DataEnvironment1.rsCommand2.EOF) If DataEnvironment1.rsCommand2.Fields("dstart") = "12:00:00 AM" Then DataEnvironment1.rsCommand2.Fields("dstart") = Null End If If DataEnvironment1.rsCommand2.Fields("lstart") = "12:00:00 AM" Then DataEnvironment1.rsCommand2.Fields("lstart") = Null End If If DataEnvironment1.rsCommand2.Fields("lend") = "12:00:00 AM" Then "Select from

attendenceentry WHERE date1='" & Format$(DTPicker1.Value, "d/M/yyyy") & "'

105

DataEnvironment1.rsCommand2.Fields("lend") = Null End If If DataEnvironment1.rsCommand2.Fields("dend") = "12:00:00 AM" Then DataEnvironment1.rsCommand2.Fields("dend") = Null End If DataEnvironment1.rsCommand2.MoveNext Wend attendence_detail.Refresh attendence_detail.Show attendence_detail.Refresh attendence_detail.Refresh DataEnvironment1.rsCommand2.Close Dim rs1 As ADODB.Recordset Set rs1 = New ADODB.Recordset rs1.Open dname,ename,date1,atype,avalue,dstart,dend,lstart,lend,totalhour order by date2 ", ds5, adOpenStatic, adLockOptimistic While (Not rs1.EOF) If IsNull(rs1.Fields("dstart")) Then rs1.Fields("dstart") = "12:00:00 AM" End If If IsNull(rs1.Fields("lstart")) Then "Select from

attendenceentry WHERE date1='" & Format$(DTPicker1.Value, "d/M/yyyy") & "'

106

rs1.Fields("lstart") = "12:00:00 AM" End If If IsNull(rs1.Fields("lend")) Then rs1.Fields("lend") = "12:00:00 AM" End If If IsNull(rs1.Fields("dend")) Then rs1.Fields("dend") = "12:00:00 AM" End If rs1.MoveNext Wend ElseIf SSTab1.Caption = "Monthly" Then ' for monthly report m = Me.Combomonth.ListIndex + 1 DataEnvironment1.rsCommand2.Open dname,eno,ename,date1,date2,atype,avalue,dstart,dend,lstart,lend,totalhour "select from

attendenceentry where month(date2) = '" & m & "' and year(date2) = '" & Comboyear.Text & "'And dname = '" & List1.Text & "' And ename = '" & List2.Text & "' order by date2", ds5, adOpenStatic, adLockOptimistic While (Not DataEnvironment1.rsCommand2.EOF) If DataEnvironment1.rsCommand2.Fields("dstart") = "12:00:00 AM" Then DataEnvironment1.rsCommand2.Fields("dstart") = Null End If If DataEnvironment1.rsCommand2.Fields("lstart") = "12:00:00 AM" Then DataEnvironment1.rsCommand2.Fields("lstart") = Null

107

End If If DataEnvironment1.rsCommand2.Fields("lend") = "12:00:00 AM" Then DataEnvironment1.rsCommand2.Fields("lend") = Null End If If DataEnvironment1.rsCommand2.Fields("dend") = "12:00:00 AM" Then DataEnvironment1.rsCommand2.Fields("dend") = Null End If DataEnvironment1.rsCommand2.MoveNext Wend attendence_detail.Refresh attendence_detail.Refresh attendence_detail.Show attendence_detail.Refresh attendence_detail.Refresh DataEnvironment1.rsCommand2.Close Dim rs As ADODB.Recordset Set rs = New ADODB.Recordset rs.Open "select * from attendenceentry where month(date2) = '" & m & "' and year(date2) = '" & Comboyear.Text & "'And dname = '" & List1.Text & "' And ename = '" & List2.Text & "'", ds5, adOpenStatic, adLockOptimistic While (Not rs.EOF) If IsNull(rs.Fields("dstart")) Then

108

rs.Fields("dstart") = "12:00:00 AM" End If If IsNull(rs.Fields("lstart")) Then rs.Fields("lstart") = "12:00:00 AM" End If If IsNull(rs.Fields("lend")) Then rs.Fields("lend") = "12:00:00 AM" End If If IsNull(rs.Fields("dend")) Then rs.Fields("dend") = "12:00:00 AM" End If rs.MoveNext Wend End If Me.print2.Enabled = False End Sub

Private Sub exit2_Click() Unload Me End Sub

109

Backup Form Option Explicit Dim FileSystemObject As Object Dim filename As String

110

Private Sub Command1_Click() Unload Me End Sub

Private Sub Form_Load() Me.Drive1.Refresh Me.Dir1.Refresh Me.Drive1.Refresh Me.textfile.Text = Format$(Now, "d-mm-YYYY") End Sub

Private Sub Dir1_Change() Me.txtpath.Text = "" & Dir1.Path End Sub Private Sub Drive1_Change() Dim d, fs As Object Set fs = CreateObject("Scripting.FileSystemObject") Set d = fs.getdrive(fs.getdrivename(Drive1.Drive)) If d.isready Then Dir1.Path = Drive1.Drive Dir1.SetFocus Else

111

MsgBox "DRIVE IS NOT READY!!" End If End Sub

Private Sub cmdbackup_Click() filename = "" + Me.txtpath.Text + "\" + Me.textfile.Text + ".mdb" Set FileSystemObject = CreateObject("Scripting.FileSystemObject") FileSystemObject.copyfile App.Path & "\db1.mdb", filename MsgBox "DATA IS SAVED " Me.Drive1.SetFocus End Sub

112

S-ar putea să vă placă și