163
TABLE OF CONTENTS 1. Introduction. 1.1 Introduction of the Company 1.1. Objectives Of The Project. 2. System Analysis 2.1. Identification Of The Need 2.2. Preliminary Investigation 2.3. Feasibility Study 2.3.1. Technical Feasibility 2.3.2. Economical Feasibility 2.3.3. Operational Feasibility 2.4. Proposed System Functionality 3. Software Engineering Paradigm Applied 4. Software Project Development Methodology. 5. Design 5.1. Data Flow Diagram (DFD) 5.2. Database Design 5.3. Logical Design (Flowchart) 5.4. Entity Relationship Diagram 1

Final Documentation 1

Embed Size (px)

Citation preview

Page 1: Final Documentation 1

TABLE OF CONTENTS

1. Introduction.

1.1 Introduction of the Company

1.1. Objectives Of The Project.

2. System Analysis

2.1. Identification Of The Need

2.2. Preliminary Investigation

2.3. Feasibility Study

2.3.1. Technical Feasibility

2.3.2. Economical Feasibility

2.3.3. Operational Feasibility

2.4. Proposed System Functionality

3. Software Engineering Paradigm Applied

4. Software Project Development Methodology.

5. Design

5.1. Data Flow Diagram (DFD)

5.2. Database Design

5.3. Logical Design (Flowchart)

5.4. Entity Relationship Diagram

1

Page 2: Final Documentation 1

6. Coding

7. Screen Layouts

8. Testing

9. Implementation

10. Maintainence

11. Limitations and Future Scope Of The Project

12. Conclusion

13. Bibliography

2

Page 3: Final Documentation 1

SECTION 1

INTRODUCTION

1.1 Introduction of the company

1.2 Objectives Of The Project

3

Page 4: Final Documentation 1

OBJECTIVES OF THE PROJECT

What was the Problem?

Existing system was manual.

Time consuming as data entry which include calculations took lot

of time.

Searching was very complex as there could be 100’s of entry

every year.

The proposed system is expected to be faster than the existing

system.

The Project was made in order to effectively and efficiently cater

to requirements of a the company.Very frequently the personnels

who generally holds the tasks to manage the store called

“salespersons” needs to keep records of all the transactions as

well as data mannually . Gennerally, In order to structure these

tasks ,Separate Registers are maintained.This whole process thus

becomes quite cumbersome for them to control

manually.Moreover,Any wrong data entered mistakenly can

brings serious results.

This Mannually Managed system of the store was also heavily

proned to data loss due to certain causes Misplacement of

Registers,Destruction of Registers ,Unauthorized access to

registers etc. which can bring in disasterous Consquences.

The cost of maintaince of data and records of occurrence of

transactions is very high.

4

Page 5: Final Documentation 1

Searching a particular data specific to particular requirements is

also very tedious in such system.In order to retrieve records,The

manager needs to manually locate the appropriate register and

locate the appropriate placement of that particular record which

may be very time consuming.

Data Redundency is also a great issue in such kind of

system.”Redundency” means repititon;Thus data modified or

updated at a particular place may not be data modified or

updated at the other related place which may create

inconsistencies in data handelling,Destroys Data Integrity and

creates confusion for the store owner.

What the Software Provides in this Regard?

The software is capable enough to allow the concerned person to

store and retrieve any type of record with just a single click of

mouse.The software allows Interactive ,Self decribing Graphic User

Interface environment where even standalone users can work very

comfortably and easily.Usage of Short keys are also permitted in

order to render more flexibility to the project.

All the data pertaining to transactions or other important entities is

kept at central database from where its attributes can be easily

controlled.But,Such kind of technical details are hidden from the

standalone User. He just needs to type in correct details of the given

entity and then click the save button with the help of

mouse.However,That central repository of data can be easily

accessed if required.

Data Redundency is no more the problem now.The data modified

from one particular data entry form will reflect the modifications at

5

Page 6: Final Documentation 1

the other related forms too.This has thus reduced the chances of

data inconsistency in our data storage.

There is no need to manage bulky registers now as data stored in

the backend database can be radily retrieved either from the

frontend form itself or directly from the database.

Requires one time investment of setting up required Hardware and

Software after which no more headache is required by the

Managers.Moreover,It also reduces dependence on Man Power.

Effective Search measures are present at each and every data

transactional forms from where by just entering a Unique keyword

for that data its whole records can be readily seen within

microseconds.Moreover,Facillity of Updation and Deletion of data

through search is also available.

6

Page 7: Final Documentation 1

SECTION 2

SYSTEM ANALYSIS

2.1 Identification Of The Need

2.2 Preliminary Investigation

2.3 Feasibility Study

2.3.1 Technical Feasibility

2.3.2 Economical Feasibility

2.3.3 Operational Feasibility

2.3.4 Behavioural Feasibility

2.4 Proposed System Functionality

7

Page 8: Final Documentation 1

System Analysis refers into the process of examining a situation with

the intent of improving it through better procedures and methods.

System Analysis is the process of planning a new System to either

replace or complement an existing system. But before any planning is

done the old system must be thoroughly understood and the

requirements determined. System Analysis, is therefore, the process of

gathering and interpreting facts, diagnosing problems and using the

information to re-comment improvements in the System. Or in other

words, System Analysis means a detailed explanation or description.

Before computerized a system under consideration, it has to be

analyzed. We need to study how it functions currently, what are the

problems, and what are the requirements that the proposed system

should meet.

System Analysis is conducted with the following objectives in mind:

1. Identify the customer’s need.

2. Evaluate the system concept for feasibility.

3. Perform economic and technical analysis.

4. Allocate functions to hardware, software people, database and other system elements.

5. Establish cost and schedule constraints.

6. Create a system definition that forms the foundation for all the subsequent engineering work.

2.1 Identification of Customer’s Need

Before proceding further ,It becomes very necessary to accumilate

the valid and conviencing requirements of the project and

communicate the very same to various stakeholders of the project.

8

Page 9: Final Documentation 1

This step is initiation of System Analysis. An overview of the client’s

requirement has been done. The basic need of the client to opt for

such kind of project is analysed. As per current marketing scenario,

an entire system was required to track day-to-day transactions.

Client was following a Manual Process, which is not at all

compatible with its current working conditions. It was not only time

consuming, but also lacks accuracy. Security point of view the

manual system was failed to hide the information from any

unauthenticiated staff or any outside person. Therefore, there was

an urgent requirement of such Computerised System which can

fullfill all of its current as well as future requirements. Furhter

more, data handelling was also posing a serious problem for them.

2.2 Preliminary Investigation

The client set is a group of workers,salespersons that are regularly

indulged in manual maintainence transactions,Keeping regular

records for sale and purchase accounts,Maintaining the records of

fine details of members. The whole of the client group is managed

by Store Manager Who has overall responsibility to hire & Fire other

employees .In the Existing system of Inventory. The Records are

maintained in various hand writtern documents. The hand written

documents invloved in this process are following:

Customer’s Details Register:

This Register is maintained in liu to maintain the records of the

various customers of the store.The document contains relevant

information about the various customers such as Customer’s

Number, Name,Address,Telephone number.

Supplier’s Details Register:

9

Page 10: Final Documentation 1

This Register is maintained in liu to maintain the records of the

various suppliers of the products.The document contains relevant

information about the various customers such as supplier’s ID,

Name, Contact person, Address, Telephone number,Products.

Products Register:

The register is used to record the details of the products such as

Product’s ID,Description,Quantity,Price,Selling Price,Reorder

Point,Expiry Date.

Orders Detail Register:

The register is used to record the details of the orders made such

as Order Number,Product Description,Price,Quantity,Total

Amount,Date,Supplier. It also keeps the records of the pending

orders and delivered orders.

2.3 Feasibilty Study

Depending on the results of the initial investigation, the

survey is expanded to a more detailed feasibility study.

Feasibility study is a test of system proposal according to

its workability, impact on the organization, ability to meet

user needs, and effective use of resources. The objective of

the feasibility study is not to solve the problem but to

acquire a sense of its scope . During the study, the problem

10

Page 11: Final Documentation 1

definition is crystallized and aspects of the problem to be

included in the system are determined. Consequently, costs

and benefits are described with greater accuracy at this

stage.

It consists of the following:

1. Statement of the problem:

A carefully worded statement of the problem that led

to analysis.

2. Summary of finding and recommendations:

A list of the major findings and recommendations of the

study. It is ideal for the user who requires quick access

to the results of the analysis of the system under

study. Conclusion are stated , followed by a list of the

recommendation and a justification for them .

3. Details of findings :

An outline of the methods and procedures under-taken

by the existing system, followed by coverage of the

objectives and procedures of the candidate system.

Included are also discussions of output reports, file

structures, and costs and benefits of the candidate

system.

4. Recommendations and conclusions:

11

Page 12: Final Documentation 1

Specific recommendations regarding the candidate

system, including personnel assignments, costs, project

schedules, and target dates.

2.3.1 Technical Feasibility

Technical feasibility centers around the existing computer

system (Hardware and Software etc) and to what extend it

support the proposed addition. For example, if the current

computer is operating at 80 percent capacity - an arbitrary

ceiling - then running another application could overload the

system or require additional Hardware. This involves financial

considerations to accommodate technical enhancements. If the

budgets is a serious constraint ,then the project is judged not

feasible. In this project, all the necessary cautions have been

taken care to make it technically feasible. Using a key the

display of text/object is very fast. Also, the tools, operating

system and programming language used in this localization

process is compatible with the existing one.

2.3.2 Economical Feasibility

Economic analysis is the most frequently used method for

evaluating the effectiveness of the candidate system. More

commonly known as cost/benefit analysis, the procedure is to be

determining the benefits and savings that are expected from a

candidate and compare them with costs. If benefits outweigh

costs, then the decision is made to design and implement the

system.

12

Page 13: Final Documentation 1

A systems financial benefit must exceed the cost of developing

that system. i.e. a new system being developed should be a

good investment for the organization. Economic feasibility

considers the following:

i. The cost to conduct a full system investigation.

ii. The cost of hardware and software for the class of

application.

iii. The benefits in the form of reduced cost or fewer costly

errors.

