You are on page 1of 105

Hardware Inventory System

Project work submitted in partial fulfillment of the requirements for the award of
the degree B.Sc (IT) Information Technology

By

Name: Isha sharma


Enrollment No: 1700700270

Project Guide

Mr. Rohit Sharma

2010- 2011

Annamalai University
Directorate of Distance Education
Annamalai Nagar
Tamil Nadu – 608002

1
BONAFIDE CERTIFICATE

Name : Isha Sharma


Enrollment No : 1700700270
Registration No : 170D10114P00187
Subject Code : 370
Title : Hardware Inventory System

This is to certify that this project entitled “Hardware Inventory System” is a


bonafide work done by Isha Sharma in partial fulfillment of the requirements for the
B.Sc (IT) degree during the academic year 2010 – 2011 is the original work of the
candidate.

_________________
Mr. Rohit Sharma
Project Guide

_______________ _________________
Internal Examiner External Examiner

2
ACKNOWELDGEMENT

I express my sincere thanks to Dr. Nageshwar Rao, the Director, Directorate of


Distance Education, Annamalai University who has given me the opportunity to purse
B.Sc (IT).

I would like to thank my guide Mr. Rohit Sharma for his encouragement and guidance,
which helped me in completing the project.

Thank you,

Isha Sharma
Enrollment No: 1700700270

3
Table of Contents

INTRODUCTION..............................................................................................................5

SYSTEM DESIGN.............................................................................................................7

TECHNICAL ANALYSIS.................................................................................................8

TECHNOLOGY USED .....................................................................................................9

FEASIBILITY STUDY....................................................................................................16

COST AND BENEFIT ANALYSIS................................................................................17

STRUCTURE OF DATABASE TABLES......................................................................18

SYSTEMS LIFE CYCLE.................................................................................................21

SYSTEM IMPLEMENTATION......................................................................................28

PROCEDURE TO RUN THE SOFTWARE...................................................................32

MAINTENANCE.............................................................................................................33

FUTURE SCOPE OF THE PROJECT.............................................................................37

PROJECT ESTIMATE.....................................................................................................38

SNAPSHOTS OF FORMS...............................................................................................43

SOURCE CODE...............................................................................................................66

BIBLIOGRAPHY & REFERENCES............................................................................104

4
INTRODUCTION

The business environment has change more in the last five years than it did over
the previous five decades. The pace of change continues to accelerate and
corporations and institutions around the world seek to revitalize, reinvent and resize in
an effort to position themselves for success in the 21st century. The business
environment has changed more in the last five years than it did over the previous five
decades. Additionally, future pressures are created by technology developments that
shorten many processes whether in production efficiencies the ability to respond to new
business of institutional needs and to judge market opportunities as they arise is crucial.
Successful companies today recognize that a high level of interaction and coordination
along the supply chain will be a key ingredient of their continued success. Enterprises
and institutions are continuously striving to improve themselves in the areas of quality,
time, increased satisfaction levels, performance and profitability. Tomorrow's winner will
be those enterprises and institution that can must effectively gather and quickly act
upon crucial information. Making informed decisions in this manner would enable
organizations to accomplish their growth and at the same time enable them to utilize the
information to competitive advantage.

Inventory control is all about the maintaining the records of customers, products
and bills of a shop in catchy way. In this project we have to login user name and
password, if our password is verified then we are allowed to enter into main menu. If our
password is not verified then access is not allowed. After verification it will display all
information about inventory in which we have customers record, various product
information, transactions, inventory report and information about user.

In customer record we have customer no., name of the customer telephone no.,
fax no., email and address of the customer. In this we can add, delete and save the
information about customers. We can visualize the previous and next customer
information.

5
In product record we have product name, availability of product and price on
which product is available. We can add, delete and count the quantity of product.

In transactions we have complete information about bills which include bill No.,
product name, quantity which remains in stock, price of product, quantity of product and
total amount of purchase. In inventory report we have all records of the product, which
include description, quantity and price of the product. We can add new user and new
user can use transactions.

6
SYSTEM DESIGN

We can define System Design as:

“It is the process of developing such a program that performs different functions
required to be present in the system and link them together to give a complete system
that will perform the desired operations.”

After the system has been analysis, the design stage begins. In the design
phase, the structure of the design for the proposed system is finalized. Structure of files,
database, input, output processes and screens (interfaces) are decided. Correct
designing of the system is very crucial. If we have a wrong design we won’t be able to
get a correct desired system.

System analysis is connected with the following objectives in mind:

 Identify the customer’s need.


 Evaluate the system concept for feasibility.
 Perform economic and technical analysis.
 Allocate function to software, hardware, people, database and other system
analysis.
 Establish cost and schedule constraints.
 Create a system definition that forms the foundation for all subsequent
engineering works.

7
TECHNICAL ANALYSIS

SOFTWARE ANALYSIS: To freeze the software requirement for this specific system,
we analyze few existing systems available in the market & shops. The factors we
considered in analyzing the software are:
• The response time to execute the user request.
• Database communication with the front end.
• Multi user support from database side.
• Easy availability of software.
• Less development time.
• Easy up gradation.
• Attractive User Interface.
• Easy to validate the input fields.
• Less source code writing.
• Easy to learn the tools.
• Compatible with hardware.
• Easy to access the system resources.
• Security.

HARDWARE ANALYSIS: To analyze the hardware requirement, we consulted few


software developers and considered the following factors:
• Compatibility with software and minimum cost.
• Minimum memory required to run the development software as well as the
application system we are going to develop.

HARDWARE REQUIREMENT: By considering the above factors we decided the


following hardware specification.
• Pentium IV – above.
• 512 MB RAM and above.
• 40 GB HDD.
• Keyboard and Mouse.
• 14” Color LCD.

8
• CD ROM

TECHNOLOGY USED

Application software required for the developments of the ‘Hardware Inventory


Software’ are:
(a) Visual Basic 6.0
(b) Microsoft Access

(a) VISUAL BASIC: This software comes in a CD which is having an executable file
which installs the visual basic software on the computer, which is used to create the
front end of the software. It gives a designer the option to design an attractive front-end.
Even if the computer is not installed with the Visual Basic software, the executable files
can be created.

REASONS FOR USING VISUAL BASIC:

Visual Basic (VB) is the third-generation event-driven programming


language and integrated development environment (IDE) from Microsoft for its
COM programming model. VB is also considered a relatively easy to learn and use
programming language, because of its graphical development features and BASIC
heritage.

Visual Basic was derived from BASIC and enables the rapid application
development (RAD) of graphical user interface (GUI) applications, access to
databases using Data Access Objects DAO, Remote Data Objects RDO, or ActiveX
Data Objects ADO, and creation of ActiveX controls and objects. Scripting languages
such as VBA and VBScript are syntactically similar to Visual Basic, but perform
differently.

A programmer can put together an application using the components provided


with Visual Basic itself. Programs written in Visual Basic can also use the Windows API,
but doing so requires external function declarations.

LANGUAGE FEATURES:

9
Like the BASIC programming language, Visual Basic was designed to be easy to
learn and use. 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.

Although programs can be compiled into native code executables from version
5 onwards, they still require the presence of runtime libraries of approximately 1 MB in
size. This runtime is included by default in Windows 2000 and later, but for earlier
versions of Windows like 95/98/NT it must be distributed together with the executable.

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. For example, code can be inserted into the form resize
event handler to reposition a control so that it remains centered on the form, expands to
fill up the form, etc. By inserting code into the event handler for a keypress in a text box,
the program can automatically translate the case of the text being entered, or even
prevent certain characters from being inserted.

Visual Basic can create executables (EXE files), ActiveX controls, DLL files, but
is primarily used to develop Windows applications and to interface web database
systems. Dialog boxes with less functionality can be used to provide pop-up capabilities.
Controls provide the basic functionality of the application, while programmers can insert
additional logic within the appropriate event handlers. For example, a drop-down
combination box will automatically display its list and allow the user to select any
element. An event handler is called when an item is selected, which can then execute
additional code created by the programmer to perform some action based on which
element was selected, such as populating a related list.

10
Alternatively, a Visual Basic component can have no user interface, and instead
provide ActiveX objects to other programs via Component Object Model (COM). This
allows for server-side processing or an add-in module.

The language is garbage collected using reference counting, has a large library
of utility objects, and has basic object oriented support. Since the more common
components are included in the default project template, the programmer seldom needs
to specify additional libraries. Unlike many other programming languages, Visual Basic
is generally not case sensitive, although it will transform keywords into a standard case
configuration and force the case of variable names to conform to the case of the entry
within the symbol table entry. String comparisons are case sensitive by default, but can
be made case insensitive if so desired.

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
DLL's) and threading models.

CHARACTERISTICS PRESENT IN VISUAL BASIC:

Visual Basic has the following traits which differ from C-derived languages:

Boolean constant True has numeric value −1.[3] This is because the Boolean
data type is stored as a 16-bit signed integer. In this construct −1 evaluates to 16 binary
1s (the Boolean value True), and 0 as 16 0s (the Boolean value False). This is apparent
when performing a Not operation on a 16 bit signed integer value 0 which will return the
integer value −1, in other words True = Not False. This inherent functionality becomes
especially useful when performing logical operations on the individual bits of an integer
such as And, Or, Xor and Not. This definition of True is also consistent with BASIC
since the early 1970s Microsoft BASIC implementation and is also related to the
characteristics of CPU instructions at the time.

Logical and bitwise operators are unified. This is unlike some C-derived
languages (such as Perl), which have separate logical and bitwise operators. This again
is a traditional feature of BASIC.

Variable array base, Arrays are declared by specifying the upper and lower
bounds in a way similar to Pascal and FORTRAN. It is also possible to use the Option
11
Base statement to set the default lower bound. Use of the Option Base statement can
lead to confusion when reading Visual Basic code and is best avoided by always
explicitly specifying the lower bound of the array. This lower bound is not limited to 0 or
1, because it can also be set by declaration. In this way, both the lower and upper
bounds are programmable. In more subscript-limited languages, the lower bound of the
array is not variable. This uncommon trait does exist in Visual Basic .NET but not in
VBScript.

OPTION BASE was introduced by ANSI, with the standard for ANSI Minimal BASIC in
the late 1970s.

Relatively strong integration with the Windows operating system and the
Component Object Model.