iv. The cost if nothing changes (i.e. The proposed system is not developed).

The proposed “INVENTORY MANAGMENT” is economically

feasible because

i. The system requires very less time factors.

ii. The system will provide fast and efficient automated

environment instead of slow and error prone manual

system, thus reducing both time and man power

spent in running the system.

iii. The system will have GUI interface and very less user

training is required to learn it.

iv. The system will provide service to view various

information for proper managerial decision making.

2.3.3 Operational Feseability

This Application is very easy to operate as it is made user

friendly with the help of very effective GUI tools . Main

consideration is user’s easy access to all the functionality of the

Application.Another main consideration is here is that whether

user organization is trained enough to use the newer

application. Here every functionality is As per previous

13

Page 14: Final Documentation 1

operational strategy which is not expected to be cumbersome to

the potential clients.

2.3.4 Behavioural Feasibility

People are inherently resistant to change, and computers have

been known to facilitate change. An estimate should be made of

how strong a reaction the user staff is likely to have toward the

development of a computerized system. Therefore it is

understandable that the introduction of a candidate system

requires special efforts to educate and train the staff.The

software that is being developed is user friendly and easy to

learn.In this way, the developed software is truly efficient and

can work on any circumstances ,tradition ,locales.

Behavioral study strives on ensuring that the equilibrium of the

organization and status quo in the organization are nor

disturbed and changes are readily accepted by the users.

2.4 Proposed System Functionality

The proposed system will be designed to support the following

features:-

The proposed system has a user friendly Interface for porting

of data to server.

The proposed system provides the facility to pull the data from

the server of the specified Supply order number and get the

respective report.

14

Page 15: Final Documentation 1

The proposed system provides the no replication of data

User can get the desired output according to their queries .This is

an added advantage.

15

Page 16: Final Documentation 1

SECTION 3

SOFTWARE ENGINEERING PARADIGM APPLIED

Software Engineering

The basic objective of software engineering is to: develop methods

and procedures for software development that can scale up for large

systems and that can be used to consistently produce high quality

software at low cost and with a small cycle time. That is, the key

objectives are consistency, low cost, high quality, small cycle time,

and scalability.

16

Page 17: Final Documentation 1

The basic approach that software engineering takes is to separate the

development process from the software. The premise is that the

development process controls the quality, scalability, consistency, and

productivity. Hence to satisfy the objectives, one must focus on the

development process. Design of proper development process and

their control is the primary goal of the software engineering. It is this

focus on the process that distinguishes it from most other computing

desciplines. Most other computing disciplines focus on some type of

the product-algorithms, operating systems, databases etc. while

software engineering focuses on the process for producing products.

To better manage the development process and to achieve

consistency, it is essential that the software development be done in

phases.

Different Phases Of The Development Process:

1) Requirement Analysis

Requirement analysis is done in order to understand the problem the

software system is to solve. The problem could be automating an

existing manual process, developing a new automated system, or a

combination of the two. The amphasis in requirements analysis is on

identifying what is needed from the system, not how the system will

17

Page 18: Final Documentation 1

achieve its goals. There are atleast two parties involved in the

software development-a client and a developer. The developer has

to develop the system to satisfy the client’s needs. The developer

does not understand the client’s problem domain, and the client

does not understand the issues involved in the software systems.

This causes a communication gap, which has to be adequately

bridged during requirements analysis.

2) Software Design

The purpose of the design phase is to plan a solution of the problem

specified by the requirements documents. This phase is the first step

in moving from the problem domain to the solution domain. Starting

with what is needed, design takes us toward how to satisfy the

needs. The design of a system is perhaps the most critical factor

affecting the quality of the software. It has a major impact on the

later phases, particularly testing and maintenance.

The design activity is divided into two phases: System Design and

Detailed Design. In system design the focus is on identifying the

modules, whereas during detailed design the focus is on designing

the logic for each of the modules.

3) Coding

The goal of the coding phase is to translate the design of the system

into code in a given programming language. Hence during coding,

the focus should be on developing programs that are easy to read

and understand, and not simply on developing programs that are

easy to write.

4) Testing

Testing is the major quality control measure used during software

development. Its basic function is to detect errors in the software.

Testing not only uncover errors introduced during coding, but also

errors introduced during the previous phases. Thus, the goal of the

18

Page 19: Final Documentation 1

testing is to uncover requirement, design and coding errors in the

programs. Therefore, different levels of testing are used. Testing is

an extremely critical and time consuming activity. It requires proper

planning of the overall testing process. The output of the testing

phase is the test report and the error report. Test report contains

the set of test cases and the result of executing the code with these

test cases. The error report describes the errors encountered and

the action taken to remove the errors.

5) Implementation

It is the process of having systems personnel check out and put new

equipment into use, train users, install the new application and

construct any files of data needed to use it. This phase is less

creative than system design. Depending on the size of the

organization that will be involved in using the application and the

risk involved in its use, systems developers may choose to test the

operation in only one area of the firm with only one or two persons.

Sometimes, they will run both old and new system in parallel way to

compares the results.

Paradigm Applied

In this project,The Spiral Model is applied in order to provide rigid

efficiency and functionality in the overall working style of the

project.Moreover, In order to cater to new or modified requirements

of the user, Spiral model is very effective .I used “The Spiral model”

as it is best suited to those development environments where

probability of uncertainity is very high and chances of mistakes are

uncontrollable.

What about Spiral Model?

The spiral model is a software development process combining

elements of both design and prototyping-in-stages, in an effort to

19

Page 20: Final Documentation 1

combine advantages of top-down and bottom-up concepts. Also

known as the spiral lifecycle model, it is a systems development

method (SDM) used in information technology (IT). This model of

development combines the features of the prototyping model and

the waterfall model. The spiral model is intended for large, expensive

and complicated projects.

The steps in the spiral model can be generalized as follows:

1. The new system requirements are defined in as much detail as

possible. This usually involves interviewing a number of users

representing all the external or internal users and other aspects

of the existing system.

2. A preliminary design is created for the new system.

20

Page 21: Final Documentation 1

3. A first prototype of the new system is constructed from the

preliminary design. This is usually a scaled-down system, and

represents an approximation of the characteristics of the final

product.

4. A second prototype is evolved by a fourfold procedure:

1. Evaluating the first prototype in terms of its strengths,

weaknesses, and risks;

2. Defining the requirements of the second prototype;

3. Planning and designing the second prototype;

4. Constructing and testing the second prototype.

5. At the customer's option, the entire project can be aborted if the

risk is deemed too great. Risk factors might involve development

cost overruns, operating-cost miscalculation, or any other factor

that could, in the customer's judgment, result in a less-than-

satisfactory final product.

6. The existing prototype is evaluated in the same manner as was

the previous prototype, and, if necessary, another prototype is

developed from it according to the fourfold procedure outlined

above.

7. The preceding steps are iterated until the customer is satisfied

that the refined prototype represents the final product desired.

8. The final system is constructed, based on the refined prototype.

9. The final system is thoroughly evaluated and tested. Routine

maintenance is carried out on a continuing basis to prevent large-

scale failures and to minimize downtime.

Applications

The spiral model is used most often in large projects. For smaller

projects, the concept of agile software development is becoming a

21

Page 22: Final Documentation 1

viable alternative.

Advantages

Estimates (i.e. budget, schedule, etc.) become more realistic as

work progresses, because important issues are discovered earlier.

It is more able to cope with the changes that software

development generally entails. Software engineers can get their

hands in and start working on the core of a project earlier.

SECTION 4

Software Project Development Methodology

22

Page 23: Final Documentation 1

The Methodology:

I was assigned the duty for developing a computerized system

known as “Inventory Management System”. The project time and

resources were very limited . The optimum use of practical time

neccessiates that every session and every activity is planned. For

effective Planning ,Efficient Project Managerial skils are

required,Efficiant skills then trace out best methodology to be used.

The methodology used by me includes the following things:

Topic Understanding:

It is vital that the field of application as introduced in the project

may be totally a new field. So as soon as the project was allocated

to me, I carefully went through the project requirements to identify

the requirements of the project.

Modular Break –Up Of The System:

Identify The Various Modules In The System.

List Them In The Right Hierarchy.

Identify Their Priority Of Development.

23

Page 24: Final Documentation 1

Different Modules In Computerised System

Modules – This project consists of different interfaces which will be

accessed through a MDI (Multiple Document Interface) window.

Different modules that makeup this system have already been a

described in system analysis.

Module 1: Ordering Module

In this module, User can see the ordering details which includes :

i. Order Number

ii. Supplier

iii. Date

iv. Product:

Product code

Product Name

Quantity

Unit Price

Units in Stock

Total Amount

Then as per the user requirements processes are performed.

Module 2:Sales Module

In this module user can see the sales details including the fields:

24

Page 25: Final Documentation 1

i. Customer type:

Regular

Non regular

ii. Customer number

iii. Name

iv. Table include:

Product id

Description

Quantity

Selling price

Reorder point

Expiry date

Module 3: Supplier’s Records

This module consists of the list of suppliers which can be

displayed by various options such as:

Search for

Search by

Sort by

Various operations such as addition of new record,Updation of

records,Deletion of records or viewing all the records can be

treated on the data stored at the backend database.

This includes the fields:

i. Supplier id

ii. Supplier name

iii. Contact person

iv. Address

v. Telephone number

vi. products

Module 4: Customer’s Records

25

Page 26: Final Documentation 1

This module displays the customer’s list.Various operations such

as addition of new record,Updation of records,Deletion of records

or viewing all the records can be treated on the data stored at the

backend database.

This includes the fields:

i. Customer number

ii. Name

iii. Telephone number

iv. Address

Module 5:Product’s Module

This module consists of the list of customers which can be

displayed by various options such as:

Search for

Search by

Sort by

Various operations such as addition of new record,Updation of

records,Deletion of records or viewing all the records can be

treated on the data stored at the backend database

Product fields include:

i. Product id

ii. Description

iii. Quantity

iv. Price

v. Selling price

vi. Reorder point

vii. Expiry date

Module 6:Order list Module

26

Page 27: Final Documentation 1

This module includes details of the orders made whether its

pending or delivered.

Fields include:

i. Order number

ii. Product description

iii. Price

iv. Quantity

v. Total amount

vi. Date

vii. Supplier

Module 7:orders delivered Module

This module gives the list of the orders that are delivered.

Fields include

i. Order number

ii. Product description

iii. Price

iv. Quantity

v. Total amount

vi. Date

vii. Supplier

Module8: sales list Module

This module displays the list of sales done in various transactions.

Fields include:

i. Transaction number

ii. Product

iii. Quantity

iv. Price

v. Total

vi. Date

vii. Customer type

27

Page 28: Final Documentation 1

Functional Decomposition Diagram of the Software Project

Principal Design Features

Visual Basic (VB) is a third-generation event-driven

programming language and associated development environment

(IDE) from Microsoft for its COM programming model. 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

28

Inventory management System

ordering sales suplliers customers

products Orders list

deliveries Sales list

Page 29: Final Documentation 1

declarations.

Characteristics present in Visual Basic

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

languages:

Boolean constant True has numeric value −1.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

microprocessor instructions at the time.

Logical and bitwise operators are unified. This is unlike all the C-

derived languages (such as Java or 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 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

29

Page 30: Final Documentation 1

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.

INTRODUCTION OF Microsoft Access-2003

30

Page 31: Final Documentation 1

Microsoft Office Access, previously known as 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 2007

Microsoft Office system.

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

relative compatibility with SQL (structured query language) —queries

may be viewed and edited as SQL statements, and SQL statements can

be used directly in Macros and VBA Modules to manipulate Access

tables. Users may mix and use both VBA and "Macros" for programming

forms and logic and offers object-oriented possibilities.

MSDE (Microsoft SQL Server Desktop Engine) 2000, a mini-version of

Microsoft SQL Server 2000, is included with the developer edition of

Office XP and may be used with Access as an alternative to the Jet

Database Engine.

Unlike a modern RDBMS, the Jet Engine implements database triggers

and stored procedures in a non-standard way. Stored Procedures are

implemented in VBA, and Triggers are only available from embedded

Forms. Both Triggers and Stored procedures are only available to

applications built completely within the Access database management

system. Client applications built with VB or C++ are not able to access

these features. Starting in Access 2000 (Jet 4.0), there is a new syntax

for creating queries with parameters, in a way that looks like creating

stored procedures, but these procedures are still limited to one

statement per procedure.Microsoft Access does allow forms to contain

code that is triggered as changes are made to the underlying table (as

long as the modifications are done only with that form), and it is

common to use pass-through queries and other techniques in Access to

run stored procedures in RDBMSs that support these.

Why I Used Ms Access?

31

Page 32: Final Documentation 1

I used Ms Access because it is simply available in almost all the

machines that is normally using Ms Office.

The Ms Access is easily portable from one machine to other Machine.

The MS Access has a good & Highly Interactive Graphic User

Interface.

The MS Access is less costlier then other RDBMSs’ for generalized

small scale use.

32

Page 33: Final Documentation 1

SECTION 5

DESIGN

5.1 Data Flow Diagram (DFD)

5.2 DataBase Design

5.3 Logical Design (Flowchart)

5.4 Entity Relationship Diagram

5.1 DATA FLOW DIAGRAM (DFD)

DFD is a model, which gives the insight into the information domain

and functional domain at the same time. DFD is refined into

33

Page 34: Final Documentation 1

different levels. The more refined DFD is, more details of the system

are incorporated. In the process of creating a DFD, we decompose

the system into different functional subsystems. The DFD refinement

results in a corresponding refinement of data.

Following is the DFD of the “Inventory Management System”. We

have refined the system up to two levels. Each break-up has been

numbered as per the rule of DFD. We have tried to incorporate all

the details of the system but there is some chance of further

improvisation because of the study that is still going on for the

project development.

The Context Diagram or the Zero Level DFD .

The First level DFD

34

Ordering

Sales

Customer,s Records

INVENTORY MANAGEMENT

SYSTEM

Database Operations on products record

Suppliers

Products Records

Sales List

Database Operations on sales recordMember’s Record

Database Operations on customers record

Database Operations on products record

Transaction Performed

Orders List

Deliveries

Page 35: Final Documentation 1

Context Level or Zero Level DFD

This level shows the overall context of the system and it's operating

35

Page 36: Final Documentation 1

environment and shows the whole system as just one process. It does

not usually show data stores, unless they are "owned" by external

systems, e.g. are accessed by but not maintained by this system,

however, these are often shown as external entities.

Level 1 DFD

This level is a decomposition of a process shown in a level 0 diagram,

as such there should be a level 1 diagram for each and every process

shown in a level 0 diagram. In this processes 1, 2 are described I

details. A level 1 diagram must be balanced with its parent level 0

diagram.

5.2 DATABASE DESIGN

Introduction

Database

36

Page 37: Final Documentation 1

A Database is the systematic collection of logically related Data

with some inherent purpose to access and operate on various

different data stored in the form of records so as to raise the ease

and esfficiancy in data Handelling.

Relational database

It is one which works upon the specification of relational model

which is a database model based on first-order predicate logic,

first formulated and proposed in 1969 by Edgar Codd.

Its core idea is to describe a database as a collection of

predicates over a finite set of predicate variables, describing

constraints on the possible values and combinations of values.

The content of the database at any given time is a finite model

(logic) of the database, i.e. a set of relations, one per predicate

variable, such that all predicates are satisfied. A request for

information from the database (a database query) is also a

predicate.

The purpose of the relational model is to provide a declarative

method for specifying data and queries: we directly state what

information the database contains and what information we want

from it, and let the database management system software take

care of describing data structures for storing the data and

retrieval procedures for getting queries answered.

Structured Query Language

It is a database computer language designed for the retrieval

and management of data in relational database management

systems (RDBMS), database schema creation and modification,

and database object access control management.

37

Page 38: Final Documentation 1

SQL is a standard interactive and programming language for

querying and modifying data and managing databases.

Although SQL is both an ANSI and an ISO standard, many

database products support SQL with proprietary extensions to

the standard language. The core of SQL is formed by a

command language that allows the retrieval, insertion,

updating, and deletion of data, and performing management

and administrative functions.

Database Tables

A table is a set of data elements (values) that is organized using

a model of vertical columns (which are identified by their name)

and horizontal rows. A table has a specified number of columns,

but can have any number of rows.

List of Tables in Database :

Name of Database is inventory.mdb

Table 1: ORDERS

38

Page 39: Final Documentation 1

Table 2: SALES

39

Page 40: Final Documentation 1

Table 3: SUPPLIERS

40

Page 41: Final Documentation 1

Table 4: CUSTOMERS

41

Page 42: Final Documentation 1

Table 5: PRODUCTS

42

Page 43: Final Documentation 1

Table 6: ORDER_TOTAL

43

Page 44: Final Documentation 1

Table 7: SALES_TOTAL

44

Page 45: Final Documentation 1

Table 8: DELIVERED

45

Page 46: Final Documentation 1

5.3 Logical Design(Flowcharts)

Module 1: Product Details

46

Start

Page 47: Final Documentation 1

Yes

No

Module 2:Customer Details

47

Obtain Details of Products Store

Input Data to Dbase

Want to perform Transactions

Perform searching and sorting operations

Want to view previous Details

Obtain Details

End

Obtain Details of customers Store

Start

Page 48: Final Documentation 1

Yes

No

Module 3:Supplier Details

48

Input Data to Dbase

Want to perform

Transactions

Perform searching and

sorting operations

Want to view

previous Details

Obtain Details

End

Obtain Details of the suppliers Store

Start

Page 49: Final Documentation 1

Yes

No

5.4 ENTITY-RELATIONSHIP DIAGRAM

49

Input Data to Dbase

Want to perform

Transactions

Perform searching and sorting operations

Want to view

previous Details

Obtain Details

End

Page 50: Final Documentation 1

PRODUCT CUSTOMER

SALESSUPPLIER

ORDER

Prod_id

Prod_desc

Cust_name

Exp_date

ROPSell_price

price

quantity

Cust_add

Cust_tel

Cust_num

contact Sup_addSup_tel

itemsSup_name

Sup_id

orderno

Prod_desc

price

quantity

total

date

supplier

customersdate

total

price

Prod_desc

quantity

salesno

Inventory Managemen

t

50

Page 51: Final Documentation 1

SECTION 7

SCREEN LAYOUTS

Menu Interface of Inventory Management System

51

Page 52: Final Documentation 1

ORDERING

52

Page 53: Final Documentation 1

SALES

53

Page 54: Final Documentation 1

54

Page 55: Final Documentation 1

SUPPLIERS

1.ADD

55

Page 56: Final Documentation 1

2.EDIT

56

Page 57: Final Documentation 1

3.DELETE

CUSTOMERS

57

Page 58: Final Documentation 1

1.ADD/EDIT

58

Page 59: Final Documentation 1

2.DELETE

59

Page 60: Final Documentation 1

60

Page 61: Final Documentation 1

PRODUCTS

1.ADD/EDIT

61

Page 62: Final Documentation 1

2.DELETE

62

Page 63: Final Documentation 1

PRODUCTS LIST

PENDING

DELIVERED

63

Page 64: Final Documentation 1

SALES LIST

64

Page 65: Final Documentation 1

SECTION 8

TESTING

Levels of Testing:

Systems are not designed as entire systems nor are they tested as

single systems. The analyst must perform both unit and system testing.

Unit Testing:

In unit testing the analyst tests the programs making up a

system. For this reason, unit testing is sometimes called program

testing. Unit testing gives stress on the modules independently of

one another, to find errors. This helps the tester in detecting

errors in coding and logic that are contained within that module

alone. The errors resulting from the interaction between modules

are initially avoided. For example, a hotel information system

consists of modules to handle reservations; guest checkin and

checkout; restaurant, room service and miscellaneous charges;

convention activities; and accounts receivable billing. For each, it

provides the ability to enter, modify or retrieve data and respond

65

Page 66: Final Documentation 1

to different types of inquiries or print reports. The test cases

needed for unit testing should exercise each condition and option.

Unit testing can be performed from the bottom up, starting with

smallest and lowest-level modules and proceeding one at a time.

For each module in bottom-up testing a short program is used to

execute the module and provides the needed data, so that the

module is asked to perform the way it will when embedded within

the larger system.

System Testing:

The important and essential part of the system development

phase, after designing and developing the software is system

testing. We cannot say that every program or system design is

perfect and because of lack of communication between the user

and the designer, some error is there in the software

development. The number and nature of errors in a newly

designed system depend on some usual factors like

communication between the user and the designer; the

programmer's ability to generate a code that reflects exactly the

systems specifications and the time frame for the design.

Theoretically, a newly designed system should have all the parts

or sub-systems are in working order, but in reality, each sub-

system works independently. This is the time to gather all the

subsystem into one pool and test the whole system to determine

whether it meets the user requirements. This is the last change to

detect and correct errors before the system is installed for user

acceptance testing. The purpose of system testing is to consider

all the likely variations to which it will be subjected and then push

the system to its limits.

66

Page 67: Final Documentation 1

Testing is an important function to the success of the system.

System testing makes a logical assumption that if all the parts of

the system are correct, the goal will be successfully activated.

Another reason for system testing is its utility as a user-oriented

vehicle before implementation.

System testing consists of the following five steps:

1) Program Testing