Banker's rounding as the default behavior when converting real numbers to


integers with the Round function.

Integers are automatically promoted to reals in expressions involving the normal


division operator (/) so that division of an odd integer by an even integer produces the
intuitively correct result. There is a specific integer divide operator (\) which does
truncate.

By default, if a variable has not been declared or if no type declaration character


is specified, the variable is of type Variant. However this can be changed with Deftype
statements such as DefInt, DefBool, DefVar, DefObj, DefStr. There are 12 Deftype
statements in total offered by Visual Basic 6.0. The default type may be overridden for a
specific declaration by using a special suffix character on the variable name (# for
Double, ! for Single, & for Long, % for Integer, $ for String, and @ for Currency) or using
the key phrase As (type). VB can also be set in a mode that only explicitly declared
variables can be used with the command Option Explicit.

12
(b) MICROSOFT ACCESS: This software is bundled with the Microsoft office suit. It
can be used to create a backend. By this a simple table can be created and the format
of the table is stored to the location, which is assigned in the executable file.

Thus, the combination of the both the software make the project work in the
desired manner.

Reasons for using Microsoft Access:

Microsoft Access is a relational database management system from Microsoft


that combines the relational Microsoft Jet Database Engine with a graphical user
interface and software development tools. It is a member of the Microsoft Office suite of
applications and is included in the Professional and higher versions for Windows and
also sold separately. There is no version for MacOS or for Microsoft Office Mobile.

Access stores data in its own format based on the Access Jet Database Engine.
It can also import or link directly to data stored in other Access databases, Excel,
SharePoint lists, text, XML, Outlook, HTML, dBase, Paradox, Lotus 1-2-3, or any
ODBC-compliant data container including Microsoft SQL Server, Oracle, MySQL and
PostgreSQL. Software developers and data architects can use it to develop application
software and non-programmer "power users" can use it to build simple applications. It
supports some object-oriented techniques but falls short of being a fully object-oriented
development tool.

Features of Microsoft Access:

Microsoft Access is known for its ability to empower non-professional developers


to create database applications on their own. Users can easily 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.

The original concept of Access was for end users to be able to “access” data
from any source. Access offers the ability to import and export 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,

13
querying, editing, and reporting. This allows the existing data to change and the Access
platform to always use the latest data. It can even perform heterogeneous joins
between data sets stored across different platforms. Access is often used by people
downloading data from enterprise level databases for manipulation, analysis, and
reporting locally.

A significant strength of Microsoft Access is its Jet Database format (MDB or


ACCDB in Access 2007) which can contain the application and data in one file. This
makes it very convenient to distribute the entire application to another user, who can run
it in disconnected environments.

One of the benefits of Access from a programmer's perspective is its relative


compatibility with SQL (structured query language) — queries can be viewed graphically
or edited as SQL statements, and SQL statements can be used directly in Macros and
VBA Modules to manipulate Access tables. Users can mix and use both VBA and
"Macros" for programming forms and logic and offers object-oriented possibilities. VBA
can also be included in queries.

Microsoft Access offers parameterized queries. These queries and Access tables
can be referenced from other programs like VB6 and .NET through DAO or ADO. From
Microsoft Access, VBA can reference parameterized stored procedures via ADO.

SQL Express or MSDE (Microsoft SQL Server Desktop Engine) 2000, a scaled
down version of Microsoft SQL Server 2000, has been a free download for a decade
and may be used with Access as an alternative to the Jet Database Engine.

Microsoft Access is a file server based database. Unlike client server RDBMS,
Microsoft Access does not implement database triggers, stored procedures, or
transaction logging.

In ADP files (supported in Access 2000 and later), the database-related features
are geared more towards a client-server architecture with MSDE or Microsoft SQL
Server serving as the back-end instead of using the Jet Engine. Thus, it supports the
creation of nearly all objects in the underlying server (tables with constraints and
triggers, views, stored procedures and UDF-s). However, only forms, reports, macros
and modules are stored in the ADP file (the other objects are stored in the back-end

14
database). This centralization of queries and tables in the database server offers a more
restrictive environment which appeals to certain missions.

The advantage of an ADP is that it supports the direct creation and editing of
SQL Server tables, views, and stored procedures. The disadvantage compared to the
native Access database is the inability to keep temporary tables (the ADP cannot store
local tables) or link to data from other sources. By definition, this eliminates the ability to
query across different data sources. As a result of these limitations and improvements
to the native Access database, Microsoft is recommending the use of linked tables in
Access for getting to SQL Server data rather than ADPs.

15
FEASIBILITY STUDY

 TECHNICAL FEASIBILITY:

All out of file or misfiled conditions should be eliminated.

 OPERATIONAL FEASIBILITY:

Multiple users should have access to the same information simultaneously.

 LEGAL FEASIBILITY:

1. Labor Saving:

Fewer personnel should be able to retrieve more information in less time,


providing greater productivity per employee.

2. Storage Capacity:

The system should be large enough to allow unlimited expansion.

3. Future Flexibility:

The system should be capable to adding more files in the event of future
Growths.

4. Instant Access:

Increase the productivity by creating instant access to the data.

16
COST AND BENEFIT ANALYSIS

1. Hardware Cost:

The project does not require special high performance system. Any system
having windows XP will serve the purpose. Thus no additional cost for hardware is
required.

2. Personnel Cost:

Cost incurred during the development of the program is one time cost and is
labeled development cost. Once the system id installed the cost of operating and
maintaining the system become recurring cost. This program doesn’t need specialized
person to operate; any one who can operate pc can operate this software.

3. Facility Cost:

It does not need any extra facility to be created.

4. Operating Cost:

Operating cost includes only stationery items and the ink of printer.

17
STRUCTURE OF DATABASE TABLES

This inventory system uses following Database Tables build in MS ACCESS. The
following is the layout of these tables:-

 CUSTOMER TABLE

This table is to store the details about the customer.

Its layout is as follows:

Field Name Data Type Description


Custno Integer Customer No.
Name Text Customer Name
Telno Text Customer’s Telephone No.
Faxno Text Customer’s Fax No.
Email Text Customer’s E-Mail Address
Add Text Customer’s Address

 Login

This table is to store the details of users.

Its layout is as follows:

Field Name Data Type Description


Username Text User Name
Password Text Password

18
 Item Table

This table is to store the details of items i.e. unit, quantity, price and total amount
of the particular item.
Its layout is as follows:

Field Name Data Type Description


Item Text Item Name
Unit Text Unit of Measurement
Quantity Text Opening Quantity
Price Double Price of Item per unit
Amount Double Opening Amount of Item

 Daybook Table

This table is to store the details of Transactions.


Its layout is as follows:

Field Name Data Type Description


Trans_no Integer Transaction Number
Date Text Date of Transaction
Bill No. Text Bill Number
Customer Text Customer Name
Transaction_Type Text Transaction Type like
Sale or Purchase
Item Text Item Name
Quantity Integer Quantity of Transaction
Price Double Price per unit
Freight Single Freight Charged
Total Double Total bill amount

19
 Stock Table

This table is to store the details of items held in stock.


Its layout is as follows:

Field Name Data Type Description


Item Text Item Name
Quantity Integer Quantity
Total Double Total amount

20
SYSTEMS LIFE CYCLE

Systems Development Life Cycle (SDLC), or Software Development Life


Cycle, in systems engineering and software engineering refers to the process of
creating or altering systems, and the models and methodologies that people use to
develop these systems. The concept generally refers to computer or information
systems.

In software engineering the SDLC concept underpins many kinds of software


development methodologies. These methodologies form the framework for planning and
controlling the creation of an information system.

Overview of SDLC:

Systems Development Life Cycle (SDLC) is any logical process used by a


systems analyst to develop an information system, including requirements, validation,
training, and user ownership. An SDLC should result in a high quality system that meets
or exceeds customer expectations, reaches completion within time and cost estimates,
works effectively and efficiently in the current and planned Information Technology
infrastructure, and is inexpensive to maintain and cost-effective to enhance.

Computer systems have become more complex and often (especially with the
advent of Service-Oriented Architecture) link multiple traditional systems potentially
supplied by different software vendors. To manage this level of complexity, a number of
system development life cycle (SDLC) models have been created: "waterfall,"
"fountain," "spiral," "build and fix," "rapid prototyping," "incremental," and "synchronize
and stabilize." Although the term SDLC can refer to various models, it typically denotes
a waterfall methodology.

In project management a project has both a life cycle and a "systems


development life cycle," during which a number of typical activities occur. The project
life cycle (PLC) encompasses all the activities of the project, while the systems
development life cycle focuses on realizing the product requirements.

21
Systems Development Phases:

Systems Development Life Cycle (SDLC) adheres to important phases that are
essential for developers, such as planning, analysis, design, and implementation,
and are explained in the section below. There are several Systems Development Life
Cycle Models in existence. The oldest model, that was originally regarded as "the
Systems Development Life Cycle" is the waterfall model: a sequence of stages in
which the output of each stage becomes the input for the next. These stages generally
follow the same basic steps but many different waterfall methodologies give the steps
different names and the number of steps seems to vary between 4 and 7. There is no
definitively correct Systems Development Life Cycle model, but the steps can be
characterized and divided in several steps

Model of the Systems Development Life Cycle with the Maintenance bubble highlighted.

22
Initiation/Planning:

To generate a high-level view of the intended project and determine the goals of
the project. The feasibility study is sometimes used to present the project to upper
management in an attempt to gain funding. Projects are typically evaluated in three
areas of feasibility: economical, operational, and technical. Furthermore, it is also used
as a reference to keep the project on track and to evaluate the progress of the MIS
team. The MIS is also a complement of those phases. This phase is also called the
analysis phase.

Requirements Gathering and Analysis:

The goal of systems analysis is to determine where the problem is in attempt to


fix the system. This step involves breaking down the system in different pieces and
drawing diagrams to analyze the situation. Analysts project goals, breaking down
functions that need to be created, and attempt to engage users so that definite
requirements can be defined.

Design:

In systems design functions and operations are described in detail, including


screen layouts, business rules, process diagrams and other documentation. The output
of this stage will describe the new system as a collection of modules or subsystems.

Build or Coding:

Modular and subsystem programming code will be accomplished during this