A program represents the logical elements of a system. For a

program to run satisfactorily, it must compile and test data

correctly and tie in properly with other programs. it is the

responsibility of a programmer to have an error free program. At

the time of testing the system, there exists two types of errors

that should be checked. These errors are syntax and logic. A

syntax error is a program statement that violates one or more

rules of the language in which it is written. An improperly defined

field dimension or omitted key words are common syntax errors.

These errors are shown through error messages generated by the

computer. A logic error, on the other hand, deals with incorrect

data fields out of range items, and invalid combinations. Since the

logical errors are not detected by compiler, the programmer must

examine the output carefully to detect them.

When a program is tested, the actual output is compared with the

expected output. When there is a discrepancy, the sequence of

the instructions, must be traced to determine the problem. The

process is facilitated by breaking the program down into self-

contained portions, each of which can be checked at certain key

points.

67

Page 68: Final Documentation 1

2) String Testing

Programs are invariably related to one another and interact in a

total system. Each program is tested to see whether it conforms

to related programs in the system. Each part of the system is

tested against the entire module with both test and live data

before the whole system is ready to be tested.

3) System Testing

System testing is designed to uncover weaknesses that were not

found in earlier tests. This includes forced system failure and

validation of total system as it will be implemented by its user in

the operational environment. Under this testing, generally we

take low volumes of transactions based on live data. This volume

is increased until the maximum level for each transaction type is

reached. The total system is also tested for recovery and fallback

after various major failures to ensure that no data are lost during

the emergency. All this is done with the old system still in

operation. When we see that the proposed system is successful in

the test, the old system is discontinued.

4) System Documentation

All design and test documentation should be well prepared and

kept in the library for future reference. The library is the central

location for maintenance of the new system.

5) User Acceptance Testing

An acceptance test has the objective of selling the user on the

validity and reliability of the system. It verifies that the system's

procedures operate to system specifications and that the integrity

of important data is maintained. Performance of an acceptance

test is actually the user's show. User motivation is very important

68

Page 69: Final Documentation 1

for the successful performance of the system. After that a

comprehensive test report is prepared. This report shows the

system's tolerance, performance range, error rate and accuracy.

Special Systems Tests:

There are other six tests which fall under special category. They are

described below:

Peak Load Test : It determines whether the system will handle

the volume of activities that occur when the system is at the peak

of its processing demand. For example, test the system by

activating all terminals at the same time.

Storage Testing: It determines the capacity of the system to

store transaction data on a disk or in other files. For example,

verify documentation statements that the system will store

10,000 records of 400 bytes length on a single flexible disk.

Performance Time Testing: it determines the length of time

system used by the system to process transaction data. This test

is conducted prior to implementation to determine how long it

takes to get a response to an inquiry, make a backup copy of a

file, or send a transmission and get a response.

Recovery Testing: This testing determines the ability of user to

recover data or re-start system after failure. For example, load

backup copy of data and resume processing without data or

integrity loss.

Procedure Testing: It determines the clarity of documentation

on operation and use of system by having users do exactly what

manuals request. For example, powering down system at the end

of week or responding to paper-out light on printer.

69

Page 70: Final Documentation 1

Human Factors Testing: It determines how users will use the

system when processing data or preparing reports.

SECTION 9

IMPLEMENTATION

9.1 Hardware Requirement

9.2 Software Requirement

70

Page 71: Final Documentation 1

After completing the packaging process and produced distribution

media for the application, The application requires perfectly working

Microsoft Visual Studio 6.0 installed on the client system along with Ms

Offfice Access. It can run on all applicable operating systems.

9.1 Hardware Requirement

Hardware is the term given to machinery itself and to various individual

pieces of equipment. It refers to the physical devices of a computer

system. Thus the input, storage, processing control and output devices

are hardware.

Minimum Hardware Requirement Of Client Side:

Processor: Any Pentium or Equivalent Machine

RAM: 16 MB

HDD: 1.2 GB

FDD: 1.44 MB

CD-ROM: 32X

14 inches Color Monitor

104 Keys Keyboards

Printer: DeskJet 670 C

9.2 Software Requirement

Software means a collection of program where the objective is to

enhance the capabilities of the hardware machine.

Minimum Software Requirement Of Client Side:

71

Page 72: Final Documentation 1

Operating System : Windows 9x/NT/2000/Xp

Database : Microsoft Office Access

Front-end : Visual Basic 6.0

IMPLEMENTATION

Once the system was tested, the implementation phase started. A

crucial phase in the system development life cycle is successful

implementation of new system design. Implementations simply mean

converting new system design into operation. This is the moment of

truth the first question that strikes in every one’s mind that whether the

system will be able to give all the desires results as expected from

system. The implementation phase is concerned with user training and

file conversion.

The term implementation has different meanings, ranging from the

conversion of a basic application to a complete replacement of

computer system Implementation is used here to mean the process of

converting a new or revised system design into an operational one.

Conversion is one aspect of implementation. The other aspects are the

post implementation review and software maintainence. There are

three types of implementation:

Implementation of a computer system to replace a manual

system

Implementation of a new computer system to replace an existing

one.

Implementation of a modified application to replace an existing

one.

72

Page 73: Final Documentation 1

Conversion

Conversion means changing from one system to another. The

objective is to put the tested system into operation while holding

costs, risks and personnel irritation to a minimum. It involves

creating computer compatible files; training the operational staff;

installing terminals and hardware. A critical aspect of conversion is

not disrupting the functioning of organization.

Direct Implementation In direct implementation; the previous system is stopped and new

system is started up coincidentally. Here there is a direct change

over from manual system to computer-based system. In direct

change over implementation; employess can face the problems.

Suppose our software is not working much efficiently as manual one

then we can’t find the defects in our software. It will not be beneficial

in finding errors.

The proposed system “Inventory Management” is fully

implemented using Direct Implementation.

73

Page 74: Final Documentation 1

SECTION 10

MAINTAINENCE

74

Page 75: Final Documentation 1

MAINTENANCE

Once the software is delivered and developed, it enters the

maintenance phase. All systems need maintenance. Software needs to

be maintained because there are often some residual errors or bugs

remaining in the system that must be removed as they are discovered.

Many of these surfaces only after the system has been in operation

sometimes for a long time. These errors once discovered need to be

removed, leading to the software getting changed. Though Maintenance

is not a part of software development, it is an extremely important

activity in the life of a software product.

Maintenance involves understanding the existing software (code and

related documents), understanding the effects of change, making the

changes-to both the code and documents-testing the new parts and

retesting the old part.

75

Page 76: Final Documentation 1

SECTION 11

LIMITATIONS & FUTURE APPLICATION OF

PROJECT

76

Page 77: Final Documentation 1

Limitations of the Project

The future of the Project looks more promising.With the addition of

some more features the quality of the project will be really developed

enough to cater the needs of any kind of inventory system.

The capability of allowing Client Server interface if included in the

Project will allow multiple branches of the store to store the data

such that some center location from where different client

systems can store and retrieve the data.This will thus also allow

wide scale operation of the software.

Reports cannot be generated which is the biggest limitation.

Not protected as anybody can view the transactions and the

details of various customers and can also modify them.

77

Page 78: Final Documentation 1

SECTION 12

CONCLUSION

78

Page 79: Final Documentation 1

The objective of this project was to build a program for maintaining the

details of all Supply Order .The system developed is able to meet all the

basic requirements. It will provide the facility to the user so that they

can keep tracks of all the equipments being supplied. The management

of the Inventory will be also benefited by the proposed system, as it will

automate the whole supply procedure, which will reduce the workload.

The security of the system is also one of the prime concerns.

There is always a room for improvement in any software, however

efficient the system may be. The important thing is that the system

should be flexible enough for future modifications. The system has been

factored into different modules to make system adapt to the further

changes. Every effort has been made to cover all user requirements

and make it user friendly.

Goal achieved: The System is able provide the interface to the

user so that he can replicate his desired data. .

User friendliness: Though the most part of the system is

supposed to act in the background, efforts have been made to

make the foreground interaction with user as smooth as possible.

Also the integration of the system with Inventory Management

project has been kept in mind throughout the development

phase.

79

Page 80: Final Documentation 1

SECTION 13

BIBLIOGRAPHY

80

Page 81: Final Documentation 1

Bibliography

www.wikipedia.com

www.codeproject.com

Visual Basic 6 Programming BIBLE by Eric A.Smith, Valor Whisler,

and Hank Marquis.

www.msdn.com

Introduction to Computers:Working with Access By Sanjay

Saxena.

81

Page 82: Final Documentation 1

SECTION 6

CODING

82

Page 83: Final Documentation 1

FORM2:CUSTOMER DATAPrivate Sub cmdexit_Click()Unload MeEnd Sub

Private Sub cmdsave_Click()Dim cID As IntegercID = 0If data(1) = "" ThenMsgBox "Please enter the name of the customer.."data(1).SetFocusExit SubElseIf data(3) = "" ThenMsgBox "Please enter the address."Exit SubEnd If

If data(2) <> "" Then If Not IsNumeric(data(2).Text) Then MsgBox "The telephone number you entered is invalid!" Exit Sub End IfEnd If

If customers.mowd = "add" Thencheck_RStemprstemp.Open "select * from customers", cnn

While rstemp.RecordCount > 0check_RStempcID = cID + 1rstemp.Open "select * from customers where cus_num = " & cID, cnnWend

83

Page 84: Final Documentation 1

cnn.Execute "insert into customers values(" & cID & ", '" & data(1) & "', '" & _data(2) & "', '" & data(3) & "')"

ElseIf customers.mowd = "edit" Thencnn.Execute "update customers set cus_name = '" & data(1) & "', cus_tel = '" & data(2) & _"', cus_add = '" & data(3) & "' where cus_num = " & data(0)End If

rs.Requery 1customers.fill

Unload Me

End Sub

84

Page 85: Final Documentation 1

FORM3:CUSTOMER LISTPublic mowd As String

Private Sub cmdAdd_Click()mowd = "add"Load cusDatacusData.Show 1End Sub

Private Sub cmddel_Click()If MsgBox("Do you really want to delete the record of " & cuslist.SelectedItem.SubItems(1), vbYesNo) = vbYes Thencnn.Execute "delete from customers where cus_num = " & cuslist.SelectedItem.Textrs.Requery 1fillEnd If

End Sub

Private Sub cmdedit_Click()Call cuslist_DblClickEnd Sub

Private Sub cmdexit_Click()Unload MeEnd Sub

Private Sub cuslist_DblClick()Dim x As Integermowd = "edit"cusData.data(0) = cuslist.SelectedItem.TextFor x = 1 To 3cusData.data(x) = cuslist.SelectedItem.SubItems(x)Next xLoad cusDatacusData.Show 1

85

Page 86: Final Documentation 1

End Sub

Private Sub Form_Load()check_RSrs.Open "select * from customers order by cus_num", cnn

fillEnd Sub

Public Sub fill()Dim x As Integer cuslist.ListItems.ClearWhile Not rs.EOF Set lst = cuslist.ListItems.Add(, , rs(0), , 1)For x = 1 To 3 lst.SubItems(x) = rs(x)Next xrs.MoveNextWend End Sub

86

Page 87: Final Documentation 1

FORM4:PRODUCT DATAPublic key As StringPublic pid As Integer

Private Sub cmdexit_Click()Unload MeEnd Sub

Private Sub cmdsave_Click()On Error GoTo oHINDE

pid = 0If main.mowd = "add" Then

If rstemp.State = 1 Then rstemp.Closerstemp.Open "select * from products", cnn

While rstemp.RecordCount > 0

pid = pid + 1If rstemp.State = 1 Then rstemp.Closerstemp.Open "Select * from products where prod_id = " & pid, cnnrstemp.Requery 1WendEnd IfIf IsDate(data(6).Text) = False ThenMsgBox "Please enter a valid date.", vbOKOnlyExit SubEnd If

If main.mowd = "add" Then

87

Page 88: Final Documentation 1

cnn.Execute "insert into products values (" & pid & ",'" & data(1) & "'," & _data(2) & "," & data(3) & "," & data(4) & "," & data(5) & ",'" & data(6) & "')"''main.check_RS''rs.Open "select * from products", cnnElseIf main.mowd = "edit" Then

cnn.Execute "update products set prod_id = " & data(0) & ", prod_desc = '" & _data(1) & "', quantity = " & data(2) & ", price =" & data(3) & ", sell_price = " & _data(4) & ", ROP = " & data(5) & ", exp_date = '" & data(6) & "' " & " where prod_id =" & keyEnd If

rs.Requery 1main.fill_listmain.cmdROP.Caption = "Switch to Normal mode"

main.ropUnload Me

Exit SuboHINDE:MsgBox Err.Description

End Sub

Public Sub freeze()Dim x As IntegerFor x = 0 To 6data(x).Enabled = FalseNext xcmdsave.Enabled = Falsecmdexit.Enabled = False

88

Page 89: Final Documentation 1

End SubPublic Sub UnFreeze()Dim x As IntegerFor x = 0 To 6data(x).Enabled = TrueNext xcmdsave.Enabled = Truecmdexit.Enabled = TrueEnd Sub

Private Sub data_GotFocus(Index As Integer)If Index = 7 Thendata(0).SetFocusfrmSupp.ano = "edit"Load frmSuppfrmSupp.Show 1ElseIf Index = 6 Thendt1.Visible = TrueEnd IfEnd Sub

Private Sub data_KeyPress(Index As Integer, KeyAscii As Integer)If KeyAscii = 13 Then SendKeys ("{TAB}")

End Sub

Private Sub dt1_Change()data(6) = dt1.Valuedt1.Visible = FalseEnd Sub

Private Sub Form_Load()'dt1.Value = data(6).TextIf main.mowd = "add" ThenLabel2.Visible = Falsedata(2).Visible = False

89

Page 90: Final Documentation 1

data(2) = "0"End IfEnd Sub

90

Page 91: Final Documentation 1

FORM5:ORDER PLACEMENT FORMPublic Onum As IntegerPublic Order_total As CurrencyPublic ayos As Boolean

Private Sub cmbProd_Click()

check_RSrs.Open "select prod_id, prod_desc, products.price, products.quantity from products where prod_desc = '" & cmbProd.Text & "'", cnn

For x = 0 To 3data(x) = rs(x)

Next xEnd Sub

Private Sub cmbsup_Click()

update_PRODEnd Sub

Private Sub cmbsup_GotFocus()If cmbsup.Locked = True ThenMsgBox "You can't select another supplier right now..", vbInformation, ""Exit SubEnd IfEnd Sub

91

Page 92: Final Documentation 1

Private Sub cmdexit_Click()Unload MeEnd Sub

Private Sub cmdGO_Click()Dim x As IntegerOn Error GoTo hellIf data(4).Text = "" ThenMsgBox "Please enter the quantity!"data(4).SetFocusExit SubEnd Ifcheck_RS1rs1.Open "select * from supplier where sup_name = '" & cmbsup.Text & "'", cnn

'temp = Val(data(3)) + Val(data(4))cnn.Execute "insert into orders values(" & txtOrder & ",'" & data(1) & "'," & _data(2) & ", " & data(4) & "," & data(5) & ",'" & txtdate & "'," & rs1(0) & ")" 'code to add quatity to the tabel PRODUCTS ''cnn.Execute "update products set quantity = " & temp & " where prod_id = " & data(0)

Order_total = Order_total + Val(data(5))update_Olistcheck_RStemprstemp.Open "select * from order_total where order_no = " & Onum, cnnIf rstemp.RecordCount = 0 Thencnn.Execute "insert into order_total values(" & Onum & "," & Order_total & ")"Elsecnn.Execute "update order_total set order_total.total = " & Order_total & " where order_no = " & OnumEnd If

92

Page 93: Final Documentation 1

cmbProd.RemoveItem (cmbProd.ListIndex)cmbProd.Refreshcmbsup.Locked = True

If cmbProd.ListCount <> 0 Then If MsgBox("Do you want to order again from this supplier? ", vbYesNo + vbQuestion, "??") = vbNo ThenMsgBox "The new order is saved successfully!"Load OrderPENDUnload MeOrderPEND.txtsearch = OnumOrderPEND.Show 1 End IfElse MsgBox "The new order is saved successfully! You have ordered all products from this supplier.. This form will now close ", vbInformation, "" Load OrderPEND Unload Me OrderPEND.txtsearch = Onum OrderPEND.Show 1 End If

For x = 0 To 5data(x) = ""Next x

93

Page 94: Final Documentation 1

Exit Subhell:MsgBox Err.DescriptionEnd Sub

Private Sub data_Change(Index As Integer)data(5).Text = (Val(data(4)) * Val(data(2)))End Sub

Private Sub Form_Load()ayos = Falsetxtdate = Datecmbsup.ClearOrder_total = 0check_RS1rs1.Open "select * from supplier", cnnWhile Not rs1.EOFcmbsup.AddItem (rs1(1))rs1.MoveNext

Wend

Onum = 1While ayos <> Truecheck_RSrs.Open "select * from orders", cnnWhile rs.RecordCount <> 0check_RSrs.Open "select * from orders where orders.orderno =" & Onum, cnnIf rs.RecordCount <> 0 ThenOnum = Onum + 1End If Wend

94

Page 95: Final Documentation 1

check_RStemprstemp.Open "select * from delivered where delivered.orderno = " & Onum, cnnIf rstemp.RecordCount <> 0 Then While rstemp.RecordCount <> 0 check_RStemp Onum = Onum + 1 rstemp.Open "select * from delivered where delivered.orderno = " & Onum, cnn WendEnd If

check_RS1rs1.Open "Select * from orders where orders.orderno = " & Onum, cnnIf rs1.RecordCount = 0 Then ayos = TrueWend

txtOrder = Onum

update_OlistEnd Sub

Public Sub update_SUP()cmbsup.Clear

check_RS1rs1.Open "select sup_name from supplier where items like '%" & cmbProd.Text & "%' order by sup_name asc ", cnnIf rs1.RecordCount = 0 Then cmdGO.Enabled = False If Me.Visible = True Then MsgBox "there is no supplier for this product!" 'cmdGO.Enabled = False Exit Sub

95

Page 96: Final Documentation 1

End IfElseWhile Not rs1.EOFcmbsup.AddItem (rs1(0))rs1.MoveNextWendEnd IfIf cmbsup.ListCount <> 0 Thencmbsup.ListIndex = 0cmdGO.Enabled = TrueEnd If

End Sub

Public Sub update_PROD()'check_RS1'rs1.Open "select * from supplier where sup_name = '" & cmbsup.Text & "'", cnncmbProd.Clearcheck_RSrs.Open "select * from products", cnn

While Not rs.EOFcheck_RStemprstemp.Open "select * from supplier where items like '%" & rs(1) & "%' and sup_name = '" & _cmbsup.Text & "'", cnnIf rstemp.RecordCount <> 0 ThencmbProd.AddItem (rs(1))End Ifrs.MoveNextWendEnd Sub

Public Sub update_Olist()Dim x As Integer

96

Page 97: Final Documentation 1