stage. Unit testing and module testing are done in this stage by the developers. This
stage is intermingled with the next in that individual modules will need testing before
integration to the main project. Planning in software life cycle involves setting goals,
defining targets, establishing schedules, and estimating budgets for an entire software
project.

Testing:

The code is tested at various levels in software testing. Unit, system and user
acceptance testing are often performed. This is a grey area as many different opinions

23
exist as to what the stages of testing are and how much if any iteration occurs. Iteration
is not generally part of the waterfall model, but usually some occurs at this stage.

Types of testing:

 Data set testing


 Unit testing
 System testing
 Integration testing
 Black box testing
 White box testing
 Module testing
 Regression testing
 Automation testing
 User acceptance testing

Operations and Maintenance:

The deployment of the system includes changes and enhancements before the
decommissioning or sunset of the system. Maintaining the system is an important
aspect of SDLC. As key personnel change positions in the organization, new changes
will be implemented, which will require system updates.

24
Systems Development Life Cycle Phases

Context Diagram:

A System Context Diagram (SCD) in software engineering and systems engineering are
diagrams that represent all external entities that may interact with a system.

System Context Diagram are diagrams used in systems design to represent all external
entities that may interact with a system. The objective of a system context diagram is to focus
attention on external factors and events that should be considered in developing a complete set
of system requirements and constraints.

System context diagram are related to Data Flow Diagram, and show the interactions
between a system and other actors with which the system is designed to interface. System
context diagrams can be helpful in understanding the context which the system will be part of.

25
Context diagrams are used early in a project to get agreement on the scope under investigation.
Context diagrams are typically included in a requirements document. These diagrams must be
read by all project stakeholders and thus should be written in plain language, so the
stakeholders can understand items within the document.

Context diagrams are typically drawn using:

 Labeled boxes to represent each of the external entities and


 Another labeled box to represent the system being developed.
 Relationship is drawn as a line between the entities and the system being developed.
 Relationships are labeled with a subject-verb-object format.

ECB Context Diagram

Program / Project Accounts Receivable


Development

Govt authorities Checks / DD


to track progress submitted to
of project Accounts
development

Registrations / Establishment
NOC / Public Hearing

State and Region


offices will be
informed as soon
as application is Payment
submitted and is received, all dues
from their and pending
respective area paper work
Audit findings are completed,
updated in the facilities
application form schedules site
establishment

State and Region team

Audit report goes


to state and
region offices Facilities will Facilities Scheduling
work with Audit
and QA groups to
Audit and QA control monitor the site

26
Data Flow Diagram:

A data-flow diagram (DFD) is a graphical representation of the "flow" of data


through an information system. It differs from the flowchart as it shows the data flow
instead of the control flow of the program.

A data-flow diagram can also be used for the visualization of data processing
(structured design).

It is common practice to draw a context-level data flow diagram first which shows
the interaction between the system and outside entities. The DFD is designed to show
how a system is divided into smaller portions and to highlight the flow of data between
those parts. This context-level data-flow diagram is then "exploded" to show more detail
of the system being modeled.

Data-flow diagrams (DFDs) are one of the three essential perspectives of the
structured-systems analysis and design method SSADM. The sponsor of a project and
the end users will need to be briefed and consulted throughout all stages of a system's
evolution. With a data-flow diagram, users are able to visualize how the system will
operate, what the system will accomplish, and how the system will be implemented. The
old system's dataflow diagrams can be drawn up and compared with the new system's
data-flow diagrams to draw comparisons to implement a more efficient system. Data-
flow diagrams can be used to provide the end user with a physical idea of where the
data they input ultimately has an effect upon the structure of the whole system from
order to dispatch to report. How any system is developed can be determined through a
data-flow diagram. Developing a data-flow diagram helps in identifying the transaction
data in the data model.

Data Flow Diagram (DFD) example

Database Input System Output Customer

27
SYSTEM IMPLEMENTATION

System Requirements for Visual Basic Applications:

The following hardware and software is required for Visual Basic applications:

 Pentium® 90MHz or higher microprocessor.

 VGA 640x480 or higher-resolution screen supported by Microsoft Windows.

 Microsoft Windows NT 4.0 or later or Microsoft Windows 95 or later.

 24 MB RAM for Windows 95/98, 32 MB for Windows NT.

 Microsoft Internet Explorer version 4.01 or later (version 4.01 Service Pack 1 or
later for DHTML application developers, and 4.x for end-users of these
applications).

 Disk space requirements:

• Standard Edition: typical installation 48 MB, full installation 80 MB.

• Professional Edition: typical installation 48 MB, full installation 80 MB.

• Enterprise Edition: typical installation 128 MB, full installation 147 MB.

• Additional components (if required): MSDN (for documentation): 67 MB,


Internet Explorer 4.x: approximately 66 MB.

• CD-ROM (no MS-DOS support assumed).

System Requirements for Microsoft Access Applications:

The recommended system configuration to use Access 2002 is Microsoft


Windows XP Professional on a personal computer with a Pentium III processor and 128
megabytes (MB) of RAM. Below are the minimum requirements your computer needs to
run Access 2002.

 Pentium® 133 megahertz (MHz) or higher microprocessor.

 Super VGA (800 × 600) or higher-resolution monitor with 256

28
 Windows 98, Windows 98 Second Edition, Windows Millennium Edition
(Windows Me), Windows NT 4.0 with Service Pack 6 (SP6) or later,1 Windows
2000, or Windows XP or later.

 RAM requirements for Access 2002 depend on the operating system used:

 Microsoft Windows 98, or Microsoft Windows 98 Second Edition

24 MB of RAM plus an additional 8 MB of RAM for Access

 Microsoft Windows Me, or Microsoft Windows NT

32 MB of RAM plus an additional 8 MB of RAM for Access

 Microsoft Windows 2000 Professional

64 MB of RAM plus an additional 8 MB of RAM for Access

Windows XP Professional, or Microsoft Windows XP Home Edition

128 MB of RAM plus an additional 8 MB of RAM for Access

 Microsoft Internet Explorer version 4.01 or later (version 4.01 Service Pack 1 or
later for DHTML application developers, and 4.x for end-users of these
applications).

 Disk space requirements: Hard disk space requirements will vary depending on
configuration; custom installation choices may require more or less. Listed below
is the minimum hard disk requirement for Access:

 170 MB of available hard disk space

 An additional 115 MB is required on the hard disk where the operating system is
installed. Users without Windows XP, Windows 2000, Windows Me, or Office
2000 Service Release 1 (SR-1) require an extra 50 MB of hard disk space for
System Files Update.

 CD-ROM (no MS-DOS support assumed).

Justification:

Like the BASIC programming language, Visual Basic was designed to be easy to
learn and use. The language not only allows programmers to create simple GUI
applications, but can also develop complex applications. Programming in VB is a

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

Although programs can be compiled into native code executables from version
5 onwards, they still require the presence of runtime libraries of approximately 1 MB in
size. This runtime is included by default in Windows 2000 and later, but for earlier
versions of Windows like 95/98/NT it must be distributed together with the executable.

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. For example, code can be inserted into the form resize
event handler to reposition a control so that it remains centered on the form, expands to
fill up the form, etc. By inserting code into the event handler for a keypress in a text box,
the program can automatically translate the case of the text being entered, or even
prevent certain characters from being inserted.

Visual Basic can create executables (EXE files), ActiveX controls, DLL files, but
is primarily used to develop Windows applications and to interface web database
systems. Dialog boxes with less functionality can be used to provide pop-up capabilities.
Controls provide the basic functionality of the application, while programmers can insert
additional logic within the appropriate event handlers. For example, a drop-down
combination box will automatically display its list and allow the user to select any
element. An event handler is called when an item is selected, which can then execute
additional code created by the programmer to perform some action based on which
element was selected, such as populating a related list.

30
Alternatively, a Visual Basic component can have no user interface, and instead
provide ActiveX objects to other programs via Component Object Model (COM). This
allows for server-side processing or an add-in module.

The language is garbage collected using reference counting, has a large library
of utility objects, and has basic object oriented support. Since the more common
components are included in the default project template, the programmer seldom needs
to specify additional libraries. Unlike many other programming languages, Visual Basic
is generally not case sensitive, although it will transform keywords into a standard case
configuration and force the case of variable names to conform to the case of the entry
within the symbol table entry. String comparisons are case sensitive by default, but can
be made case insensitive if so desired.

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
DLL's) and threading models.

31
PROCEDURE TO RUN THE SOFTWARE

The EXE file for the Hardware Inventory can be created and the software can be
made platform independent. The database is required to be copied on the
D:\INVENTORY folder namely ‘project1’ and the software is ready for use. The
corresponding tables are created and stored in MS Access namely ‘project1’.

32
MAINTENANCE

Maintenance is necessary because requirements of users change, changes in


the policies and procedures of institute, laws change etc. We must change the program
so that they remain viable programs, to be more specific we should timely upgrade the
software so that it should cater to the needs of maximum users efficiently and
effectively.

We can define maintenance as term used for the updating after program is in
use. It is said that program is written once and modified many times. The more we
perform maintenance, the more likely that the program will up-to-date and in use.

We will maintain our software by implementing few facilities provisions, updating,


software, codes, according to the periodic user requirement audits.

BACKUP AND RECOVERY:

Backup and recovery procedures protect your database against data loss and
reconstruct the data, should loss occur. The reconstructing of data is achieved through
media recovery, which refers to the various operations involved in restoring, rolling
forward, and rolling back a backup of database files.

A backup is a copy of data. This copy can include important parts of the
database, such as the control file and datafiles. A backup is a safeguard against
unexpected data loss and application errors. If you lose the original data, then you can
reconstruct it by using a backup.

To backup database files including tables, Microsoft Access has an inbuilt utility
called “Back up Database”. Use this from the File Menu and backup the database.

You can restore an entire database, or you can selectively restore objects in a
database.

When you restore an entire database, you replace a database file that is damaged,
has data problems, or is missing altogether, with a backup of the entire database.

33
 If the database file is missing, copy the backup to the location where the
database should be.

Important: If other databases or programs have links to objects in the database that
you are restoring, it is critical that you restore the database to the correct location. If
you do not, links to the database objects will not work and will have to be re-created,
such as by using the Linked Table Manager.

 If the database file is damaged or has data problems, delete the damaged file
and then replace the damaged file with the backup.

RESTORE PART OF A DATABASE:

To restore a database object, you import the object from the backup into the
database that contains (or is missing) the object that you want to restore. You can
restore more than one object at a time.
1. Open the database to which you want to restore an object.

 If you want to restore a missing object, such as an accidentally deleted


table, skip to step 3. If you want to replace an object that contains bad or missing
data or has stopped working correctly, do one of the following:

 If you want to preserve the current object — for example, to compare it


with the restored version after you restore — you should rename the object before
you restore it. For example, if you want to restore a damaged form named
Checkout, you can rename the damaged form Checkout_bad.

2. Delete the object that you want to replace.


Note: Always be careful when you delete database objects.
3. On the External Data tab, in the Import group, click Access.
4. In the Get External Data dialog box, click Browse to locate the backup database.
5. Click Import tables, queries, forms, reports, macros, and modules into the current
database, and then click OK.
6. In the Import Objects dialog box, click the tab that corresponds to the type of
object that you want to restore. For example, if you want to restore a table, click the
Tables tab.
7. Click the object to select it.

34
8. If you want to restore more objects, repeat steps 6 and 7 until you have selected
all of the objects that you want to restore.
9. You may want to adjust the import options. In the Import Objects dialog box, click
the Options button to review these options before importing your objects.
10. After you finish selecting objects and setting options, click OK to restore the
objects.

SECURITY:
Database Security: The information in this topic applies only to a Microsoft Access
database (.mdb).

User Level Security is the most flexible and extensive method of implementing
security measures for your Microsoft Access database. You can set up security on your
database to require users to log on to get into the database or not.

 Help protect a database by using the User-Level Security Wizard


With the User-Level Security Wizard, you can apply user-level security with a
comprehensive security scheme and encode your Microsoft Access database.

Open the database that you want to help protect up security on your database to
require users to log on to get into the database or not.

 Help protect a database by using the User-Level Security Wizard


With the User-Level Security Wizard, you can apply user-level security with a
comprehensive security scheme and encode your Microsoft Access database.

1. Open the database that you want to help protect.

2. On the Tools menu, click Security, and then click User-Level Security Wizard.
Follow the directions in the wizard dialog boxes.

 Help protect a database without requiring users to log on


If you want to help protect some parts of a database, such as the design of
certain objects, but you do not care about establishing different levels of access for
different groups of users, you may want to consider securing an application without
requiring users to log on. This does not remove user-level security but essentially
disables it for all but specific objects.

1. Help protect your database by using the User-Level Security Wizard.

2. For each table, query, form, report, and macro you want to be available to users,
grant the appropriate permissions to the Admin user account

35
3. Turn off the Logon dialog box.

Other security measures can be implemented at the system level. Typical


approaches to improving computer security (in approximate order of strength) can
include the following:

 Physically limit access to computers to only those who will not compromise
security.

 Hardware mechanisms that impose rules on computer programs, thus avoiding


depending on computer programs for computer security.

 Operating system mechanisms that impose rules on programs to avoid trusting


computer programs.

 Programming strategies to make computer programs dependable and resist


subversion.

ANTI VIRUS:
 Antivirus software (or anti-virus) is computer software used to identify and
remove computer viruses, as well as many other types of harmful computer
software, collectively referred to as malware. While the first antivirus software
was designed exclusively to combat computer viruses, most modern antivirus
software can protect against a wide range of malware, including worms, rootkits,
and Trojans.

 Beside antivirus software, virus infection prevention can be assisted by other


means such as implementing a network firewall, or utilizing system virtualization.
However, only antivirus software is designed specifically to prevent a computer
system from known virus infections.

36
FUTURE SCOPE OF THE PROJECT

This project is currently designed and analyzed by considering all the aspects of
Inventory system and up to some extent limited to the requirement of a small shop
willing to maintain inventory, but can be easily upgraded for general purpose also. Any
shop having Inventory can use this project. This is not a big project, only provides data
maintenance, insertion, modification, deletion and useful list programmer can modify it.

The user is free to modify the database design according to his/her design
strategies keeping the rules and renormalizations in mind.

Limitations of Project
At this time, the application has been installed in the client mode ONLY. The
server-client setup can only be shown to be working once the State offices have a LAN
setup completed from their end. But the server-client architecture has been tested
thoroughly at the vendor office.

Further Enhancement in the Project


1. Allow Validations By the User as per the requirement.

2. Adding Status Bar displaying information about particular forms or tables.

3. Changes in Looks, Adding Fun Pages Etc.

4. Adding Help Features, Tool Tip Text.

5. Implementing full use of keyboard.

37
PROJECT ESTIMATE

Cost Estimation:

Keeping in mind that Scope of application a licensed copy of Microsoft


Application Suite; VB and Access was available at site to develop the application; only
software engineers and a technical consultant were brought on board for this project.
The cost incurred by the association was:

Role Total hours Rate Total Cost


(per hour) per person
Technical Consultant 160 ( 20 working days * 8 hours Rs. 30 / - Rs. 4800 / -
per day) – 4 weeks

Software Engineer / 200 ( 25 working days * 8 hours Rs. 23 / - Rs. 4600 / -


Developer per day) – 5 weeks

Sr. Software Engineer / 200 ( 2 working days * 8 hours Rs. 23 / - Rs. 4600 / -
Sr. Developer per day) – 5 weeks

Travel expenditure will be paid every week. Travel expenditure per person
cannot exceed Rs. 5000 / -

Total cost to the company (association) = Rs. 29,000 / -

Benefit:

Since this is the first project with a Government subsidiary, training will be
provided to ten staff members (staff list will have to be submitted before the training
begins) at no extra cost in a week’s time. Six months of maintenance support is another
benefit that the association will have at no extra cost. This does not include
enhancement of the application. No engineer will be hosted at the site. The IT manager
can call the company who developed this application for them and log a problem case.
Problem case will be addressed in 24 hours.
After completion of six months maintenance support, it is up to the association if
they would like to continue the support. New SOW will have to be created and duly
signed by both parties if further support or enhancements is required by the association.

38
TESTING

Software Testing is an empirical investigation conducted to provide stakeholders


with information about the quality of the product or service under test; with respect to
the context in which it is intended to operate. This includes, but is not limited to, the
process of executing a program or application with the intent of finding software bugs.

Testing can never completely establish the correctness of computer software.


Instead, it furnishes a criticism or comparison that compares the state and behavior of
the product against oracles—principles or mechanisms by which someone might
recognize a problem. These oracles may include (but are not limited to) specifications,
comparable products, past versions of the same product, inferences about intended or
expected purpose, user or customer expectations, relevant standards, applicable laws,
or other criteria.

Over its existence, computer software has continued to grow in complexity and
size. Every software product has a target audience. For example, the audience for video
game software is completely different from banking software. Therefore, when an
organization develops or otherwise invests in a software product, it presumably must
assess whether the software product will be acceptable to its end users, its target
audience, its purchasers, and other stakeholders. Software testing is the process of
attempting to make this assessment.

Software testing is a critical element of software quality assurance and


represents the ultimate review of specification, design and coding.

The main objective of testing are: -

 Testing is a process of execution a program with the intent of finding an error.


 A good test case is one that has a high probability of finding an as yet discovered
error.
 A successful test is one that uncovers an as yet undiscovered error.

39
TESTING PRINCIPLES

All Tests should be traceable to customer requirements; the most severe defects from
the customer’s point of view are those that cause the program to fail to meet its requirements.
Tests should be planned long before testing begins. Testing should begin in the small modules
and progress towards testing the complete system as a whole.

DIFFERENT TYPES OF TESTING

 STATISTICAL TESTING

It is used to test a program’s performance and reliability. Tests reflect the


frequency of actual user inputs and allow an estimate of the operational reliability
of the system to be made. To conduct the statistical test, we create a list of test
data. As we operate those data on the system, it performs properly and
efficiently.

 DEFECT TESTING

It is used to find the areas of nonconformance to the system specification.


Test reveals the presence of latent defects in the system. Defects are corrected
through debugging. Testing is then repeated to ensure the changes was correct
and was correctly made (regression testing).

There are two basic approaches of defect testing: -

1. FUNCTIONAL OR BLACK BOX TESTING

Tests are derived from knowledge of the program specification which is


most applicable for system testing. Black box refers to the fact that the system is
viewed in relationship to its input and related outputs in contained in a Black Box
or not viewable. Black Box testing is also called functional testing because
mathematical function can be specifies using the inputs and outputs.

In order to carry out Black Box testing we prepare a set of input data,
which may cause anomalous behavior. The selection of these test data is based
on previous experience of test engineers using domain knowledge to identify test

40
cases likely to reveal defects. When we conduct black box test on those data,
some error has revealed, which have been rectified properly.

2. STRUCTURAL OF WHITE BOX TEST

Structural or white box testing allows the tester to analyze the code and
used knowledge about the structure of a component to derive test data.

We adopt structural testing strategy that is path testing where the


objective is to execute ever independent execution path through the component.
Executing ever independent execution path allows all statements in the
component to be executed at least once, including testing all conditional
statements for both true and false cases.

TESTING PROCESS

Just as systems are not developed monolithically but rather as sub-systems of


modules, so the testing process should also proceed in incremental stages.

The most widely used testing process has three stages :-

1. UNIT TESTING

Individual components are tested to ensure correct operation. Components are


tested independently. We have carried out testing for each form in all modules.

2. MODULE TESTING

Module encapsulated related dependent components allowing them to be tested


without other system modules. In this phase, we have carried out for each module that
is testing all the forms of a single module.

3. SYSTEM TESTING

Concerned with finding errors resulting from interactions between different


modules and system components. Also concerned with validating functional and non-
functional requirement satisfaction.

41
It is the system integration phase, where we have tested complete system in
accordance with database and all the modules. That is one module is validating the
other modules logics and flow of control.

Testing Mechanism Used

1. VOLUME TEST:

In this test, we create as many records as would normally be produced to verify


that the Hardware and the Software will function correctly. The user is asked to provide
the Data for Volume Testing.

2. STRESS TESTING:

The purpose of stress testing id to prove that the system does not malfunction
under peak loads. Unlike volume testing where time is not a factor, we subject the
system to a high volume of data over a short time period.

3. USABILITY:

The Usability test verifies that User Friendly nature of the system. This relates to
normal operation and error handling.