Olist.ListItems.Clearcheck_RS1rs1.Open "Select * from orders where orderno = " & Onum

If rs1.RecordCount = 0 Then Exit Sub

While rs1.EOF = False

Set lst = Olist.ListItems.Add(, , rs1(1), , 2) For x = 1 To 3 lst.SubItems(x) = rs1(x + 1) Next xrs1.MoveNextWend

Set lst = Olist.ListItems.Add(, , "")

lst.SubItems(2) = "Total Amount:" lst.SubItems(3) = Order_total

End Sub

97

Page 98: Final Documentation 1

FORM6:LIST OF PRODUCTS SUPPLIED AND NOT SUPPLIEDPublic mowd As StringPublic key As StringPublic sID As Integer

Private Sub cmdexit_Click()Unload MeEnd Sub

Private Sub cmdleft_Click()On Error GoTo MALIIf List2.SelCount = 0 ThenMsgBox "Please select a Product from the list. -->"Exit SubEnd IfList1.AddItem (List2.Text)List2.RemoveItem (List2.ListIndex)Exit SubMALI:MsgBox Err.DescriptionEnd Sub

Private Sub cmdok_Click()Dim max, x As IntegerDim str1 As StringIf List1.ListCount = 1 Thentxtprod = List1.List(0)ElseIf List1.ListCount = 0 Thentxtprod = ""Else

max = List1.ListCount For x = 0 To max - 2 str1 = str1 & List1.List(x) & "," Next x

98

Page 99: Final Documentation 1

txtprod = str1 & List1.List(max - 1)End If

UnFreezedata(1).SetFocusFrame1.Visible = False

End Sub

Private Sub cmdright_Click()On Error GoTo MALI

If List1.SelCount = 0 ThenMsgBox " <-- Please select a Product from the list."Exit SubEnd IfList2.AddItem (List1.Text)List1.RemoveItem (List1.ListIndex)Exit SubMALI:MsgBox Err.DescriptionEnd Sub

Private Sub cmdsave_Click()On Error GoTo oHinde2 sID = 0If mowd <> "edit" Then

If rstemp.State = 1 Then rstemp.Closerstemp.Open "select * from supplier", cnn

While rstemp.RecordCount > 0

99

Page 100: Final Documentation 1

sID = sID + 1If rstemp.State = 1 Then rstemp.Closerstemp.Open "Select * from supplier where sup_id = " & sID, cnnrstemp.Requery 1Wend End If If mowd = "edit" Thencnn.Execute "update supplier set sup_id = " & data(0) & ", sup_name = '" & _data(1) & "', contact = '" & data(2) & "', sup_add = '" & data(3) & "', sup_tel = '" & _data(4) & "', items = '" & txtprod & "' where sup_id = " & key

Else

cnn.Execute "insert into supplier values(" & sID & ",'" & data(1) & "','" & _data(2) & "','" & data(3) & "','" & data(4) & "','" & txtprod & "')"End If'check_RS1rs1.Requery 1frmSupp.fill_listUnload Me

Exit SuboHinde2:MsgBox Err.Description

End Sub

Public Sub update_list1()

100

Page 101: Final Documentation 1

'check_RS1'rs1.Open "select * from supplier where sup_name = '" & cmbsup.Text & "'", cnnList1.ClearList2.Clearcheck_RSrs.Open "select * from products", cnn

If mowd = "edit" ThenWhile Not rs.EOFcheck_RStemprstemp.Open "select * from supplier where items like '%" & rs(1) & "%' and supplier.sup_id = " & _data(0), cnnIf rstemp.RecordCount <> 0 ThenList1.AddItem (rs(1))ElseList2.AddItem (rs(1))

End Ifrs.MoveNextWendElseWhile Not rs.EOF

'List1.AddItem (rs(1))

List2.AddItem (rs(1))

rs.MoveNextWendEnd If

End Sub

Private Sub Command1_Click()

101

Page 102: Final Documentation 1

End Sub

Private Sub List1_DblClick()Call cmdright_ClickEnd Sub

Private Sub List2_DblClick()Call cmdleft_ClickEnd Sub

Private Sub txtprod_GotFocus()Frame1.Visible = Truedata(1).SetFocusupdate_list1freezeEnd SubPublic Sub freeze()Dim x As IntegerFor x = 0 To 5data(x).Enabled = FalseNext xcmdsave.Enabled = Falsecmdexit.Enabled = FalseEnd SubPublic Sub UnFreeze()Dim x As IntegerFor x = 0 To 5data(x).Enabled = TrueNext xcmdsave.Enabled = Truecmdexit.Enabled = TrueEnd Sub

102

Page 103: Final Documentation 1

FORM7:SUPPLIER DATA FORMPublic ano As String

Public Sub fill_list()Dim x As IntegerSUPlist.ListItems.ClearWhile Not rs1.EOF Set lst = SUPlist.ListItems.Add(, , rs1(0), , 1) For x = 1 To 5 lst.SubItems(x) = rs1(x) Next xrs1.MoveNextWendEnd Sub

Private Sub cmbOrder_Click()rsFILTER

End Sub

Private Sub cmbsearch_Click()rsFILTEREnd Sub

Private Sub cmbsort_Click()rsFILTER

End Sub

Private Sub cmdAdd_Click()frmSupData.mowd = "add"Load frmSupDatafrmSupData.Show 1End Sub

103

Page 104: Final Documentation 1

Private Sub cmddel_Click()If MsgBox("Do you really want to delete " & SUPlist.SelectedItem.SubItems(1), vbYesNo) = vbYes Thencnn.Execute "delete from supplier where sup_id = " & SUPlist.SelectedItem.Textrs1.Requeryfill_listEnd IfEnd Sub

Private Sub cmdedit_Click()Call SUPlist_DblClickEnd Sub

Private Sub cmdexit_Click()Unload MeEnd Sub

Private Sub Form_Load()If ano = "edit" ThencmdAdd.Visible = Falsecmdedit.Visible = Falsecmddel.Visible = FalseEnd If

check_RS1rs1.Open "select * from supplier", cnnfill_listEnd Sub

Public Sub rsFILTER()Dim sby, oby, Dasc As String'On Error GoTo uklo

104

Page 105: Final Documentation 1

If cmbsearch.ListIndex = -1 Then cmbsearch.ListIndex = 0If cmbOrder.ListIndex = -1 Then cmbOrder.ListIndex = 0If cmbsort.ListIndex = -1 Then cmbsort.ListIndex = 0

Select Case cmbsearch.ListIndexCase 0sby = "sup_id"Case 1sby = "sup_name"Case 2sby = "contact"Case 3sby = "sup_add"Case 4sby = "sup_tel"Case 5sby = "items"End Select

Select Case cmbOrder.ListIndexCase 0oby = "sup_id"Case 1oby = "sup_name"Case 2oby = "contact"Case 3oby = "sup_add"Case 4oby = "sup_tel"Case 5oby = "items"End Select

Select Case cmbsort.ListIndexCase 0

105

Page 106: Final Documentation 1

Dasc = " asc"Case 1Dasc = " desc"End Selectcheck_RS1

If cmbsearch.ListIndex <> 0 And cmbsearch.ListIndex <> 5 Then

rs1.Open "select * from supplier where " & sby & " like '" & txtsearch & "%' order by " & _oby & Dasc, cnn

ElseIf cmbsearch.ListIndex = 5 Thenrs1.Open "select * from supplier where items like '%" & txtsearch & "%' order by " & oby & Dasc, cnn'rs1.Open "SELECT * from supplier where items like '*los*' order by sup_id asc", cnnElseIf Not IsNumeric(txtsearch) Or txtsearch = "" Then 'MsgBox "Please enter a numeric " & cmbsearch.Text 'check_RS1 rs1.Open "Select * from supplier where sup_name like '%' order by " & oby & Dasc, cnn fill_list Exit Sub End If rs1.Open "Select * from supplier where " & sby & " like " & txtsearch & " order by " & oby & Dasc, cnnEnd Ifrs1.Requery 1fill_list

106

Page 107: Final Documentation 1

End Sub

Private Sub SUPlist_DblClick()Dim x As IntegerIf rs1.RecordCount = 0 Then Exit Sub

If ano = "edit" ThenfrmData.data(7) = SUPlist.SelectedItem.ListSubItems.Item(1).TextfrmData.data(8) = SUPlist.SelectedItem.TextUnload MeElsefrmSupData.mowd = "edit"frmSupData.key = SUPlist.SelectedItem.TextFor x = 1 To 4frmSupData.data(x) = SUPlist.SelectedItem.SubItems(x)Next xfrmSupData.data(0) = SUPlist.SelectedItem.TextfrmSupData.txtprod = SUPlist.SelectedItem.SubItems(5)Load frmSupDatafrmSupData.Show 1

End If

End Sub

Private Sub txtsearch_Change()rsFILTEREnd Sub

107

Page 108: Final Documentation 1

FORM8:PRODUCT INFORMATION FORMPublic mowd As StringPublic sby, oby, Dasc As String

Private Sub cmbOrder_Click()rsFILTER

End Sub

Private Sub cmbsearch_Click()rsFILTEREnd Sub

Private Sub cmbsort_Click()rsFILTEREnd Sub

Private Sub cmdAdd_Click()mowd = "add"

Load frmDatafrmData.Show 1End Sub

Private Sub cmddel_Click()If rs.RecordCount = 0 Then Exit SubIf MsgBox("Do you really want to delete this item: " & invlist.SelectedItem.SubItems(1) & "?", vbYesNo, "???") = vbYes Thencnn.Execute "Delete from products where prod_id = " & invlist.SelectedItem.Textcheck_RSrs.Open "Select * from products", cnnfill_list

108

Page 109: Final Documentation 1

End IfEnd Sub

Private Sub cmdedit_Click()mowd = "edit"invlist_DblClickEnd Sub

Private Sub cmdexit_Click()Unload MeEnd Sub

Private Sub cmdShow_Click()

End SubPublic Sub rop()If cmdROP.Caption = "Switch to ROP mode" Theninvlist.ForeColor = vbRedMe.Caption = "Products - ROP MODE"txtsearch.Enabled = Falsecmbsearch.Enabled = FalsecmdROP.Caption = "Switch to Normal mode"