42
SNAPSHOTS OF FORMS

The EXE file for the Hardware Inventory is created and placed on desktop to
make the software platform independent. As the EXE file is run Login box is open with a
background window of Hardware Inventory Software. User must enter correct user id
and password to access the software. Login is very must essential to avoid the data
theft and access by unauthorized personnel. Thus password strength is too strong to
break. If user id or password is incorrect then a message is displayed “Incorrect User
name or password, keep trying”.

43
After matching the administrator’s user id and password, Main Screen of the
Hardware Inventory software is shown. On the Title Bar, title of the software “Hardware
Inventory” is shown on the left top most corner and on right top most corner there are
three buttons, first for minimize, second for maximize and third for closing the
application. Below the Title Bar, there is Menu Bar. There are different menus for
different purposes. If a user other than administrator logins then limited menus will be
shown to the user.

44
On the Menu Bar, the first menu is “Administrator”. Under this menu,
Administrative rights are given to Administrator such “Add User” for authorising that user
to handle transactions. Another is “Remove User i.e. in any case, if a user no longer
exits. Then there is change of password. Password needs to be changed on time to
time basis for security reasons. Next come “Log Out”. It is for current user to log out
from the application.

45
To add a user simply, click Add User under Administrator menu. A box name
“ADD NEW USER” will appear on the screen. Fill all the fields and click on Add User
button. User will be added with a message displayed on the screen “Congrates! You
have been added”.

46
To remove user, being no longer in company or transferred to another
department, simply select the user id from existing users and click on remove button.
User will be deleted from the list.

47
To change the password select the user of whom password need to be changed,
insert current and new passwords and then submit. Password would be changed.
Password must be changed periodically for security.

48
Under Customer’s Detail Menu, there are three options which are “Add” a new
customer, “Edit” details of existing customer, “View” list of existing customers.

49
In “Add Customer” form, there are required and optional fields i.e. Customer’s
Number, Name, Telephone number, Fax Number, E-mail, and Address. Enter the
required data in the form and then click on “SUBMIT”. Details of customer will be added
and form will become blank to add another customer other wise click on “CLOSE”
button to exit from the form.

50
To edit customer’s details, we have few command buttons in addition. We can
find customer by clicking on “FIND” button. Select the required customer data, click on
the “EDIT” button and do the changes. Even we can “DELETE” any record if that
customer is no longer a customer.

51
Here administrator can view all the customers.

52
Under “Transaction” menu, there are four submenus i.e. Purchase, Sales,
Purchase Return, Sale Return. So we can select what job we have to carry out.

53
On clicking the Purchase submenu, a form will appear on the screen. In this form
we enter the details regarding the purchases made such as date of purchase, what is
the Bill No. what is the item, its quantity and price and any freight charges etc.

54
Sales form is similar to purchase form but the only difference is that purchase
tells what are the items were purchased and sales tells what are the items were sold.

55
In Purchase return form, only one new text box is added for “Debit Note No.”

56
In sales return form, “Credit Note No.” is added.

57
Next menu is “Inventory Information”. Under this menu, there are two sub menus
i.e. Create Item and Edit Item.

58
Create Stock Item, in this form we can create or add new items in the inventory.
As shown in the picture, first name of the item and unit. Then for accountability of new
item, opening balance is maintained.

59
In the “Edit Stock Item”, record of item is updated. Such as if an item is sold or
purchased, its quantity and price unit and total amount can be changed.

60
To see the records of sales and purchases, either on daily basis or monthly basis
under “Display” menu, four submenus are created which are “Sales Register”,
“Purchase Register”, “ Day Book” and “Closing Book”.

61
It is the “Sales Register”. It gives details of all the items which were sold. On
selecting any of the record, we can which item was sold, its quantity, price, freight
charges and total cost of the item and the customer to whom it was sold and Bill No.

62
“Purchase Register” is similar to “Sales Register”. It gives details of all the
items which were purchased. On selecting any of the record, we can which item was
purchased, its quantity, price, freight charges and total cost of the item and the
customer from whom it was purchased and Bill No.

63
“Day Book” is for see the records of the particular day and even particular
customer.

64
Stock information is to view the items in the stock. If suppose mouse is not there
in the stock then it will show blank field the corresponding field in the quantity.

65
SOURCE CODE

MODULE 1: -

Option Explicit
Public con As New ADODB.connection

Public Sub connection()


con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=d:\inventory\project1.mdb;Persist Security Info=False"
con.Open
End Sub

Public Function enable()


MainScreen.inventory.Enabled = True
MainScreen.transactions.Enabled = True
MainScreen.custdetail.Enabled = True
MainScreen.Ad.Enabled = True
MainScreen.display.Enabled = True
MainScreen.login.Enabled = True
End Function

Public Function disable()


MainScreen.inventory.Enabled = False
MainScreen.transactions.Enabled = False
MainScreen.custdetail.Enabled = False
MainScreen.Ad.Enabled = False
MainScreen.display.Enabled = False
MainScreen.login.Enabled = False
End Function

Public Function buildstock()


Dim rs As New ADODB.Recordset
Dim rs1 As New ADODB.Recordset
Dim rs2 As New ADODB.Recordset

rs.Open "daybook", con, adOpenDynamic, adLockOptimistic


rs1.Open "stock", con, adOpenDynamic, adLockOptimistic
rs2.Open "item", con, adOpenDynamic, adLockOptimistic

While Not rs1.EOF


rs1.DELETE
rs1.Save
Wend

66
Dim TEMP As Boolean

While Not rs.EOF


If rs1.EOF = False Or rs1.BOF = False Then
rs1.MoveFirst
End If

TEMP = False

While Not rs1.EOF


If rs1!ITEM = rs!ITEM Then
TEMP = True

If rs!transaction_type = "PURCHASE" Or rs!transaction_type = "SALE RETURN" Then


rs1!quantity = rs1!quantity + rs!quantity
Else
rs1!quantity = rs1!quantity - rs!quantity
End If

rs1.Update
rs1.MoveLast
End If

rs1.MoveNext
Wend

If TEMP = False Then


rs1.AddNew
rs1!ITEM = rs!ITEM
rs1!quantity = rs!quantity

rs1.Update
End If
rs.MoveNext
Wend

Dim no As Long
Dim trans As Long

If rs1.EOF = False Or rs1.BOF = False Then


rs1.MoveFirst
rs2.MoveFirst
End If

While Not rs1.EOF


no = 0
trans = 0
rs.MoveFirst

67
TEMP = False
While Not rs.EOF

If rs!ITEM = rs1!ITEM Then


If rs!transaction_type = "PURCHASE" Then
no = no + rs!quantity
trans = trans + rs(9)
End If
End If
rs.MoveNext
Wend

rs1(2) = rs1(1) * Round((trans / no), 0)

While Not rs2.EOF And (TEMP = False)


If rs2!ITEM = rs1!ITEM Then
rs1(2) = rs1(2) + rs2(4)
rs1(1) = rs1(1) + rs2(2)
TEMP = True
End If
rs2.MoveNext
Wend

rs1.Update
rs1.MoveNext
Wend

rs.CLOSE
rs1.CLOSE
rs2.CLOSE
End Function

68
MAIN SCREEN: -

Option Explicit

Private Sub Adlogin_Click()


Dim a As New login
a Show
a txtUserName=”administrator”
a txtPassword.SetFocus
End Sub

Private Sub Aduser_Click()


adduser.Show
End Sub

Private Sub CPass_Click()


changepass.Show
End Sub

Private Sub createitem_Click()


Dim a As New createitem
a Show
End Sub

Private Sub custadd_Click()


addcust.Show
End Sub

Private Sub custedit_Click()


editcustomer.Show
End Sub

Private Sub custview_Click()


viewcust.Show
End Sub

Private Sub dbook_Click()


DAYBOOK.show
End Sub

Private Sub edititem_Click()


EDITSTOCKITEM.Click()
End Sub

69
Private Sub exit_Click()
End
End Sub

Private Sub L_Click()


Dim a As New login
a Show
End Sub

Private Sub LO_Click()


L.Enabled = True
MainScreen.inventory.Enabled = False
MainScreen.transactions.Enabled = False
MainScreen.custdetail.Enabled = False
MainScreen.display.Enabled = False
MainScreen.Ad.Enabled = True
LO.Enabled = False
Aduser.Enabled = False
CPass.Enabled = False
Ruser.Enabled = False
End Sub

Private Sub MDIForm_Load()


Connection
End Sub

Private Sub pregister_Click()


PURCHASEREG.Show
End Sub

Private Sub purchase_Click()


Purchases TR_TYPE = “PURCHASE”
Purchases.Show
End Sub

Private Sub Purchretrun_Click()


Purchases.TR_TYPR = “PURCHASE RETURN
Purchase.Show
End Sub

Private sub Ruser_Click()


RemoveUser.Show
End Sub

Private Sub sale_Clicke()


Sales TR_TYPES = “SALE”
Sales.Show
End Sub

70
Private Sub salereturn_Click()
Sales TR_TYPES = “SALE RETURN”
Sales.Show
End Sub

Private Sub sregister_Click()


SALEREIGSTER.Show
End Sub

Private Sub stock_Click()


buildstock
clstock.Show
End Sub

71
LOGIN: -

Option Explicit
Dim log As New ADODB.Recordset

Private Sub cmdCancel_Click()


Unload Me
MainScreen.Ad.Enabled = True
End Sub

Private Sub cmdOK_Click()


If Trim$(txtUserName) = "" Or Trim$(txtPassword) = "" Then
MsgBox "Please enter valid user_id and password"
Else

Dim ed As Boolean
ed = False

log.MoveFirst

Do While (log.EOF = False) And (ed = False)


If (UCase(Trim$(log!UserName)) = UCase(Trim$(txtUserName))) And (UCase(Trim$
(log!Password)) = UCase(Trim$(txtPassword))) Then
ed = True

If UCase(txtUserName) = "ADMINISTRATOR" Then


MainScreen.Aduser.Enabled = True
MainScreen.Ruser.Enabled = True
MainScreen.lo.Enabled = True
MainScreen.CPass.Enabled = True
MainScreen.inventory.Enabled = True
MainScreen.transactions.Enabled = True
MainScreen.custdetail.Enabled = True
MainScreen.display.Enabled = True
MainScreen.Ad.Enabled = True
ed = True

Else

MainScreen.lo.Enabled = True
MainScreen.CPass.Enabled = True
MainScreen.display.Enabled = False
MainScreen.inventory.Enabled = False
MainScreen.transactions.Enabled = True
MainScreen.custdetail.Enabled = False
MainScreen.Ad.Enabled = True
MainScreen.Ad.Caption = UCase(Trim$(Me.txtUserName.Text))
MainScreen.login.Enabled = False
MainScreen.Aduser.Enabled = False

72
MainScreen.Ruser.Enabled = False
ed = True
End If

MainScreen.lo.Enabled = True
Else
log.MoveNext
End If
Loop
If ed = False Then
MsgBox "Incorrect Password or User Name, Keep Trying"
txtUserName = ""
txtPassword = ""
Else
Unload Me
End If
End If
End Sub

Private Sub Form_Load()


disabl
txtUserName.Text = ""
log.Open "login", con, adOpenDynamic, adLockOptimistic
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)


log.CLOSE
End Sub

73
ADD USER: -

Option Explicit
Dim rs As New ADODB.Recordset

Private Sub Command1_Click()


If (Text1 = "") Then
MsgBox "Please Enter the User name."
Text1.SetFocus
Else
If (Text2 = "") Then
MsgBox "Please Enter the Password"
Text2.SetFocus
Else
If (Text3 = "") Then
MsgBox "Please confirm password"
Text3.SetFocus
Else
If (UCase(Text2)) = (UCase(Text3)) Then
Dim tr As Boolean
tr = False
Do While (rs.EOF = False) And tr = False
If Trim$(UCase(Text1)) = Trim$(UCase(rs(0))) Then
tr = True
Else
rs.MoveNext
End If
Loop
If tr = False Then
rs.AddNew
rs(0) = Trim$(Text1.Text)
rs(1) = Trim$(Text2.Text)
rs.Update
MsgBox "Congrats!! You are added To system with User id " & UCase(Text1)
Text1 = ""
Text2 = ""
Text3 = ""
Unload Me
Else
MsgBox "User is already exist."
Text1 = ""
Text2 = ""
Text3 = ""
Text1.SetFocus
End If
Else
MsgBox "Password confirmed is not same as password"
Text3 = ""
Text2 = ""

74
Text2.SetFocus
End If
End If
End If
End If

End Sub

Private Sub Form_Load()


rs.Open "LOGIN", con, adOpenDynamic, adLockOptimistic
disabl
End Sub

Private Sub Form_Unload(Cancel As Integer)


enabl
rs.CLOSE
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)


If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub

Private Sub Text2_KeyPress(KeyAscii As Integer)


If KeyAscii = 13 Then
Text3.SetFocus
End If
End Sub

Private Sub Text3_KeyPress(KeyAscii As Integer)


If KeyAscii = 13 Then
Command1.SetFocus
End If
End Sub

75
REMOVE USER: -

Option Explicit
Dim rs As New ADODB.Recordset

Private Sub Command1_Click()


If Combo1.Text = "" Then
MsgBox "Please select a user name"
Else
If Combo1.Text = "ADMINISTRATOR" Then
MsgBox "U cannot Remove Administrator"
Else
rs.MoveFirst
While rs(0) <> Combo1.Text
rs.MoveNext
Wend
rs.DELETE
Combo1.Refresh
MsgBox "User " & Combo1.Text & " Deleted from the database"
Combo1.RemoveItem (Combo1.ListIndex)
Combo1.Refresh
End If
End If
End Sub

Private Sub Form_Load()


disabl
rs.Open "login", con, adOpenDynamic, adLockOptimistic
While Not rs.EOF
If rs!UserName = Trim$(UCase("administrator")) Then
rs.MoveNext
End If
Combo1.AddItem rs!UserName
rs.MoveNext
'End If
Wend
Combo1.ListIndex = 0
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)


enabl
rs.CLOSE
End Sub

76
CHANGE PASSWORD: -

Option Explicit
Dim rs As New ADODB.Recordset

Private Sub CMDCLOSE_Click()


Unload Me
End Sub

Private Sub cmdsubmit_Click()


Dim str, st, N, t As String
Dim ab As Boolean
ab = False
rs.MoveFirst
Do While (rs.EOF = False) And (ab = False)
If exist_user.Text = Trim$(UCase(rs(0))) Then
ab = True
Else
rs.MoveNext
End If
Loop

If Trim$(UCase(Text1)) = Trim$(UCase(rs(1))) Then


If Trim$(Text2) <> "" Then
If Trim$(UCase(Text3)) = Trim$(UCase(Text2)) Then
rs(1) = Trim$(UCase(Text2.Text))
rs.Update
Text1 = ""
Text2 = ""
Text3 = ""
MsgBox "Your Password is successfully updated"
Unload Me
Else
MsgBox "Please enter the confirm password"
Text2 = ""
Text3 = ""
Text2.SetFocus
End If
Else
MsgBox "Please enter the new password"
Text2 = ""
Text3 = ""
Text2.SetFocus
End If
Else
MsgBox "You have entered the wrong current password, try again"
Text1 = ""
Text2 = ""
Text3 = ""

77
Text1.SetFocus
End If
End Sub

Private Sub Form_Activate()


'List1.SetFocus
End Sub

Private Sub Form_Load()


disabl
rs.Open "login", con, adOpenDynamic, adLockOptimistic
If MainScreen.Ad.Caption = "Administrator" Then
List1.Visible = True
While Not rs.EOF
List1.AddItem rs(0)
rs.MoveNext
Wend
List1.ListIndex = 0
exist_user.Text = List1.Text
Else
exist_user.Visible = True
exist_user.Text = MainScreen.Ad.Caption
End If
End Sub

Private Sub Form_Unload(Cancel As Integer)


enabl
rs.CLOSE
End Sub

78
ADD CUSTOMER: -

Option Explicit
Dim rs As New ADODB.Recordset
Dim a As Integer

Private Sub Command1_Click()


If Trim$(cust(1)) = "" Or Trim$(cust(2)) = "" Or Trim$(cust(5)) = "" Then
MsgBox "You must enter values in Name, Address and Telephone No. Fields"
cust(1).SetFocus
Else

rs.AddNew
For a = 0 To 5
rs(a) = cust(a)
Next
rs.Update
cno
For a = 1 To 5
cust(a) = ""
Next
End If
cust(1).SetFocus
End Sub

Private Sub Command2_Click()


Unload Me
End Sub

Private Sub cust_KeyPress(Index As Integer, KeyAscii As Integer)


If Index = 2 Or Index = 3 Then
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or KeyAscii = vbKeyBack Or KeyAscii
= vbKeyDelete Or KeyAscii = 45 Then
Else
KeyAscii = 0
End If
End If
If Index = 4 And KeyAscii = vbKeySpace Then
KeyAscii = 0
End If
End Sub

Private Sub Form_Load()


disabl
rs.Open "custdet", con, adOpenDynamic, adLockOptimistic
cno
End Sub
Private Function cno()
If (rs.EOF = True) Then

79
cust(0).Text = 1
Else
rs.MoveLast
cust(0).Text = Val(rs(0)) + 1
rs.MoveFirst
End If
End Function

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)


enabl
rs.CLOSE
End Sub

80
EDIT CUSTOMER: -

Option Explicit
Dim rs As New ADODB.Recordset
Dim a As Integer

Private Sub cust_KeyPress(Index As Integer, KeyAscii As Integer)


If Index = 2 Or Index = 3 Then
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or KeyAscii = vbKeyBack Or KeyAscii
= vbKeyDelete Or KeyAscii = 45 Then
Else
KeyAscii = 0
End If
End If
If Index = 4 And KeyAscii = vbKeySpace Then
KeyAscii = 0
End If
End Sub

Private Sub Command2_Click()


Unload Me
End Sub

Private Sub del_Click()


If rs.EOF = False And rs.BOF = False Then
rs.DELETE
If rs.EOF = False Then
rs.MoveNext
While Not rs.EOF
rs(0) = rs(0) - 1
rs.Update
rs.MoveNext
Wend
End If
NEXT_Click
End If
End Sub

Private Sub EDIT_Click()


If EDIT.Caption = "&Edit" Then
cust(0).Enabled = True
cust(1).Enabled = True
cust(2).Enabled = True
cust(3).Enabled = True
cust(4).Enabled = True
cust(5).Enabled = True
EDIT.Caption = "&Save"
Else
If Trim$(cust(1)) = "" Or Trim$(cust(2)) = "" Or Trim$(cust(5)) = "" Then
MsgBox "You must enter values in Name, Address and Telephone No. Fields"

81
cust(1).SetFocus
Else
If rs.EOF = False Then
For a = 0 To 5
rs(a) = cust(a)
Next
rs.Update
cust(1).Enabled = False
cust(2).Enabled = False
cust(3).Enabled = False
cust(4).Enabled = False
cust(5).Enabled = False
cust(0).Enabled = False
End If
End If
EDIT.Caption = "&Edit"
End If
End Sub

Private Sub find_Click()


Dim c, s As String
Dim tr As Boolean
tr = True
s = InputBox("Enter the Name or Part of Name to which you find")
If Len(s) = 0 Then
MsgBox "No Name is entered"
Else
If rs.BOF = False Or rs.EOF = False Then
rs.MoveNext
While (rs.EOF = False And tr = True)
If InStr(1, UCase(Trim$(rs(1))), UCase(Trim$(s))) > 0 Then
sh
tr = False
Else
rs.MoveNext
End If
Wend
End If
End If
If tr = True Then
CLR
End If
End Sub

Private Sub FIRST_Click()


If rs.EOF = False Or rs.BOF = False Then
rs.MoveFirst
sh
Else
MsgBox "There is no record"

82
CLR
End If
End Sub

Private Sub Form_Load()


disabl
rs.Open "CUSTDET", con, adOpenDynamic, adLockOptimistic
FIRST_Click
End Sub
Private Function sh()
If rs.EOF = False And rs.BOF = False Then
For a = 0 To 5
If rs(a) <> "" Then
cust(a).Text = rs(a)
Else
cust(a) = "0"
End If
Next
End If
End Function

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)


enabl
rs.CLOSE
End Sub

Private Sub LAST_Click()