If cmbOrder.ListIndex = -1 Then cmbOrder.ListIndex = 0If cmbsort.ListIndex = -1 Then cmbsort.ListIndex = 0

Select Case cmbOrder.ListIndexCase 0oby = "prod_id"Case 1oby = "prod_desc"

109

Page 110: Final Documentation 1

Case 2oby = "quantity"Case 3oby = "price"Case 4oby = "ROP"Case 5oby = "exp_date"End Select

Select Case cmbsort.ListIndexCase 0Dasc = " asc"Case 1Dasc = " desc"End Selectcheck_RSrs.Open "select * from products where ROP >= quantity order by " & oby & Dascfill_list

ElseMe.Caption = "Products - NORMAL MODE"invlist.ForeColor = vbBlacktxtsearch = ""txtsearch.Enabled = Truecmbsearch.Enabled = True

cmdROP.Caption = "Switch to ROP mode"rsFILTER

End If

110

Page 111: Final Documentation 1

End SubPrivate Sub cmdROP_Click()rop

End Sub

Private Sub Form_Load()check_RScheck_RS1rs.Open "select * from products", cnnrs1.Open "select * from supplier", cnnfill_listEnd Sub

Public Sub fill_list()Dim x As Integerinvlist.ListItems.ClearWhile Not rs.EOFSet lst = invlist.ListItems.Add(, , rs(0), , 1) For x = 1 To 6 lst.SubItems(x) = rs(x) Next x' check_RS1' rs1.Open "Select * from supplier where sup_id =" & rs(7), cnn' lst.SubItems(7) = rs1(1) rs.MoveNextWendEnd Sub

Public Sub rsFILTER()

111

Page 112: Final Documentation 1

Dim sby, oby, Dasc As String'On Error GoTo ukloIf cmbsearch.ListIndex = -1 Then cmbsearch.ListIndex = 0If cmbOrder.ListIndex = -1 Then cmbOrder.ListIndex = 0If cmbsort.ListIndex = -1 Then cmbsort.ListIndex = 0

Select Case cmbsearch.ListIndexCase 0sby = "prod_id"Case 1sby = "prod_desc"Case 2sby = "quantity"Case 3sby = "price"Case 4sby = "ROP"Case 5sby = "exp_date"End Select

Select Case cmbOrder.ListIndexCase 0oby = "prod_id"Case 1oby = "prod_desc"Case 2oby = "quantity"Case 3oby = "price"Case 4oby = "ROP"Case 5oby = "exp_date"End Select

112

Page 113: Final Documentation 1

Select Case cmbsort.ListIndexCase 0Dasc = " asc"Case 1Dasc = " desc"End Select

check_RSIf cmbsearch.ListIndex = 1 Or cmbsearch.ListIndex = 5 Then

rs.Open "select * from products where " & sby & " like '" & txtsearch & "%' order by " & _oby & Dasc, cnnElse' If txtsearch = "" Then' check_RS' rs.Open "select * from products", cnn' fill_list' Exit Sub If Not IsNumeric(txtsearch) Or txtsearch = "" Then 'MsgBox "Please enter a numeric " & cmbsearch.Text check_RS rs.Open "Select * from products where prod_desc like '%' order by " & oby & Dasc, cnn fill_list Exit Sub End If rs.Open "Select * from products where " & sby & " like " & txtsearch & " order by " & oby & Dasc, cnnEnd Ifrs.Requery 1fill_listEnd Sub

Private Sub invlist_DblClick()

113

Page 114: Final Documentation 1

Dim xIf rs.RecordCount = 0 Then Exit Submowd = "edit"For x = 1 To 6

frmData.data(x) = invlist.SelectedItem.ListSubItems.Item(x).Text Next xcheck_RS1'rs1.Open "Select * from supplier where sup_name = '" & invlist.SelectedItem.ListSubItems.Item(7).Text & "'", cnn'frmData.data(8) = rs1(0)

frmData.data(0) = invlist.SelectedItem.TextfrmData.key = frmData.data(0)Load frmDatafrmData.Show 1

End Sub

Private Sub txtsearch_Change()rsFILTEREnd Sub

114

Page 115: Final Documentation 1

FORM1:MAIN MENU FORMPrivate Sub Form_Load()connectEnd Sub

Private Sub Form_Unload(Cancel As Integer)EndEnd Sub

Private Sub tb_ButtonClick(ByVal Button As MSComctlLib.Button)Select Case Button.key

Case "customers"Load customerscustomers.Show 1

Case "SLIST"

Load Sales_LISTSales_LIST.Show 1

Case "sales"Load salessales.Show 1

Case "suppliers"frmSupp.ano = ""Load frmSuppfrmSupp.Show 1

Case "products"Load mainmain.Show 1

Case "order"Load frmOrder

115

Page 116: Final Documentation 1

frmOrder.Show 1

Case "list"Load OrderPENDOrderPEND.Show 1

Case "deliver"Load OrderdelOrderdel.Show 1

Case "exit"End

End Select

End Sub

116

Page 117: Final Documentation 1

FORM9:LIST OF DELIEVERED ORDERS

Private Sub cmddel_Click()If rs.RecordCount = 0 Then Exit SubIf MsgBox("Do you really want to delete order #" & ORDERlist.SelectedItem.Text & "?", vbYesNo, "") = vbYes Thencnn.Execute "delete from delivered where delivered.orderno = " & ORDERlist.SelectedItem.Text

rs.RequeryfillEnd IfEnd Sub

Private Sub cmdexit_Click()Unload MeEnd Sub

Private Sub cmdok_Click()txtsearch = ""End Sub

Private Sub Form_Load()check_RSrs.Open "select * from delivered order by orderno asc", cnnfillEnd Sub

Private Sub txtsearch_Change()If txtsearch = "" Or txtsearch = " " Or textsearch = " " Or txtsearch = " " Or txtsearch = " " Thencheck_RSrs.Open "select * from delivered order by orderno asc", cnnfillExit SubEnd If

117

Page 118: Final Documentation 1

check_RSrs.Open "Select * from delivered where delivered.orderno = " & txtsearch, cnnfillEnd SubPublic Sub fill()Dim x As IntegerORDERlist.ListItems.Clear

While Not rs.EOF Set lst = ORDERlist.ListItems.Add(, , rs(0), , 2) For x = 1 To 5 lst.SubItems(x) = rs(x) Next x check_RStemp rstemp.Open "select sup_name from supplier where sup_id = " & rs(6), cnn lst.SubItems(6) = rstemp(0)rs.MoveNextWendIf txtsearch <> "" Thencheck_RStemprstemp.Open "select * from order_total where order_no =" & txtsearchIf rstemp.RecordCount <> 0 And rs.RecordCount <> 0 ThenSet lst = ORDERlist.ListItems.Add(, , "") lst.SubItems(3) = "Total Amount: " lst.SubItems(4) = rstemp(1)End IfEnd If

End Sub

118

Page 119: Final Documentation 1

FORM10:PENDING ORDERS FORM

Private Sub cmddel_Click()If rs.RecordCount = 0 Then Exit SubIf MsgBox("Do you really want to delete order #" & ORDERlist.SelectedItem.Text & "?", vbYesNo, "") = vbYes Thencnn.Execute "delete from delivered where delivered.orderno = " & ORDERlist.SelectedItem.Text

rs.RequeryfillEnd IfEnd Sub

Private Sub cmdexit_Click()Unload MeEnd Sub

Private Sub cmdok_Click()txtsearch = ""End Sub

Private Sub Form_Load()check_RSrs.Open "select * from delivered order by orderno asc", cnnfillEnd Sub

Private Sub txtsearch_Change()If txtsearch = "" Or txtsearch = " " Or textsearch = " " Or txtsearch = " " Or txtsearch = " " Thencheck_RSrs.Open "select * from delivered order by orderno asc", cnnfillExit SubEnd If

119

Page 120: Final Documentation 1

check_RSrs.Open "Select * from delivered where delivered.orderno = " & txtsearch, cnnfillEnd SubPublic Sub fill()Dim x As IntegerORDERlist.ListItems.Clear

While Not rs.EOF Set lst = ORDERlist.ListItems.Add(, , rs(0), , 2) For x = 1 To 5 lst.SubItems(x) = rs(x) Next x check_RStemp rstemp.Open "select sup_name from supplier where sup_id = " & rs(6), cnn lst.SubItems(6) = rstemp(0)rs.MoveNextWendIf txtsearch <> "" Thencheck_RStemprstemp.Open "select * from order_total where order_no =" & txtsearchIf rstemp.RecordCount <> 0 And rs.RecordCount <> 0 ThenSet lst = ORDERlist.ListItems.Add(, , "") lst.SubItems(3) = "Total Amount: " lst.SubItems(4) = rstemp(1)End IfEnd If

End Sub

120

Page 121: Final Documentation 1

FORM11:SALES LIST FORMPublic sID As IntegerPublic Gtotal As Currency

Public Sub fill2()Dim x As Integersellist.ListItems.Clear

check_RStemprstemp.Open "select * from sales where salesno = " & sID, cnnWhile Not rstemp.EOFSet lst = sellist.ListItems.Add(, , rstemp(1), , 1)For x = 1 To 3 lst.SubItems(x) = rstemp(x + 1) Next xrstemp.MoveNextWendSet lst = sellist.ListItems.Add(, , "") lst.SubItems(2) = "Total amount: " lst.SubItems(3) = GtotalEnd SubPrivate Sub cmbcus_Click()If cmbcus.ListIndex = 0 Thentxtnum.Visible = Truetxtname.Visible = True

Label1(0).Visible = TrueLabel1(1).Visible = True

ElseIf cmbcus.ListIndex = 1 Thentxtnum.Visible = Falsetxtname.Visible = FalseLabel1(0).Visible = FalseLabel1(1).Visible = False

End IfEnd Sub

121

Page 122: Final Documentation 1

Private Sub cmdexit_Click()Unload MeEnd Sub

Private Sub Form_Load()check_RSrs.Open "select * from products order by prod_id asc", cnn

fill1sID = 1check_RS1rs1.Open "select * from sales", cnn