If rs.EOF = False Or rs.BOF = False Then
rs.MoveLast
sh
Else
MsgBox "There is no record"
CLR
End If
End Sub

Private Sub NEXT_Click()


If rs.EOF = False And rs.BOF = False Then
rs.MoveNext
If rs.EOF = False Then
sh
Else
MsgBox "This is the last record"
LAST_Click
End If
End If
End Sub

Private Sub prev_Click()


If rs.BOF = False Or rs.EOF = False Then

83
rs.MovePrevious
If rs.BOF = False Then
sh
Else
MsgBox " There is the first record"
FIRST_Click
End If
End If
End Sub

Private Function CLR()


For a = 0 To 5
cust(a) = ""
Next
End Function

84
VIEW CUSTOMER: -

Option Explicit

Private Sub Command2_Click()


Unload Me
End Sub

Private Sub Form_Load()


disabl
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)


enabl
Adodc1.Recordset.CLOSE
End Sub

85
PURCHASE AND PURCHASE RETURN FORM: -

Option Explicit
Dim rs As New ADODB.Recordset
Dim rs1 As New ADODB.Recordset
Dim rs2 As New ADODB.Recordset

Public TR_TYPE As String


Dim TEMP As Integer

Private Sub Command1_Click()


inward(4) = (Val(inward(1)) * Val(inward(2))) + Val(inward(3))
If Trim$(inward(0)) = "" Or Trim$(inward(1)) = "" Or Trim$(inward(2)) = "" Then
MsgBox "You can not leave any field blank"
inward(0).SetFocus
Exit Sub
End If
If ITEM = "" Then
MsgBox "Please add items first then enter your purchase"
inward(0) = ""
inward(1) = ""
inward(2) = ""
inward(3) = ""
inward(4) = ""
Exit Sub
End If

If CUSTOMER = "" Then


MsgBox "Please add customers first then enter your purchase"
inward(0) = ""
inward(1) = ""
inward(2) = ""
inward(3) = ""
inward(4) = ""
Exit Sub
End If

If rs1.EOF = True And rs1.BOF = True Then


TEMP = 1
Else
rs1.MoveLast
TEMP = rs1(0) + 1
End If
rs1.AddNew
rs1(0) = TEMP

86
rs1(1) = DOB
rs1(2) = inward(0)
rs1(3) = CUSTOMER
rs1(4) = TR_TYPE
rs1(5) = ITEM
rs1(7) = Val(inward(2))
rs1(6) = Val(inward(1))
rs1(8) = Val(inward(3))
rs1(9) = Val(inward(4))
rs1.Update

inward(0) = ""
inward(1) = ""
inward(2) = ""
inward(3) = ""
inward(4) = ""
inward(0).SetFocus
End Sub

Private Sub Command2_Click()


Unload Me
End Sub

Private Sub Form_Load()


disabl
Frame1.Caption = TR_TYPE
Me.Caption = TR_TYPE

If TR_TYPE = "PURCHASE RETURN" Then


Label1.Caption = "DR. NOTE NO."
End If

DOB = Date

rs.Open "item", con, adOpenDynamic, adLockOptimistic


rs1.Open "daybook", con, adOpenDynamic, adLockOptimistic
rs2.Open "custdet", con, adOpenDynamic, adLockOptimistic

If rs.EOF = True And rs.BOF = True Then


Else
While Not rs.EOF
ITEM.additem (rs(0))
rs.MoveNext
Wend
End If

If rs2.EOF = True And rs2.BOF = True Then


Else
While Not rs2.EOF
CUSTOMER.additem (rs2(1))

87
rs2.MoveNext
Wend
End If
If ITEM.ListCount > 0 Then
ITEM.ListIndex = 0
End If
If CUSTOMER.ListCount > 0 Then
CUSTOMER.ListIndex = 0
End If
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)


enabl
rs.CLOSE
rs2.CLOSE
rs1.CLOSE
End Sub

Private Sub inward_LostFocus(Index As Integer)


If Index = 3 Then
inward(4) = (Val(inward(1)) * Val(inward(2))) + Val(inward(3))
End If
End Sub

88
SALES AND SALES RETURN FORM: -

Option Explicit
Dim rs As New ADODB.Recordset
Dim rs1 As New ADODB.Recordset
Dim rs2 As New ADODB.Recordset
Dim rs3 As New ADODB.Recordset
Public TR_TYPE As String
Dim stk As Double

Private Sub Command1_Click()


If Trim$(outward(0)) = "" Or Trim$(outward(1)) = "" Or Trim$(outward(2)) = "" Then
MsgBox "You can not leave any field blank"
outward(1).SetFocus
Exit Sub
End If

If ITEM = "" Then


MsgBox "Please add items first then enter your purchase and then Sale"
Exit Sub
End If

If CUSTOMER = "" Then


MsgBox "Please add customers first then enter your purchase and then sale"
Exit Sub
End If

If rs1.EOF = True And rs1.BOF = True Then


Else
rs1.MoveFirst
End If

While Not rs1.EOF


If rs1!transaction_type = "SALE" Then
If rs1(2) = outward(0) Then
MsgBox "THIS BILL NO. IS ALREADY EXIST"
outward(0).SetFocus
Exit Sub
End If
End If
rs1.MoveNext
Wend
If rs1.EOF = False Or rs1.BOF = False Then
rs1.MoveFirst
rs.MoveFirst
End If

If rs3.EOF = True And rs3.BOF = True Then


Else
rs3.MoveFirst

89
End If

If TR_TYPE = "SALE" Or TR_TYPE = "PURCHASE RETURN" Then

While Not rs3.EOF


If rs3!ITEM = ITEM Then
rs3.MoveLast

If Val(outward(1)) > rs3!quantity Then


MsgBox " Available Quantity is " & rs3!quantity & " billed Quantity is " & outward(1)
outward(1).SetFocus
Exit Sub
End If
End If
rs3.MoveNext
Wend
End If

Dim TEMP As Integer


If (rs1.EOF = False Or rs1.BOF = False) Then
rs1.MoveLast
TEMP = rs1(0) + 1
Else
TEMP = 1
End If
rs1.AddNew
rs1(0) = TEMP
rs1(1) = DOB
rs1(2) = outward(0)
rs1(3) = CUSTOMER
rs1(4) = TR_TYPE
rs1(5) = ITEM
rs1(7) = Val(outward(2))
rs1(6) = Val(outward(1))
rs1(8) = Val(outward(3))
rs1(9) = Val(outward(4))
rs1.Update

outward(0).SetFocus
outward(0) = ""
outward(1) = ""
outward(2) = ""
outward(3) = ""
outward(4) = ""
End Sub

Private Sub Command1_GotFocus()


outward(4) = (Val(outward(1)) * Val(outward(2))) + Val(outward(3))
End Sub
Private Sub Command2_Click()

90
Unload Me
End Sub

Private Sub Form_Load()


disabl

Frame1.Caption = TR_TYPE
Me.Caption = TR_TYPE

If TR_TYPE = "SALE RETURN" Then


Label1.Caption = "CR. NOTE NO."
End If
DOB = Date
stk = 0
buildstock
rs.Open "item", con, adOpenDynamic, adLockOptimistic
rs1.Open "daybook", con, adOpenDynamic, adLockOptimistic
rs2.Open "custdet", con, adOpenDynamic, adLockOptimistic
rs3.Open "stock", con, adOpenDynamic, adLockOptimistic

If rs.EOF = True And rs.BOF = True Then


Else
While Not rs.EOF
ITEM.additem (rs(0))
rs.MoveNext
Wend
End If
ITEM.ListIndex = 0

If rs2.EOF = True And rs2.BOF = True Then


Else
While Not rs2.EOF
CUSTOMER.additem (rs2(1))
rs2.MoveNext
Wend
End If
CUSTOMER.ListIndex = 0
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)


enabl
rs.CLOSE
rs1.CLOSE
rs2.CLOSE
rs3.CLOSE
End Sub

91
ADD ITEM: -
Option Explicit
Dim rs As New ADODB.Recordset
Dim a As Integer

Private Sub Command1_Click()


a=0
While Not rs.EOF
If UCase(Trim$(STOCKITEM(a))) = UCase(Trim$(rs!ITEM)) Then
MsgBox "THIS ITEM IS ALREADY EXIST."
GoTo CLR
End If
a=a+1
rs.MoveNext
Wend

If STOCKITEM(0) <> "" Then


rs.AddNew
For a = 0 To 4
If (a = 2 Or a = 3 Or a = 4) And (STOCKITEM(a) = Trim$("")) Then
Else
rs(a) = STOCKITEM(a)
End If
Next
rs.Update
Else
MsgBox "YOU CAN NOT LEAVE NAME FIELD BLANK"
Exit Sub
End If

CLR:
For a = 0 To 4
STOCKITEM(a) = ""
Next
STOCKITEM(1) = "PCS."
End Sub

Private Sub Command2_Click()


Unload Me
End Sub

Private Sub Form_Load()


rs.Open "item", con, adOpenDynamic, adLockOptimistic
disabl
For a = 0 To 4
STOCKITEM(a) = ""
Next
STOCKITEM(1) = "PCS."
End Sub

92
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
enabl
rs.CLOSE
End Sub

Private Sub STOCKITEM_KeyPress(Index As Integer, KeyAscii As Integer)


If Index = 3 Or Index = 2 Then
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or KeyAscii = 0 Or KeyAscii = 46
Then
Else
KeyAscii = 0
End If
End If
End Sub

Private Sub STOCKITEM_LostFocus(Index As Integer)


STOCKITEM(4) = Val(STOCKITEM(3)) * Val(STOCKITEM(2))
End Sub

93
EDIT ITEM: -

Option Explicit
Dim rs As New ADODB.Recordset
Dim rs1 As New ADODB.Recordset

Private Sub CLOSE_Click()


Unload Me
End Sub

Private Sub DELETE_Click()


If rs.EOF = True And rs.BOF = True Then
Else
rs1.Open "daybook", con, adOpenDynamic, adLockOptimistic
While Not rs1.EOF
If rs1!ITEM = STOCKITEM(0) Then
MsgBox "You can not delete this item. This is already in transaction"
Exit Sub
End If
rs1.MoveNext
Wend
rs.DELETE
NEXT_Click
End If
End Sub

Private Sub EDIT_Click()