While Not rs1.RecordCount = 0 check_RS1 sID = sID + 1 rs1.Open "select * from sales where salesno = " & sID, cnnWend lblSno = "Transaction no. " & sIDcmbcus.ListIndex = 0End Sub

Public Sub fill1()Dim x As Integer invlist.ListItems.Clear While Not rs.EOF check_RStemp rstemp.Open "select * from sales where sales.prod_desc = '" & rs(1) & "' and salesno = " & sID, cnn If rstemp.RecordCount = 0 Then Set lst = invlist.ListItems.Add(, , rs(0), , 1) For x = 1 To 2 lst.SubItems(x) = rs(x)

122

Page 123: Final Documentation 1

If Val(rs(2)) = 0 Then lst.SubItems(2) = "OUT OF STOCK" Next x For x = 3 To 5 lst.SubItems(x) = rs(x + 1) Next x Else End If rs.MoveNext Wend

End Sub

Private Sub invlist_DblClick()Dim tempQTY As StringDim tutal As CurrencyDim tempNUM, tempQ As Integer

If txtname = "" And cmbcus.ListIndex = 0 ThenMsgBox "Please choose a customer..", , "?"Exit SubEnd IfIf invlist.SelectedItem.ListSubItems(2) = "OUT OF STOCK" ThenMsgBox "This products is out of stock!", vbInformation, "!"Exit SubEnd If

tempQTY = "0"While Val(tempQTY) > Val(invlist.SelectedItem.SubItems(2)) Or tempQTY = "0" Or IsNumeric(tempQTY) = False

123

Page 124: Final Documentation 1

tempQTY = InputBox("Please enter the quantity.. ", invlist.SelectedItem.ListSubItems(1))

If Val(tempQTY) > Val(invlist.SelectedItem.SubItems(2)) ThenMsgBox "The number you entered is greater that the number of items in stock. Please try again."tempQTY = ""ElseIf tempQTY = "" ThenExit SubEnd If

Wendtutal = Val(tempQTY) * Val(invlist.SelectedItem.ListSubItems(3))Gtotal = Gtotal + tutalIf cmbcus.ListIndex = 0 ThentempNUM = txtnumElsetempNUM = 0End If

cnn.Execute "insert into sales values(" & sID & ",'" & invlist.SelectedItem.ListSubItems(1) & "'," & _tempQTY & "," & invlist.SelectedItem.ListSubItems(3) & "," & _tutal & ", '" & Date & "' , " & tempNUM & ")"tempQ = Val(invlist.SelectedItem.ListSubItems(2)) - Val(tempQTY)cnn.Execute "update products set quantity = " & tempQ & " where prod_id = " & invlist.SelectedItem.Text

check_RS1

124

Page 125: Final Documentation 1

rs1.Open "select * from sales_total where sales_no = " & sID, cnnIf rs1.RecordCount = 0 Thencnn.Execute "insert into sales_total values (" & sID & "," & Gtotal & ")"Elsecnn.Execute "update sales_total set s_total = " & Gtotal & " where sales_no = " & sIDEnd Iffill2

rs.Requery 1fill1

txtnum.Locked = Truecmbcus.Locked = True

If MsgBox("Add another? ", vbYesNo, "?") = vbNo ThenSales_LIST.txtsearch = sIDLoad Sales_LISTSales_LIST.Show 1Unload MeEnd If

End Sub

Private Sub txtnum_Change()fillNAMEEnd Sub

Public Sub fillNAME()On Error GoTo LIf txtnum = "" Thentxtname = ""Exit Sub

125

Page 126: Final Documentation 1

End Ifcheck_RStemprstemp.Open "select * from customers where cus_num = " & txtnum, cnn

If rstemp.RecordCount = 0 Thentxtname = ""Elsetxtname = rstemp(1)End If

Exit SubL:MsgBox Err.DescriptionEnd Sub

126

Page 127: Final Documentation 1

FORM12:SALES LIST DATAPublic sID As IntegerPublic Gtotal As Currency

Public Sub fill2()Dim x As Integersellist.ListItems.Clear

check_RStemprstemp.Open "select * from sales where salesno = " & sID, cnnWhile Not rstemp.EOFSet lst = sellist.ListItems.Add(, , rstemp(1), , 1)For x = 1 To 3 lst.SubItems(x) = rstemp(x + 1) Next xrstemp.MoveNextWendSet lst = sellist.ListItems.Add(, , "") lst.SubItems(2) = "Total amount: " lst.SubItems(3) = GtotalEnd SubPrivate Sub cmbcus_Click()If cmbcus.ListIndex = 0 Thentxtnum.Visible = Truetxtname.Visible = True

Label1(0).Visible = TrueLabel1(1).Visible = True

ElseIf cmbcus.ListIndex = 1 Thentxtnum.Visible = Falsetxtname.Visible = FalseLabel1(0).Visible = FalseLabel1(1).Visible = False

End IfEnd Sub

127

Page 128: Final Documentation 1

Private Sub cmdexit_Click()Unload MeEnd Sub

Private Sub Form_Load()check_RSrs.Open "select * from products order by prod_id asc", cnn

fill1sID = 1check_RS1rs1.Open "select * from sales", cnn

While Not rs1.RecordCount = 0 check_RS1 sID = sID + 1 rs1.Open "select * from sales where salesno = " & sID, cnnWend lblSno = "Transaction no. " & sIDcmbcus.ListIndex = 0End Sub

Public Sub fill1()Dim x As Integer invlist.ListItems.Clear While Not rs.EOF check_RStemp rstemp.Open "select * from sales where sales.prod_desc = '" & rs(1) & "' and salesno = " & sID, cnn If rstemp.RecordCount = 0 Then Set lst = invlist.ListItems.Add(, , rs(0), , 1) For x = 1 To 2 lst.SubItems(x) = rs(x)

128

Page 129: Final Documentation 1

If Val(rs(2)) = 0 Then lst.SubItems(2) = "OUT OF STOCK" Next x For x = 3 To 5 lst.SubItems(x) = rs(x + 1) Next x Else End If rs.MoveNext Wend

End Sub

Private Sub invlist_DblClick()Dim tempQTY As StringDim tutal As CurrencyDim tempNUM, tempQ As Integer

If txtname = "" And cmbcus.ListIndex = 0 ThenMsgBox "Please choose a customer..", , "?"Exit SubEnd IfIf invlist.SelectedItem.ListSubItems(2) = "OUT OF STOCK" ThenMsgBox "This products is out of stock!", vbInformation, "!"Exit SubEnd If

tempQTY = "0"While Val(tempQTY) > Val(invlist.SelectedItem.SubItems(2)) Or tempQTY = "0" Or IsNumeric(tempQTY) = False

129

Page 130: Final Documentation 1

tempQTY = InputBox("Please enter the quantity.. ", invlist.SelectedItem.ListSubItems(1))

If Val(tempQTY) > Val(invlist.SelectedItem.SubItems(2)) ThenMsgBox "The number you entered is greater that the number of items in stock. Please try again."tempQTY = ""ElseIf tempQTY = "" ThenExit SubEnd If

Wendtutal = Val(tempQTY) * Val(invlist.SelectedItem.ListSubItems(3))Gtotal = Gtotal + tutalIf cmbcus.ListIndex = 0 ThentempNUM = txtnumElsetempNUM = 0End If

cnn.Execute "insert into sales values(" & sID & ",'" & invlist.SelectedItem.ListSubItems(1) & "'," & _tempQTY & "," & invlist.SelectedItem.ListSubItems(3) & "," & _tutal & ", '" & Date & "' , " & tempNUM & ")"tempQ = Val(invlist.SelectedItem.ListSubItems(2)) - Val(tempQTY)cnn.Execute "update products set quantity = " & tempQ & " where prod_id = " & invlist.SelectedItem.Text

check_RS1

130

Page 131: Final Documentation 1

rs1.Open "select * from sales_total where sales_no = " & sID, cnnIf rs1.RecordCount = 0 Thencnn.Execute "insert into sales_total values (" & sID & "," & Gtotal & ")"Elsecnn.Execute "update sales_total set s_total = " & Gtotal & " where sales_no = " & sIDEnd Iffill2

rs.Requery 1fill1

txtnum.Locked = Truecmbcus.Locked = True

If MsgBox("Add another? ", vbYesNo, "?") = vbNo ThenSales_LIST.txtsearch = sIDLoad Sales_LISTSales_LIST.Show 1Unload MeEnd If

End Sub

Private Sub txtnum_Change()fillNAMEEnd Sub

Public Sub fillNAME()On Error GoTo LIf txtnum = "" Thentxtname = ""Exit Sub

131

Page 132: Final Documentation 1

End Ifcheck_RStemprstemp.Open "select * from customers where cus_num = " & txtnum, cnn

If rstemp.RecordCount = 0 Thentxtname = ""Elsetxtname = rstemp(1)End If

Exit SubL:MsgBox Err.DescriptionEnd Sub

132

Page 133: Final Documentation 1

MODULE CODING:'Practicum 2Public cnn As New ADODB.ConnectionPublic rs As New ADODB.RecordsetPublic rs1 As New ADODB.RecordsetPublic rstemp As New ADODB.RecordsetPublic lst As ListItem

Public Sub connect()Dim path As StringOn Error GoTo ado2path = App.path & "\inventory.mdb"

cnn.CursorLocation = adUseClientIf rs.State = 1 Then rs.Close'cnn.Open "provider=MSDASQL.1;Persist Security Info=False;Data Source=invent"

'Exit Subado2:'If MsgBox("MSDASQL failed to connect to System Database ""Invent""! Please configure it properly in the control panel or click Ok to try to connect to the database using " & _'"Microsoft Jet Driver...", vbOKCancel, "Cant connect!!!") = vbOK Then

cnn.Open "provider = microsoft.jet.oledb.3.51;persist security info=false;data source = " & path'Else'End'End IfEnd Sub

Public Sub check_RStemp()If rstemp.State = 1 Then rstemp.Close

133

Page 134: Final Documentation 1

End Sub

Public Sub check_RS()If rs.State = 1 Then rs.CloseEnd Sub

Public Sub check_RS1()If rs1.State = 1 Then rs1.CloseEnd Sub

134