Dim a As Integer
If EDIT.Caption = "&EDIT" Then
For a = 0 To 3
STOCKITEM(a).Enabled = True
Next
EDIT.Caption = "&SAVE"
STOCKITEM(0).SetFocus
Else

If Trim$(STOCKITEM(0)) = "" Then


MsgBox "YOU CAN NOT LEAVE NAME FIELD BLANK"
STOCKITEM(0).SetFocus
Exit Sub
End If

For a = 0 To 4
rs(a) = STOCKITEM(a)
Next
rs.Update
EDIT.Caption = "&EDIT"

94
For a = 0 To 4
STOCKITEM(a).Enabled = False
Next
End If
End Sub

Private Sub FIRST_Click()


If rs.EOF = False Then
rs.MoveFirst
sho
End If
End Sub

Private Sub Form_Load()


disable
rs.Open "item", con, adOpenDynamic, adLockOptimistic
FIRST_Click
End Sub

Private Function sho()


Dim a As Integer
For a = 0 To 4
If rs(a) <> "" Then
STOCKITEM(a) = rs(a)
End If
Next
End Function

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)


enable
rs.CLOSE
End Sub

Private Sub LAST_Click()


If rs.EOF = False Then
rs.MoveLast
sho
End If
End Sub

Private Sub NEXT_Click()


If rs.EOF = False Then
rs.MoveNext
If (rs.EOF = False) Then
sho
Else
MsgBox "THIS IS LAST RECORD"
LAST_Click
End If
End If
End Sub

95
Private Sub PREVIOUS_Click()
If rs.BOF = False Then
rs.MovePrevious
If (rs.BOF = False) Then
sho
Else
MsgBox "THIS IS FIRST RECORD"
FIRST_Click
End If
End If
End Sub

Private Sub STOCKITEM_LostFocus(Index As Integer)


STOCKITEM(4) = Val(STOCKITEM(3)) * Val(STOCKITEM(2))
End Sub

96
SALES REGISTER: -

Option Explicit
Dim rs As New ADODB.Recordset
Dim rs1 As New ADODB.Recordset

Dim quantity As Long


Dim SAMOUNT As Double
Dim fret As Double
Dim tamount As Double

Private Sub Command2_Click()


Unload Me
End Sub

Private Sub Form_Load()


quantity = 0
tamount = 0
fret = 0
SAMOUNT = 0
Adodc1.Recordset.MoveFirst
While Not Adodc1.Recordset.EOF
If Adodc1.Recordset!transaction_type = "SALE" Then
tamount = tamount + Adodc1.Recordset(9)
SAMOUNT = SAMOUNT + (Adodc1.Recordset(6) * Adodc1.Recordset(7))
fret = fret + Adodc1.Recordset(8)
quantity = quantity + Adodc1.Recordset!quantity
Else
tamount = tamount - Adodc1.Recordset(9)
SAMOUNT = SAMOUNT - (Adodc1.Recordset(6) * Adodc1.Recordset(7))
fret = fret - Adodc1.Recordset(8)
quantity = quantity - Adodc1.Recordset!quantity
End If

Adodc1.Recordset.MoveNext
Wend
TAMT.Caption = ("RS. " & tamount)
SAMT.Caption = ("RS. " & SAMOUNT)
FREIGHT.Caption = ("RS. " & fret)
QTY.Caption = quantity
Adodc1.Recordset.MoveFirst
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)


Adodc1.Refresh
Adodc1.Recordset.Close
enable
End Sub

97
PURCHASE REGISTER: -

Option Explicit

Private Sub Command2_Click()


Unload Me
End Sub

Private Sub data_LostFocus(Index As Integer)


data(7) = (Val(data(4)) * Val(data(5))) + Val(data(6))
End Sub

Private Sub Form_Load()


disabl
Dim quantity, tamount, fret, pamount As Long
quantity = 0
tamount = 0
fret = 0
pamount = 0
While Not Adodc1.Recordset.EOF
If Adodc1.Recordset!transaction_type = "PURCHASE" Then
tamount = tamount + Adodc1.Recordset(9)
pamount = pamount + (Adodc1.Recordset(7) * Adodc1.Recordset(6))
fret = fret + Adodc1.Recordset(8)
quantity = quantity + Adodc1.Recordset!quantity
Else
tamount = tamount - Adodc1.Recordset(9)
pamount = pamount - (Adodc1.Recordset(7) * Adodc1.Recordset(6))
fret = fret - Adodc1.Recordset(8)
quantity = quantity - Adodc1.Recordset!quantity
End If

Adodc1.Recordset.MoveNext
Wend
TAMT.Caption = ("RS. " & tamount)
PAMT.Caption = ("RS. " & pamount)
FREIGHT.Caption = ("RS. " & fret)
QTY.Caption = quantity
Adodc1.Recordset.MoveFirst
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)


Adodc1.Refresh
Adodc1.Recordset.Close
enable
End Sub

98
DAY BOOK: -

Option Explicit
Dim a As Integer
Dim TEMP As Long
Dim CHK As Boolean
Dim validt As Boolean
Dim PREVIOUS As Integer
Dim rs As New ADODB.Recordset
Dim rs1 As New ADODB.Recordset
Dim rs3 As New ADODB.Recordset
Dim STRN As String

Private Sub Command1_Click()


disabling
Adodc1.Recordset.DELETE
End Sub

Private Sub Command2_Click()


Unload Me
End Sub

Private Sub Command3_Click()


Form1.Show
End Sub

Private Sub Command4_Click()


STRN = InputBox(" ENTER THE CUSTOMER NAME or A PART OF THE NAME",
"FIND CUSTOMER")
If Trim$(STRN) <> "" Then
Adodc1.Recordset.MoveNext
Do While Not Adodc1.Recordset.EOF
If InStr(1, UCase(Trim$(Adodc1.Recordset!CUSTOMER)), UCase(Trim$(STRN))) Then
Exit Do
Else
Adodc1.Recordset.MoveNext
End If
Loop
If Adodc1.Recordset.EOF = True Then
Adodc1.Recordset.MoveFirst
End If
End If
End Sub

Private Sub data_GotFocus(Index As Integer)


PREVIOUS = Val(data(4))
End Sub

99
Private Sub data_LostFocus(Index As Integer)
data(7) = (Val(data(5)) * Val(data(4))) + Val(data(6))
validat
If validt = True Then
data(4) = PREVIOUS
data(Index).SetFocus
validt = False
End If
End Sub

Private Sub EDIT_Click()


For a = 2 To 6
data(a).Enabled = True
Next
CUSTOMER.Enabled = True
TRTYPE.Enabled = True
End Sub

Private Sub Form_Load()


disabl
CHK = False
rs3.Open "custdet", con, adOpenDynamic, adLockOptimistic
While Not rs3.EOF
CUSTOMER.additem (rs3(1))
rs3.MoveNext
Wend
rs3.CLOSE
data(0).DataField = "trans_no"
data(1).DataField = "Date"
data(2).DataField = "Bill no"
CUSTOMER.DataField = "customer"
TRTYPE.DataField = "transaction_type"
data(3).DataField = "item"
data(4).DataField = "Quantity"
data(5).DataField = "Price"
data(6).DataField = "Freight"
data(7).DataField = "Total"
End Sub

Private Function disabling()


For a = 2 To 6
data(a).Enabled = False
Next
CUSTOMER.Enabled = False
TRTYPE.Enabled = False
End Function

100
Private Sub Form_Unload(Cancel As Integer)
Adodc1.Refresh
Adodc1.Recordset.CLOSE
enabl
End Sub

Private Function validat()


Dim stk As Integer
If Trim$(data(1)) = "" Or Trim$(data(2)) = "" Or Trim$(data(3)) = "" Or Trim$(data(4)) = ""
Or Trim$(data(5)) = "" Or Trim$(data(6)) = "" Then
MsgBox "You can not leave any field blank"
validt = True
End If

rs.Open "item", con, adOpenDynamic, adLockOptimistic


buildstock
rs1.Open "stock", con, adOpenDynamic, adLockOptimistic

If TRTYPE = "SALE" Or TRTYPE = "PURCHASE RETURN" Then


While Not rs1.EOF
If rs1!ITEM = data(3) Then
rs1.MoveLast
If (rs1!quantity + PREVIOUS) < Val(data(4)) Then
MsgBox " Negative Stock."
validt = True
End If
End If
rs1.MoveNext
Wend
End If
rs.CLOSE
rs1.CLOSE
End Function

Public Function CHKDT()


Adodc1.Recordset.MoveNext
Do While Not Adodc1.Recordset.EOF
If (Trim$(Adodc1.Recordset!Date) = Trim$(Form1.Calendar1.Value)) Then
Exit Do
Else
Adodc1.Recordset.MoveNext
End If
Loop
If Adodc1.Recordset.EOF = True Then
Adodc1.Recordset.MoveFirst
End If
End Function

101
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Caption
Case "Find Date"
Command3_Click

Case "Find Customer"


Command4_Click

Case "Edit Record"


EDIT_Click

Case "Delete Record"


Command1_Click

Case "Close"
Command2_Click

End Select
End Sub

102
CLOSING STOCK: -

Option Explicit

Private Sub Command2_Click()


Unload Me
End Sub

Private Sub Form_Load()


disable
End Sub

Private Sub Form_Unload(Cancel As Integer)


Adodc1.Recordset.CLOSE
enable
End Sub

Private Sub stock_KeyPress(Index As Integer, KeyAscii As Integer)


If Index = 1 Or Index = 2 Then
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or KeyAscii = vbKeyDelete Or
KeyAscii = vbKeyBack Then
Else
KeyAscii = 0
End If
End If
End Sub

103
BIBLIOGRAPHY & REFERENCES

 Programming in Visual Basic 6.0 by Julia Case Bradley.

 Visual Basic 6 (Visual Quick Start Guide) by Harold Davis.


 Sams Teach Yourself Visual Basic 6 in 24 Hours by Greg Perry.
 http://msdn.microsoft.com/en-us/vbrun/default.aspx

 Microsoft Office Access 2003: The Complete Reference (Osborne Complete


Reference Series) by Virginia Andersen.
 Access 2003 VBA Programmer's Reference (Programmer to Programmer) by
Patricia Cardoza, Teresa Hennig, Graham Seach, and Armen Stein

104

You might also like