Project Document

Download as pdf or txt
Download as pdf or txt
You are on page 1of 112

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM

1.0

Acknowledgement

As a team member, I cordially thank my project leader Subhamoy Ghosh (PL), Bipru Thakur (DPL), Sujoy Majumder, Nisanta Buxi, Debmalya Ghosh, Kallol for their active participation, complete sincerity, and full dedication and generous co-operation in the making of this project.

We are grateful to Dr. Nirmalya Bhattacharya Mr. Manas kumar Dev Mr. Sutanu Sinha Mr. Debashish Nandi : : : : Principal & project in Charge Faculty, Department of Computer Science Faculty, Department of Computer Science Faculty, Department of Computer Science

Without their humble help and guidance it would have really difficult for us to make this project a good success. It would also be selfish on our part if we do not thank the people who lend their thoughts, ideas and valuable suggestion during the course of our design and development of the project and giving us an ample scope to learn about the usefulness and making of software in the IT field.

(Project Leader)

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM

2.0

Requirement Analysis :Purpose:

This application helps in keeping the track of bulk amount of record for easy access, retrieval and systematic maintenance of a companys selling of products among the client. Our softw are not only time but also re duce the Burdon of maintained the record physic ally. Feasibility Analysis: Feasibility analysis involv es the follow ing From a project team and appoint a project leader Prepare system flow chart Enumerate potential candidate system Describe and identif y characteristic s of candidate system Describe the evaluate performance as well as cost effectiv e of each candidate system Weight system performance and cost data Select the best candidate system Prepare and report project directiv e to management

Three key considerations are involved in the feasibility analysis. They are: 1. 2. 3. Technical Operational Economic

System Requirement Analysis Diagram

Client/ User needs

Problem Analysis

Product Description Analysis

Validation

Validated SRS

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


3.0 Project Management Plan: Project name Version Date Prepared By : : : : Stock management and Inventory Control System 1.0 11th September, 2009 1.Subhamoy Ghosh (PL) 2. Bipru Thakur (DPL) 3. Sujoy Majumder 4. Nisanta Buxi 5. Debmalya Ghosh 6. Kallol Chakraborty NA

Client Distribution

3.1

Introdu ction:3.1.1

Project Overview : Todays world is running w ith a great speed and concept of existence is most important everywhere. In this great struggle of keeping existence, the whole society is in the glorious proceeding just getting COMPUTERIZATION as the only tool. Computerization w ith its newer and newer solution, has given the modern of great success and victory. Basically this system is built in that w ay that it is suitable for any enterpris e. Transactions will be too much easier using this system. It keeps all the tracks of the creditors, retailers, distributors as well as of the sales and the damages stocks and stores them in the database permanently. The databases are also flexible. The addition & deletion is also done automatically. So this ystem provides less overhead for the user. Below Level Aw areness: From various surveys it has found that through about the use of computer to control a companys stock is much easier and faster than previous manual controlling the stock system. Indian Scenario: Business society and government cannot afford to ignore the digital society just because its current impact is difficult to measure. Privacy and Security: Privacy and security are other concern; Sales Monitoring & Inventory Control System is trusted mechanism for privacy and security. This mechanis m must provide for security, confidentially, authentic ation and non-repletion. The key to Success: Focusing on exis ting customer, creditor, retailer, dis tributor, which is, luring prospect, cementing a long term business relationship. Visionary leadership Business pragmatism and IT. Product Enabling Sales Monitoring & Inventory Control: A lot of products like Books, Music CDs, computer etc that today are in physical form w ill actually become digital products. And that makes partic ularly exciting because its not only sales a product but maintain the stock also. Theme of the Project: Our project is based on SALES MONITORING & INVENTORY CONTROL strategy manufacturing company who supply / dis patch products to those customers (clients) who pay a minimum demanded advance to the company. To implement this mechanism w e use Oracle as backend for database table. In this project we use number of Java classes to transform data from client side to database and vice-versa. Mechanism of the project is that authoriz ed user can login to main platform to maintain the total process. After login, the logged user w ill have all rights to do w ork w ithin this platform related w ith the project. Managing Quality: All work is a process There are four absolute of quality that guide our effort to operate, manage and improve our work process. All work is a process: Every job w e do is a process, a series of actions that produces a result. These results are products are services that satisfy the need and desires of our customers. To meet our customers expectation, we need first to identif y their requirements. The FOUR absolutes of quality: The four absolute of quality are the principles we used to operate, manage and improve our job process:

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


The four absolute of quality are: 1. 2. 3. 4. Definition System Performance standard Measurement

They provide the answers to four very important questions about quality: How do we define quality? How we can make quality? What standard do we use for our performance? How can we measure quality?

1.

DEFINITION : What is quality? Almost everyone has an option. Some say quality means Excellence other say Goodness or Beauty. Quality is defined as Conformance to requirements. Any product, service, or process that confirms to its requirements is a quality product, servic e or process. If the requirements are not met, we have nonconformance.

2.

System : One w ay to ensure quality is by apprais al or inspection. As a result of inspection, we make a decision .Either the w ork conforms or it does not. But inspecting just to sort the good form the bad does not help us to improve. To improve quality we need policies and systems that are based the principle of prevention. Prevention involves communicating, planning, proofing, and w orking in a w ay that elements opportunities for non-conformance.

3.

The performance Standard: To make this commitment, w e need a performance standard that everyone can understand. That standard is called ZERO DEFECTS. Conventional performance standards for quality can be summed up by the phrase thats close enough Zero defects are a commitment to meet all requirements for our work the first time and every time. So w e believe that our project should meet most of the requirements of the users and itself a successful standard quality project.

4.

Measurement: Sometimes w e say we are paying more for quality, that quality better or worse, up or down, good or bad, or in line w ith industry standard. The best way to measuring quality is to calc ulate what it costs to do things wrong. This measurement is called price of non-conformance (PONC).

PONC activities include : Reprocessing Expediting Unplanned servic e Computer returns Dow ntime Rew ork Return

So, PONC is the price of waste. In the time of forming our project, we consider and analysis all the above steps and queries for managing quality.

3.1.2

Objective :Sales Management helps to faster transaction between customer & company. In this case business transaction cost became lesser. In this case business ordering cost als o became lesser. In this case client as well as company saves their valuable time. In this case total cost of business of company comes down. Client gets the facility to choose the maximum number of item w ith minimum effort. Through this client is able to purchase or sale anything at anytime if the stock permits!

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


3.1.3
Sl. No. 1. 2. 3. 4. 5.

Major Work Activities:Phases Requirement Analysis Design Coding Testing Documentation Description Deciding features to be included and examination the feasibility Designing system architecture and creating user interface Creating a database, connectivity and coding of modules Testing and debugging of modules and integrating them, final performance testing Submission of final reports, finalizing the project report and hence complete documentation

3.2

Project Delivery Report:Follow ing are the project deliverable: Source code Installation CD SRS Test Plan User Help

3.3

Platform:Front End Back End Operating System : JAVA : Oracle : Window s XP

Project Output: The output of employee the Linear Sequential Model is not just final program and the documentation to use it. There are a number of intermediate outputs that must be produce. For the successful completion of the project, the follow ing are required --- Requirement Analysis Document Project Management Plan System Requirement Specification System Design Document Detail Design Document Test Plan & Test Report Final Code

3.4

Project Organization:3.4.1

Processes Model: In order to solv e a problem, a Software engineer must incorporate a development strategy that encompasses the processes, the method and tool, layers and general phases. This strategy is referred to as a processes mod el, or software engineering paradigm. The processes model appropriate for this project Stock Management and Inventory Control System is the Linear Sequential Model

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM Linear Sequential Model


Linear Sequential Model suggests a systematic sequential approach to software development that begins at the system level and progress through analy sis, design, coding, testing and maintenance. Linear Sequential Model encompasses the following activity--- System Engineering: It encompasses requir ement gathering at the system level w ith a small amount of top-level design and analysis. System Requirement Analysis: Requirement gathering processes is defined and focused specially on the follow ing to understand the nature of the program; the software engineering must understand the information domain for the software, as well as requirement function performance and interface. Design: Softw are design is actually a multi-step a process that focuses on four distinct attributes of a program. The designing process requirements into a representation of software that can be assessed for quality before coding begins. Coding: The design must be translated into machine readable form. The coding step performs this task. If design is performed in a detailed manner, code generation can be accomplished mechanistically. Testing: Once code has been generated, program testing begins. The testing processes focused on the logical internal of the software, ensuring that all the statement have been tested and on the functional exter nal, that is, conducting test to uncover errors and ensure that define input will produce actual result that agree with required result. Maintenance: software will undoubtedly undergo change it is delivered to the customer. Change w ill occur because error have been encountered or because the software must be adapted to accommodate changes in its external environment or the customer requires functional or performance enhancements. Maintenance re-applies each of the preceding phases to the existing phases to modify the existing program rather than a new one.

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM

Diagram of Processes Model


Feasibility Study

Requirement Analysis & Specification

Design & Specification

Coding & Module Testing

Integrating & system Testing

Delivery

Maintenance

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM The Phase of the Module can be classified as:
Index 1. Phase Requirement Determination What is done during Phase Determination to be meeting by system being contemplated Draw an understandable plan of what the system w ill provide the output. Determine needs and priority by consensus among the end- user Taking into account available resource such as human, computer, time and money. Find whether specified requirement End Set of requirement and their priorities. Detailed specification of information to be provided Feasibility document specif ication recourses need and availability. Expected cost vs. benefit of the system Functional specif ication budget time schedule. Physical requirements such as storages and processor Hardw are configuration disks space, CPU pow er Logical design of program database and test plan Evolution report w ith suggestion for improvement Evolution report w ith suggestion for improvement Improvement system containing modification and maintenance

2.

Requirement Specific ation

3.

Feasibility Analysis

4.

System Specif ication

Obtain functional specif ication based on revis ed user requirement and feasibility analysis

5.

Hardw are study

Determine Hardw are requirement for the system Logical system of program, design of database, test & implementation plane Writing programs, creating database, testing program and operation plans documenting system. Training user data conversion if needed Find out from user if system meet their needs Changing system, adding or deleting features of satisfying user needs.

6.

System Design

7.

System Implementation

8.

System Evolution System Modification/Maintenan ce

9.

3.4.2

Organizational Structure: Prepared By

--

1. Subhamoy Ghosh (PL) 2. Bipru Thakur (DPL) 3. Sujoy Majumder 4. Nisanta Buxi 5. Debmalya Ghosh 6. Kallol

3.5

Managerial Process:3.5.1 Management Objective & Priority:The main goals of software management plan are as follows: To ensure smooth execution of project The end product deliver on the time unique effective tool & method The method need the quality requirements of the respective company

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM

3.5.2

Assumption & Dependences : Availability of recommended & hard work on time Each developer is capable of completing dales or assign task on time otherw is e he or she volunteer to take the commitment of the task Potential changes on a degree w ill be indicate configured control are & not be Project review will be taking place Team member are communicating w ith each other 7 each have responsible understanding of ones project element as a hole The exit criteria of a project are depended of finial exemption testing the project closing date is extended may be based on exception report as recusal from product management. If the bugs are identify the expectation testing the project closing date is extended may be based on expectance report as receiv ed from product management. Follow ing are the constancy for the successful combination of the project Time require of competition project Resource needed to completing project

Software requirement: Microsoft Windows XP Microsoft Word Java Oracle Hardw are Requirement: Minimum Pentium IV Processor 1.8 GHz. Minimum 512MB Ram Display Device Input device Printer

3.5.3

Risk M anagement:Risk Category Shortage of Technic al Manpow er 6 Insufficient business knowledge 9 Unclear requirement Risk Maintenance Plane Maintenance Buffer of Extra Resources Define the project Conduct cross Training Session Ensure that multipurpose has assign of Key Project Area Have team building session Rotate job among team member Keep extra recourses as backup Proper documentation of individual work Define performance criteria clearly review by client Define standard up to be followed to meet performance criteria Stimulate or prototype performance of criteria traction Conceder a phase of delivery? Provide training in new technology Externally driven decision forced on the project Outline disadvantages with the supporting fact or data & negotiate w ith the person responsible to forcing the decis ion Increases instruction with the client & ensure a adequate know ledge transfer Organized domain know ledge training Stimulate business trusting & get it approved Negotiate a better schedule Identify a personal task Negotiate client on actual effort Identify areas that can be automated Set proper exception w ith client Plan ached for link load Use experience logic to make some assumption & keep the client information to about signoff Develop prototype to get the requirement to review the client Obtain signoff initial requirement speciation as client Convince the client to the changes the requirement changes Negotiate payment on actual report

Sl No

Non popular apparition 2 Non meeting performance requirement

Working on new technology

Risk 5

Unrealistic Schedule

Link failure Or slow performance

10

Too many requirement changes

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM

3.5.4

Monitoring & Controlling:-

Monitoring & Controlling are alw ays & important issue for develop the project. The major particular point on whic h monitoring & controlling on project is based on are as follows Monthly project review meeting headed by the group leader took place to ensure smooth execution of the project Project leader design a project schedule for the team member to follow . Which will continue a follow up an instruction & report? The scientific ally design schedule & instruction sheet for the team member that contain the forget work to be achieved effort put individual team member & others reach team member. The project team leader did the frequent tracking & updating in the project schedule. The project leader used to give the instruction for the proper implement of the schedule changes that where necessary in the schedule made under the guidance of the project leader. The 4th night project status report was sent by the project leader to the concern person in the order to inform the progress of project. Technical Processes: Method: This project is designed using JAVA as the front end tool and ORACLE (Database) as the back end tool Tools: The tools are command Button, labels, combo box, check box, text area etc. Techniques: Different type of data base accessing and code handling and authentication are used.

3.5.5

Effort Estimation:-

Effort estimation report prepaid to track the amount of time consumes to develop the project ( Stock Management and Inventory Control System). The report categorized the no of activity, the starting date & finishing date The Start Date: The Finish Date: Activity RA PMP SRS SDD CODING TESTING RA PMP SRS SDD No of Person 6 6 6 6 6 6 = = = = 29th August, 2009 27th November, 2009 Days 8 10 4 10 40 8
st

Start Date 1 September 2009 11th September 2009 16th September 2009 25t September 2009 2nd November 2009 17th November 2009
th

Finish Date 10 September 2009 15th September 2009 24th September 2009 1st November 2009 16th November 2009 22nd November 2009

Requirement Analysis Project Management Plan System Requirement Specification System Design Document : 2.5 months : 4 hours/day : 290 hours

Project Duration Week Hour/Day Total Effort Estimation

3.6

Technical Process 3.6.1 Methods,Tools,Techniques

Method: This project is designed using JAVA as the front end tool and ORACLE (Database) as the back end tool Tools: The tools are command Button, labels, combo box, check box, text area etc. Techniques: Different type of data base accessing and code handling and authentication are used.

The structured system analysis design is used to develop the system . Tool is used to : Support the prescribed set of steps to go ahead to goal and completion of development of software .

10

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM

3.7

Client Involvement:For 1. PMP 2. SRS 3. SDD Yes Yes Yes No No No

3.8 Reuse: -- The involvement of reusability features for the project itself or any of the project modules or its containing part is not applicable. 3.9 Traceability Matrix:-Configuration Item Identification GC/<APN>/RA/D/C1 GC/<PN>/PMD/D/C1 GC/<PN>/SRS/D/C1 GC/<PN>/SDD/D/C1 Copy Hard Soft File File File File C:/MP C:/MP C:/MP C:/MP

Sl NO 1 2 3 4

Version 1.0 1.0 1.0 1.0

Date of Release 01st September 2009 10th September 2009 15th September 2009 25 September 2009
th

Comment Current Current Current Current

3.10

Status Report:Project Status Report: 01 Project Name : - Stock Management and Inventory Control System Period of reporting : - 1st September to 10th September SI NO 1. Activity Name Requirement Analysis Project Management Plan P: Planed Problem Faced: NA Duration P| A 8 8 Starting Date P| A 1st September 2009 11th September 2009 1st September 2009 11th September 2009 Finishing Date P| A 10th September 2009 10th September 2009 Status D

2.

10

10

A: Actual Problem Resolving: NA

D: DONE

E: E XECUTING

Project Status Report: 02 Project Name : - Stock Management and Inventory Control System Period of reporting : - 11th September to 24th September SI Duration Starting Date Finishing Date Activity Name NO P| A P| A P| A th th Project 11 11 15th 15th 1. Management 10 10 September September September September Plan 2009 2009 2009 2009 th th th System 16 16 24 24th 2. Requirement 4 4 September September September September Specific ation 2009 2009 2009 2009 25t 25t System Design 3. 10 10 September September Document 2009 2009 P: Planed Problem Faced: NA A: Actual Problem Resolving: NA D: DONE

Status D D

E E: E XECUTING

11

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM

Project Status Report: 03 Project Name : - Stock Management and Inventory Control System Period of reporting : - 25th September to 1st November SI NO 1. 2. Activity Name System Design Document CODING Duration P|A 10 40 10 40 Starting Date P|A 25t 25t September September 2009 2009 2nd 2nd November November 2009 2009 Finishing Date P|A 1st 1st November November 2009 2009 ----Status D E

P: Planed Problem Faced: NA

A: Actual Problem Resolving: NA

D: DONE

E: E XECUTING

Project Status Report: 04 Project Name : - Stock Management and Inventory Control System Period of reporting : - 2nd November to 16th November SI NO 1. Activity Name Duration P|A 40 40 Starting Date P| A 2nd November 2009 2nd November 2009 Finishing Date P|A 16th November 2009 16th November 2009 Status

CODING

P: Planed Problem Faced: NA

A: Actual Problem Resolving: NA

D: DONE

E: E XECUTING

Project Status Report: 05 Project Name : - Stock Management and Inventory Control System Period of reporting : - 17th November to 22nd November SI NO 1. Activity Name TESTING P: Planed Problem Faced: NA Duration P| A 7 7 Starting Date P| A 17th 17th November November 2009 2009 Finishing Date P| A 22nd 22nd November November 2009 2009 D: DONE Status D E: E XECUTING

A: Actual Problem Resolving: NA

12

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


4.0 System Requirement S pecification
Project name Version Date Prepared By : : : : Stock management and Inventory Control System 1.0 16th September, 2009 1. Subhamoy Ghosh (PL) 2. Bipru Thakur (DPL) 3. Sujoy Majumder 4. Nisanta Buxi 5. Debmalya Ghosh 6. Kallol Chakraborty NA

Client Distribution

4.1

Project Overview :-

Todays world is running w ith a great speed and concept of existence is most important everywhere. In this great struggle of keeping existence, the whole society is in the glorious proceeding just getting COMPUTERIZATION as the only tool. Computerization w ith its newer and newer solution, has given the modern of great success and victory. Basically this system is built in that w ay that it is suitable for any enterpris e. Transactions will be too much easier using this system. It keeps all the tracks of the creditors, retailers, distributors as well as of the sales and the damages stocks and stores them in the database permanently. The databases are also flexible. The addition & deletion is also done automatically. So this ystem provides less overhead for the user. Below Level Aw areness: From various surveys it has found that through about the use of computer to control a companys stock is much easier and faster than previous manual controlling the stock system. Indian Scenario: Business society and government cannot afford to ignore the digital society just because its current impact is difficult to measure. Our project is based on SALES MONITORING & INVENTORY CONTROL strategy manufacturing company who supply / dispatch products to those customers (clients) who pay a minimum demanded advance to the company. To implement this mechanism w e use Oracle as backend for database table. In this project we use number of Java classes to transform data from client side to database and vic e-versa. Mechanism of the project is that authorized user can login to main platform to maintain the total process. After login, the logged user will have all rights to do work within this platform related w ith the project.

4.2

Objective:Sales Management helps to faster transaction between customer & company. In this case business transaction cost became lesser. In this case business ordering cost als o became lesser. In this case client as well as company saves their valuable time. In this case total cost of business of company comes down. Client gets the facility to choose the maximum number of item w ith minimum eff ort. Through this client is able to purchase or sale anything at anytime if the stock permits!

4.3

Major W ork Activities:Sl. No. 1. 2. 3. 4. 5. Phases Requirement Analysis Design Coding Testing Documentation Description Deciding features to be included and examination the feasibility Designing system architecture and creating user interface Creating a database, connectivity and coding of modules Testing and debugging of modules and integrating them, final performance testing Submission of final reports, finalizing the project report and hence complete documentation

13

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


5.0 M odule Overview:-

Table: USERLOGIN: FIELD NAME USERNAME PASSWORD DATA TYPE TEXT TEXT DESCRIPTION VARCHAR2, 10 DIGITS VARCHAR2, 10 DIGITS

Table: CREDITORMASTER FIELD NAME CREDITORID CREDITORNAME CREDITORADDRESS CONTACTNO DATA TYPE TEXT TEXT TEXT TEXT DESCRIPTION VARCHAR2, 5 DIGITS VARCHAR2, 20 DIGITS VARCHAR2, 40 DIGITS VARCHAR2, 10 DIGITS

Table: RETAILERMASTER FIELD NAME RETAILERID RETAILERNAME RETAILERADDRESS CONTACTNO DATA TYPE TEXT TEXT TEXT TEXT DESCRIPTION VARCHAR2, 5 DIGITS VARCHAR2, 20 DIGITS VARCHAR2, 40 DIGITS VARCHAR2, 10 DIGITS

Table: DISTRIBUTORMASTER FIELD NAME DISTRIBUTORID DISTRIBUTORNAME DISTRIBUTORADDRESS CONTACTNO DATA TYPE TEXT TEXT TEXT TEXT DESCRIPTION VARCHAR2, 5 DIGITS VARCHAR2, 20 DIGITS VARCHAR2, 40 DIGITS VARCHAR2, 10 DIGITS

Table: CATEGORY FIELD NAME CATEGORYID CATEGORY_NAME DATA TYPE TEXT TEXT DESCRIPTION VARCHAR2, 5 DIGITS VARCHAR2, 20 DIGITS

14

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM

Table: SUBCATEGORY FIELD NAME SUBCATEGORYID SUBCATEGORY_NAME DATA TYPE TEXT TEXT DESCRIPTION VARCHAR2, 5 DIGITS VARCHAR2, 5 DIGITS

Table: STOCK FIELD NAME CATEGORYID SUBCATEGORYID QTY UNITPRICE PURCHASEDATE PURCHASEID DATA TYPE TEXT TEXT TEXT TEXT DATE TEXT DESCRIPTION VARCHAR2, 5 DIGITS VARCHAR2, 5 DIGITS VARCHAR2, 4 DIGITS VARCHAR2, 4 DIGITS VARCHAR2,10 DIGITS VARCHAR2,5 DIGITS

Table: SALES FIELD NAME BILLNO BILL_DATE CATEGORYID SUBCATEGORYID RETAILERID QTY_SOLD UNIT_PRICE DATA TYPE TEXT TEXT TEXT TEXT TEXT TEXT TEXT DESCRIPTION VARCHAR2, 5 DIGITS DATE VARCHAR2, 40 DIGITS VARCHAR2, 10 DIGITS VARCHAR2, 10 DIGITS VARCHAR2, 10 DIGITS VARCHAR2, 10 DIGITS

Table: DAMAGEDRET URN FIELD NAME RETURN_DATE RETAILERID AGAINST_BILL_NO CATEGORYID SUBCATEGORY QTY_RETURNED DATA TYPE TEXT TEXT TEXT TEXT TEXT TEXT DESCRIPTION VARCHAR2, 5 DIGITS VARCHAR2, 20 DIGITS VARCHAR2, 40 DIGITS VARCHAR2, 10 DIGITS VARCHAR2, 10 DIGITS VARCHAR2, 10 DIGITS

15

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


6.0 System Design Docu ment
Project name Version Date Prepared By : : : : Stock management and Inventory Control System 1.0 25th September 2009 1.Subhamoy Ghosh (PL) 2. Bipru Thakur (DPL) 3. Sujoy Majumder 4. Nisanta Buxi 5. Debmalya Ghosh 6. Kallol Chakraborty NA

Client Distribution

Feasibility Study
Feasibility analysis involves eight steps:1. Form a project team and appoint a project leader. 2. Prepare system flowchart. 3. Enumerate potential candidate system. 4. Describe and identif y characteristic s of candidate systems. 5. Describe and evaluate performance and cost effectiveness of each candidate system. 6. Weight system performance and cost data. 7. Select the best candidate system. 8. Prepare and report final project directive to management. Three keys considerations are involved in the feasibility analysis: 1) Technical 2) Operational 3) Economic 1) Technical Feasibility: - It specifies whether the proposed solution in the project is possible to be implemented using available hardware and softw are. 2) Operational Feasibility: - It considers the factor that how it could be changed for future requirements and the operational factors of the computer. 3) Econom ic Feasibility: - It defines the measurement cost effectiv eness of the project: (A). Direct Cost (B). Indirect Cost

ECONOMIC FEASIBILITY OF THE PROJECT:1). Initial cost for development is not so high since a machine required configuration is available in the instruction. 2). S/W for back-end and front-end are also readily available.

COST-BENEFIT ANALYSIS
The development of any project is to be done keeping in mind the cost and benefits associated with any project. A project will not be Viable if its costs exceed its benefits. Thus cost-benefit analysis is very critical for every project. As w ith every project the need for cost-benefit analysis was als o felt w ith project. A suitable analysis has been outlined below . COSTS: Cost associated w ith project may be classified as analysis costs, development costs, testing and pilot costs, implementation costs, training Costs, system maintenance cost and other related costs. For finding out the total costs involv ed with this project we div ide the costs as under:1. Hardw are and Software. 2. Development Charges (calculated as per man-hours utilized) 3. Training Cost (calculated as per no. of personal trained) 4. System Implementation and maintenance costs. 5. Stationary Charges. 6. Other Pre and Post Implementation costs. 7. Of the above except 3 and 4, all are direct costs and their value can be found out very specific ally. For other costs, the cost can be found out by taking the general rate paid to the development staff. Benefits:The benefits of this system have already been enumerated. Let us now discuss them one by one:1. Initial costs for development are not so high since a machine w ith required configuration and software for back-end and front-end are available. 2. This system w ould help to simplify the various important operations of a Library management system. Thereby it reduces the consumption of time and energy which are very valuable. Finally w e can conclude that benefits are much more than the costs associated w ith this project. Hence the project is viable and worthy of being developed.

16

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM

Feasibility Study

Requirement analysis and specification

Design

Coding and unit testing

Integration and system testing

Maintenance

17

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM

CreditorID, name, address, contact_ no

RetailerID, name, address, contact_ no

DistributorID, name, address, contact_ no

CategoryID, Sub-CategoryID, qty, price, date

Creditor

Retailer

Distributor

Stock

Creditor Database

Retailer Database

Di stributor Database

Stock Database

CategoryID, Sub-CategoryID, name

CategoryID, name

Subcategory

RetailerID, name, address

CategoryID, SubCategory, qty

Category
Category Database

Sub-Categor y Database

Sales
Damaged Return Database

Bill_Date, price

Damaged Return

Sales Database

Date, RetailerID, Billno, CategoryID, qty

18

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


6.1 System Architecture:Query Designer is based upon three tier architecture, comprising of: 1. JAVA 2. Oracle Detail Design:6.2.1 Module Overview: Table: USERLOGIN FIELD NAME USERNAME PASSWORD DATA TYPE TEXT TEXT DESCRIPTION VARCHAR2, 10 DIGITS VARCHAR2, 10 DIGITS

6.2

Table: CREDITORMASTER FIELD NAME CREDITORID CREDITORNAME CREDITORADDRESS CONTACTNO Table: RETAILERMASTER FIELD NAME RETAILERID RETAILERNAME RETAILERADDRESS CONTACTNO Table: DISTRIBUTORMASTER FIELD NAME DISTRIBUTORID DISTRIBUTORNAME DISTRIBUTORADDRESS CONTACTNO Table: CATEGORY FIELD NAME CATEGORYID CATEGORY_NAME Table: SUBCATEGORY FIELD NAME SUBCATEGORYID SUBCATEGORY_NAME Table: STOCK FIELD NAME CATEGORYID SUBCATEGORYID QTY UNITPRICE PURCHASEDATE PURCHASEID DATA TYPE TEXT TEXT TEXT TEXT DATE TEXT DESCRIPTION VARCHAR2, 5 DIGITS VARCHAR2, 5 DIGITS VARCHAR2, 4 DIGITS VARCHAR2, 4 DIGITS DATE VARCHAR2,5 DIGITS DATA TYPE TEXT TEXT DESCRIPTION VARCHAR2, 5 DIGITS VARCHAR2, 5 DIGITS DATA TYPE TEXT TEXT DESCRIPTION VARCHAR2, 5 DIGITS VARCHAR2, 20 DIGITS DATA TYPE TEXT TEXT TEXT TEXT DESCRIPTION VARCHAR2, 5 DIGITS VARCHAR2, 20 DIGITS VARCHAR2, 40 DIGITS VARCHAR2, 10 DIGITS DATA TYPE TEXT TEXT TEXT TEXT DESCRIPTION VARCHAR2, 5 DIGITS VARCHAR2, 20 DIGITS VARCHAR2, 40 DIGITS VARCHAR2, 10 DIGITS DATA TYPE TEXT TEXT TEXT TEXT DESCRIPTION VARCHAR2, 5 DIGITS VARCHAR2, 20 DIGITS VARCHAR2, 40 DIGITS VARCHAR2, 10 DIGITS

19

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


Table: SALES FIELD NAME BILLNO BILL_DATE CATEGORYID SUBCATEGORYID RETAILERID QTY_SOLD UNIT_PRICE Table: DAMAGEDRET URN FIELD NAME RETURN_DATE RETAILERID AGAINST_BILL_NO CATEGORYID SUBCATEGORY QTY_RETURNED DATA TYPE TEXT TEXT TEXT TEXT TEXT TEXT DESCRIPTION VARCHAR2, 5 DIGITS VARCHAR2, 20 DIGITS VARCHAR2, 40 DIGITS VARCHAR2, 10 DIGITS VARCHAR2, 10 DIGITS VARCHAR2, 10 DIGITS DATA TYPE TEXT TEXT TEXT TEXT TEXT TEXT TEXT DESCRIPTION VARCHAR2, 5 DIGITS DATE VARCHAR2, 40 DIGITS VARCHAR2, 10 DIGITS VARCHAR2, 10 DIGITS VARCHAR2, 10 DIGITS VARCHAR2, 10 DIGITS

6.2.2

DTC DESCRIPTION:

This system does not have any specific DTC, The user can create tables according to one need and hence it can be said that the data said that the data structure is dynamic. 6.2.3 DESIGN

DATA FLOW DIAGRAM: Graphical description of a systems data and how the process transforms the data is know n as Data Flow Diagram. A DFD models is a system using by using external entities from w hic h data flows to a process which transforms the data and creates output data flows whic h go to other processes or external entities or data store. Stored data may also flow or a process as input. LOGICAL & PHYSICAL DFD:DFD that specify various logical processes performed on the data, i.e. typed of operations performed is called logical DFD. It specifies what the system does and not how it does. A physical DFD specifies how the systems requirements are implemented. It is drawn during the system design phase. It is a good starting point and involves operational task and techniques. A logical DFD is derived from physic al DFD. At first step, an entire system connects all the data sources with proper direction of flow data. This DFD is called Context Level DFD or Zero level DFD. In the follow ing steps the entire system is broken into several sub-systems. The DFD that contains more than one process is referred to as Level 1, Level 2 and so on.

SYMBOLS USED IN DFD: To construct a DFD the follow ing system are used: 1. Functional System 2. External entity symbol 3. Data flow symbol 4. Data store symbol A data store : any stored data but w ith no reference to the physic al method of the physical method of storing A data flow : identifies flow of data An external entity: source or destination of date. which is external to the system

A process: converts data into information.

20

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM

USER

SALES MONITORING & INVENTORY CONTROL

DATABASE

21

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM

22

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM

UserLogIn.java:

This is the User login page in which a valid username and password is needed to log in into th system. Only a valid user canl go to the main page of Sales Monitoring and Inventory Control System. Th password field is edited with a * for the security purpose.

23

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM

//UserLogIn.java import java.sql.*; import java.awt.*; public class UserLogin extends java.awt.Frame { public UserLogin() { initComponents(); centre(); } public void centre() { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int x = (int) (screenSize.getWidth() / 2 - getWidth() / 2); int y = (int) (screenSize.getHeight() / 2 - getHeight() / 2); setLocation(x, y); } pri vate void initComponents() { label1 = new java.awt.Label(); button1 = new java.awt.Button(); button2 = new java.awt.Button(); te xtField1 = new java.awt.TextField(); te xtField2 = new java.awt.TextField(); label2 = new java.awt.Label(); label3 = new java.awt.Label(); label5 = new java.awt.Label(); label6 = new java.awt.Label(); setAlwaysOnTop(true); setBackground(new java.awt.Color(153, 204, 255)); setBounds(new java.awt.Rectangle(300, 300, 300, 300)); setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); setIconImages(null); setMinimumSize(new java.awt.Dimension(400, 250)); setResizable(false); setTitle("User Login"); addWindowListener(new java.awt.event.WindowAdapter() { public void windowActivated(java.awt.e vent.WindowEvent evt) { formWindowActivated(evt); } public void windowClosing(java.awt.event.WindowEvent evt) { e xitForm(evt); } }); setLayout(null); label1.setFont(new java.awt.Font("Dialog", 1, 24)); label1.setText("User Login"); add(label1); label1.setBounds(140, 50, 130, 30); button1.setBackground(new java.awt.Color(204, 204, 204));

24

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


button1.setFont(new java.awt.Font("Felix Titling", 1, 12)); // NOI18N button1.setLabel("Ok"); button1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { button1ActionPerformed(evt); } }); add(button1); button1.setBounds(200, 210, 60, 23); button2.setBackground(new java.awt.Color(204, 204, 204)); button2.setFont(new java.awt.Font("Felix Titling", 1, 12)); // NOI18N button2.setLabel("Cancel"); button2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { button2ActionPerformed(evt); } }); add(button2); button2.setBounds(270, 210, 70, 23); add(textField1); te xtField1.setBounds(130, 90, 200, 20); add(textField2); te xtField2.setBounds(130, 120, 200, 20); te xtField2.setEchoChar('*'); label2.setFont(new java.awt.Font("Dialog", 1, 14)); label2.setText("User ID :"); add(label2); label2.setBounds(10, 90, 60, 23); label3.setFont(new java.awt.Font("Dialog", 1, 14)); label3.setText("Password :"); add(label3); label3.setBounds(10, 120, 80, 23); label5.setFont(new java.awt.Font("Felix Titling", 1, 12)); // NOI18N label5.setForeground(new java.awt.Color(255, 0, 51)); label5.setText("WRONG!! PLEASE TR Y AGAIN..."); label5.setVisible(false); add(label5); label5.setBounds(130, 150, 180, 19); label6.setFont(new java.awt.Font("Felix Titling", 1, 12)); // NOI18N label6.setForeground(new java.awt.Color(255, 0, 51)); label6.setText("SORRY! ENTER ID & PASSWORD TO LOGIN..."); label6.setVisible(false); add(label6); label6.setBounds(70, 150, 340, 19); pack(); } pri vate void exitForm(java.awt.event.WindowEvent evt) { System.exit(0); } pri vate void button2ActionPerformed(java.awt.event.ActionEvent e vt) { System.exit(0); } pri vate void formWindowActivated(java.awt.event.WindowEvent evt) { } pri vate void button1ActionPerformed(java.awt.event.ActionEvent e vt) { if (te xtField1.getText().equals("") && textField2.getText().equals("")) {

25

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


label6.setVisible(true); label5.setVisible(false); } Connection con; Statement stmt; try { DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger"); stmt = con.createStatement(); String sql = ("select userid,userpassword from userlogin where userid='" + textField1.getText() + "' and userpassword='" + textField2.getText() + "'"); ResultSet rs = stmt.executeQuery(sql); if (rs.next() == false) { label5.setVisible(true); } else { XYZEnt xyze = new XYZEnt(); this.setVisible(false); xyze.setVisible(true); } } catch (SQLException e) { System.out.print(e); } } public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new UserLogin().setVisible(true); } }); } // Variables declaration pri vate java.awt.Button button1; pri vate java.awt.Button button2; pri vate java.awt.Label label1; pri vate java.awt.Label label2; pri vate java.awt.Label label3; //private ja va.awt.Label label4; pri vate java.awt.Label label5; pri vate java.awt.Label label6; pri vate java.awt.Te xtField textField1; pri vate java.awt.Te xtField textField2; }

26

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM

XYZEnt.java:

This is the main page of Sales Monitoring and Control System. Here a logged user can do different tasks .

27

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM

//XYZEnt.ja va import java.awt.*; import java.util.*; public class XYZEnt e xtends java.awt.Frame implements Runnable { Thread t, t1; public void start() { t = new Thread(this); t.start(); } public void run() { t1 = Thread.currentThread(); while (t1 == t) { Calendar cal = new GregorianCalendar(); String hour = String.valueOf(cal.get(Calendar.HOUR)); String minute = String.valueOf(cal.get(Calendar.MINUTE)); String second = String.valueOf(cal.get(Calendar.SECOND)); label1.setText(hour + ":" + minute + ":" + second); try { t1.sleep(1000); } catch (InterruptedException e) { } } } public XYZEnt() { initComponents(); centre(); //centers this form on screen start(); } pri vate void initComponents() { label1 = new java.awt.Label(); label2 = new java.awt.Label(); menuBar1 = new java.awt.MenuBar(); menu1 = new java.awt.Menu(); menuItem1 = new java.awt.MenuItem(); menuItem2 = new java.awt.MenuItem();

28

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


menuItem3 = new java.awt.MenuItem(); menu4 = new java.awt.Menu(); menuItem4 = new java.awt.MenuItem(); menuItem11 = new java.awt.MenuItem(); menuItem7 = new java.awt.MenuItem(); menuItem12 = new java.awt.MenuItem(); menu5 = new java.awt.Menu(); menuItem9 = new java.awt.MenuItem(); menuItem10 = new java.awt.MenuItem(); menuItem14 = new java.awt.MenuItem(); menuItem8 = new java.awt.MenuItem(); menu2 = new java.awt.Menu(); menuItem5 = new java.awt.MenuItem(); menuItem6 = new java.awt.MenuItem(); menu3 = new java.awt.Menu(); menuItem13 = new java.awt.MenuItem(); menuItem15 = new java.awt.MenuItem(); menuItem16 = new java.awt.MenuItem(); setAlwaysOnTop(true); setBackground(new java.awt.Color(153, 204, 255)); setBounds(new java.awt.Rectangle(300, 100, 0, 0)); setIconImages(null); setMinimumSize(new java.awt.Dimension(750, 500)); setResizable(false); setTitle("Sales Monitoring & Inventory Control System"); addWindowListener(new java.awt.event.WindowAdapter() { public void windowActivated(java.awt.e vent.WindowEvent evt) { formWindowActivated(evt); } public void windowClosing(java.awt.event.WindowEvent evt) { e xitForm(evt); } }); setLayout(null); label1.setAlignment(java.awt.Label.CENTER); label1.setFont(new java.awt.Font("Dialog", 1, 60)); label1.setText("hh/mm/ss"); add(label1); label1.setBounds(240, 230, 300, 70); label2.setFont(new java.awt.Font("Algerian", 0, 36)); label2.setText("mm/dd/yyyy"); add(label2); label2.setBounds(310, 300, 230, 40); menu1.setLabel("| Master Maintainance |"); menu1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menu1ActionPerformed(evt); } }); menuItem1.setLabel("Creditor Master"); menuItem1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuItem1ActionPerformed(evt); } }); menu1.add(menuItem1); menu1.addSeparator();

29

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


menuItem2.setLabel("Retailer Master"); menuItem2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuItem2ActionPerformed(evt); } }); menu1.add(menuItem2); menu1.addSeparator(); menuItem3.setLabel("Distributor Master"); menuItem3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuItem3ActionPerformed(evt); } }); menu1.add(menuItem3); menu1.addSeparator(); menu4.setLabel("Item Group Master Maintainance"); menu4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menu4ActionPerformed(evt); } }); menuItem4.setLabel("Add New Category"); menuItem4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuItem4ActionPerformed(evt); } }); menu4.add(menuItem4); menu4.addSeparator(); menuItem11.setLabel("Delete Category"); menuItem11.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuItem11ActionPerformed(evt); } }); menu4.add(menuItem11); menu4.addSeparator(); menuItem7.setLabel("Add New Sub-Category"); menuItem7.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuItem7ActionPerformed(evt); } }); menu4.add(menuItem7); menu4.addSeparator(); menuItem12.setLabel("Delete Sub-Category"); menuItem12.addActionListener(new java.awt.event.Ac tionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuItem12ActionPerformed(evt); } }); menu4.add(menuItem12); menu1.add(menu4); menu5.setLabel("Stock Master Maintainance"); menuItem9.setLabel("Add New Stock"); menuItem9.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuItem9ActionPerformed(evt); }

30

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


}); menu5.add(menuItem9); menu5.addSeparator(); menuItem10.setLabel("Delete Stock"); menuItem10.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuItem10ActionPerformed(evt); } }); menu5.add(menuItem10); menu1.add(menu5); menuItem14.setLabel("User Maintainance"); menuItem14.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuItem14ActionPerformed(evt); } }); menu1.add(menuItem14); menuItem8.setLabel("Exit"); menuItem8.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuItem8ActionPerformed(evt); } }); menu1.add(menuItem8); menuBar1.add(menu1); menu2.setLabel("| Transactions |"); menuItem5.setLabel("Sales"); menuItem5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuItem5ActionPerformed(evt); } }); menu2.add(menuItem5); menu2.addSeparator(); menuItem6.setLabel("Damaged Stock Returned"); menuItem6.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuItem6ActionPerformed(evt); } }); menu2.add(menuItem6); menuBar1.add(menu2); menu3.setLabel("| Help |"); menuItem13.setLabel("Help Contents"); menuItem13.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuItem13ActionPerformed(evt); } }); menu3.add(menuItem13); menu3.addSeparator(); menuItem15.setLabel("Start Page"); menuItem15.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuItem15ActionPerformed(evt); } }); menu3.add(menuItem15);

31

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


menu3.addSeparator(); menuItem16.setLabel("About"); menuItem16.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuItem16ActionPerformed(evt); } }); menu3.add(menuItem16); menuBar1.add(menu3); setMenuBar(menuBar1); pack(); } /** Exit the Application */ pri vate void exitForm(java.awt.event.WindowEvent evt) { UserLogin ul = new UserLogin(); ul.setVisible(true); this.setVisible(false); } pri vate void menuItem1ActionPerformed(java.awt.event.ActionEvent e vt) { this.setVisible(false); CreditorMaintainanace cm = new CreditorMaintainanace(); cm.setVisible(true); } pri vate void menuItem2ActionPerformed(java.awt.event.ActionEvent e vt) { this.setVisible(false); RetailerMaintainance rm = new RetailerMaintainance(); rm.setVisible(true); } pri vate void menuItem3ActionPerformed(java.awt.event.ActionEvent e vt) { DistributorMaintainanace dm = new DistributorMaintainanace(); this.setVisible(false); dm.setVisible(true); } pri vate void menu1ActionPerformed(java.awt.event.ActionEvent evt) { } pri vate void menuItem8ActionPerformed(java.awt.event.ActionEvent e vt) { System.exit(0); } pri vate void menu4ActionPerformed(java.awt.event.ActionEvent evt) { } pri vate void menuItem6ActionPerformed(java.awt.event.ActionEvent e vt) { DamagedReturn dr = new DamagedReturn(); this.setVisible(false); dr.setVisible(true); } pri vate void menuItem5ActionPerformed(java.awt.event.ActionEvent e vt) { Sales sl = new Sales(); sl.setVisible(true); this.setVisible(false); } pri vate void menuItem14ActionPerformed(java.awt.event.ActionEvent evt) { AddNewUser anu = new AddNewUser(); this.setVisible(false); anu.setVisible(true); } pri vate void menuItem13ActionPerformed(java.awt.event.ActionEvent evt) { HelpContents hp = new HelpContents(); this.setVisible(false); hp.setVisible(true); } pri vate void menuItem4ActionPerformed(java.awt.event.ActionEvent e vt) {

32

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


AddNewCategory anc = new AddNewCategory(); anc.setVisible(true); this.setVisible(false); } pri vate void menuItem7ActionPerformed(java.awt.event.ActionEvent e vt) { AddNewSubCategory ansc = new AddNewSubCategory(); ansc.setVisible(true); this.setVisible(false); } pri vate void menuItem11ActionPerformed(java.awt.event.ActionEvent evt) { DeleteCategory dc = new DeleteCategory(); dc.setVisible(true); this.setVisible(false); } pri vate void menuItem12ActionPerformed(java.awt.event.ActionEvent evt) { DeleteSubCategory dsc = new DeleteSubCategory(); dsc.setVisible(true); this.setVisible(false); } pri vate void menuItem9ActionPerformed(java.awt.event.ActionEvent e vt) { AddStock ans = new AddStock(); ans.setVisible(true); this.setVisible(false); } pri vate void menuItem10ActionPerformed(java.awt.event.Ac tionEvent evt) { DeleteStock ds = new DeleteStock(); ds.setVisible(true); this.setVisible(false); } pri vate void menuItem15ActionPerformed(java.awt.event.ActionEvent evt) { HelpStartPage hsp = new HelpStartPage(); hsp.setVisible(true); this.setVisible(false); } pri vate void menuItem16ActionPerformed(java.awt.event.ActionEvent evt) { HelpAbout ha = new HelpAbout(); ha.setVisible(true); this.setVisible(false); } pri vate void formWindowActivated(java.awt.event.WindowEvent evt) { label2.setText(TryDateFormats.displayDate()); } public void centre() { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int x = (int) (screenSize.getWidth() / 2 - getWidth() / 2); int y = (int) (screenSize.getHeight() / 2 - getHeight() / 2); setLocation(x, y); } public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new XYZEnt().setVisible(true); } }); }

// Variables declaration

33

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


pri vate java.awt.Label label1; pri vate java.awt.Label label2; pri vate java.awt.Menu menu1; pri vate java.awt.Menu menu2; pri vate java.awt.Menu menu3; pri vate java.awt.Menu menu4; pri vate java.awt.Menu menu5; pri vate java.awt.MenuBar menuBar1; pri vate java.awt.MenuItem menuItem1; pri vate java.awt.MenuItem menuItem10; pri vate java.awt.MenuItem menuItem11; pri vate java.awt.MenuItem menuItem12; pri vate java.awt.MenuItem menuItem13; pri vate java.awt.MenuItem menuItem14; pri vate java.awt.MenuItem menuItem15; pri vate java.awt.MenuItem menuItem16; pri vate java.awt.MenuItem menuItem2; pri vate java.awt.MenuItem menuItem3; pri vate java.awt.MenuItem menuItem4; pri vate java.awt.MenuItem menuItem5; pri vate java.awt.MenuItem menuItem6; pri vate java.awt.MenuItem menuItem7; pri vate java.awt.MenuItem menuItem8; pri vate java.awt.MenuItem menuItem9; }

34

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM

CreditorMaintenence.java:

User can keep the record of Companys creditor in creditor maintenance part.

35

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM

//CreditorMaintenence.java import java.sql.*; import java.awt.*; public class CreditorMaintainanace extends java.awt.Frame { public CreditorMaintainanace() { initComponents(); centre(); } public void centre() { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int x = (int) (screenSize.getWidth() / 2 - getWidth() / 2); int y = (int) (screenSize.getHeight() / 2 - getHeight() / 2); setLocation(x, y); } pri vate void initComponents() { label1 = new java.awt.Label(); label2 = new java.awt.Label(); label3 = new java.awt.Label(); te xtField1 = new java.awt.TextField(); te xtField2 = new java.awt.TextField(); te xtField3 = new java.awt.TextField(); label4 = new java.awt.Label(); button1 = new java.awt.Button(); te xtArea1 = new java.awt.Te xtArea(); label5 = new java.awt.Label(); button3 = new java.awt.Button(); label6 = new java.awt.Label(); te xtField4 = new java.awt.TextField(); setAlwaysOnTop(true); setBackground(new java.awt.Color(153, 204, 255)); setBounds(new java.awt.Rectangle(300, 200, 0, 0)); setMinimumSize(new java.awt.Dimension(570, 470)); setResizable(false); setTitle("Creditor Maintainance"); addWindowListener(new java.awt.event.WindowAdapter() { public void windowActivated(java.awt.e vent.WindowEvent evt) { formWindowActivated(evt); } public void windowClosing(java.awt.event.WindowEvent evt) { e xitForm(evt);

36

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


} }); setLayout(null); label1.setFont(new java.awt.Font("Dialog", 1, 18)); label1.setText("Creditor Maintainance"); add(label1); label1.setBounds(210, 40, 210, 20); label2.setText("Creditor Name"); add(label2); label2.setBounds(40, 100, 150, 20); label3.setText("Creditor Address"); add(label3); label3.setBounds(40, 130, 150, 20); add(textField1); te xtField1.setBounds(210, 70, 210, 20); add(textField2); te xtField2.setBounds(210, 100, 210, 20); add(textField3); te xtField3.setBounds(210, 130, 210, 20); label4.setText("Creditor Conatact no."); add(label4); label4.setBounds(40, 160, 160, 20); button1.setLabel("Add"); button1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { button1ActionPerformed(evt); } }); add(button1); button1.setBounds(450, 80, 50, 24); add(textArea1); te xtArea1.setBounds(20, 230, 510, 180); label5.setFont(new java.awt.Font("Dialog", 1, 14)); label5.setText("Current Creditors"); add(label5); label5.setBounds(220, 200, 130, 23); button3.setLabel("Exit"); button3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { button3ActionPerformed(evt); } }); add(button3); button3.setBounds(450, 110, 50, 24); label6.setText("Creditor ID"); add(label6); label6.setBounds(40, 70, 100, 20); add(textField4); te xtField4.setBounds(210, 160, 210, 20); pack(); } pri vate void exitForm(java.awt.event.WindowEvent evt) { XYZEnt xyz = new XYZEnt(); xyz.setVisible(true); this.setVisible(false); }

37

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


pri vate void button3ActionPerformed(java.awt.event.ActionEvent e vt) { XYZEnt xyz = new XYZEnt(); xyz.setVisible(true); this.setVisible(false); } pri vate void button1ActionPerformed(java.awt.event.ActionEvent e vt) { try { DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger"); Statement stmt = con.createStatement(); String sql = "insert into creditormaster values('" + te xtField1.getText() + "','" + te xtField2.getText() + "','" + textField3.getText() + "','" + textField4.getText() + "')"; int records_updated = stmt.executeUpdate(sql); con.commit(); } catch (SQLException e) { System.out.print(e); } te xtField1.setText(""); te xtField2.setText(""); te xtField3.setText(""); te xtField4.setText(""); refresh(); } pri vate void formWindowActivated(java.awt.event.WindowEvent evt) { int no_of_times = 0; try { DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger"); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select * from creditormaster order by creditorid"); no_of_times++; if (no_of_times == 1) { textArea1.append("Creditor ID" + " " + "Creditor Name" + " " + "Creditor Address" + " " + "Creditor Contact no."); } while (rs.next()) { textArea1.append("\n" + " " + rs.getString(1) + " " + rs.getString(2) + " " + rs.getString(3) + " " + rs.getString(4)); } } catch (SQLException e) { } } pri vate void refresh() { te xtField1.setText(""); te xtField2.setText(""); te xtField3.setText(""); te xtField4.setText(""); te xtArea1.setText(""); try { DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger"); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select * from creditormas ter order by creditorid"); textArea1.append("Creditor ID" + " " + "Creditor Name" + " " + "Creditor Address" + " "+ "Creditor Contact no."); while (rs.next()) { textArea1.append("\n" + " " + rs.getString(1) + " " + rs.getString(2) + " " + rs.getString(3) + " " + rs.getString(4)); }

38

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


} catch (SQLException e) { } } public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new CreditorMaintainanace().setVisible(true); } }); } // Variables declaration pri vate java.awt.Button button1; pri vate java.awt.Button button3; pri vate java.awt.Label label1; pri vate java.awt.Label label2; pri vate java.awt.Label label3; pri vate java.awt.Label label4; pri vate java.awt.Label label5; pri vate java.awt.Label label6; pri vate java.awt.Te xtArea te xtArea1; pri vate java.awt.Te xtField textField1; pri vate java.awt.Te xtField textField2; pri vate java.awt.Te xtField textField3; pri vate java.awt.Te xtField textField4; }

39

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM

RetailerMaintenence.java:

User can keep the record of Companys retailer in retailer maintenance part.

40

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM

//RetailerMaintenence.java import java.sql.*; import java.awt.*; public class RetailerMaintainance extends java.awt.Frame { public RetailerMaintainance() { initComponents(); centre(); } public void centre() { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int x = (int) (screenSize.getWidth() / 2 - getWidth() / 2); int y = (int) (screenSize.getHeight() / 2 - getHeight() / 2); setLocation(x, y); } private void initComponents() { label1 = new java.awt.Label(); label2 = new java.awt.Label(); label3 = new java.awt.Label(); te xtField1 = new java.awt.TextField(); te xtField2 = new java.awt.TextField(); te xtField3 = new java.awt.TextField(); label4 = new java.awt.Label(); button1 = new java.awt.Button(); te xtArea1 = new java.awt.Te xtArea(); label5 = new java.awt.Label(); button3 = new java.awt.Button(); label6 = new java.awt.Label(); te xtField4 = new java.awt.TextField(); setAlwaysOnTop(true); setBackground(new java.awt.Color(153, 204, 255)); setBounds(new java.awt.Rectangle(300, 200, 0, 0)); setMinimumSize(new java.awt.Dimension(575, 440)); setResizable(false); setTitle("Retailer Maintainance"); addWindowListener(new java.awt.event.WindowAdapter() { public void windowActivated(java.awt.e vent.WindowEvent evt) { formWindowActivated(evt); } public void windowClosing(java.awt.event.WindowEvent evt) { exitForm(evt); } });

41

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


setLayout(null); label1.setFont(new java.awt.Font("Dialog", 1, 18)); label1.setText("Retailer Maintainance"); add(label1); label1.setBounds(190, 30, 210, 28); label2.setText("Retailer Name"); add(label2); label2.setBounds(30, 100, 140, 20); label3.setText("Retailer Address"); add(label3); label3.setBounds(30, 130, 140, 20); add(textField1); te xtField1.setBounds(200, 70, 210, 20); add(textField2); te xtField2.setBounds(200, 100, 210, 20); add(textField3); te xtField3.setBounds(200, 130, 210, 20); label4.setText("Retailer Conatact no."); add(label4); label4.setBounds(30, 160, 150, 20); button1.setLabel("Add"); button1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { button1ActionPerformed(evt); } }); add(button1); button1.setBounds(440, 90, 50, 24); add(textArea1); te xtArea1.setBounds(20, 220, 510, 180); label5.setFont(new java.awt.Font("Dialog", 1, 14)); label5.setText("Current Retailers"); add(label5); label5.setBounds(200, 190, 130, 23); button3.setLabel("Exit"); button3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { button3ActionPerformed(evt); } }); add(button3); button3.setBounds(440, 120, 50, 24); label6.setText("Retailer ID"); add(label6); label6.setBounds(30, 70, 62, 20); add(textField4); te xtField4.setBounds(200, 160, 210, 20); pack(); } pri vate void exitForm(java.awt.event.WindowEvent evt) { XYZEnt xyz = new XYZEnt(); xyz.setVisible(true); this.setVisible(false); } pri vate void button3ActionPerformed(java.awt.event.ActionEvent e vt) { XYZEnt xyz = new XYZEnt(); xyz.setVisible(true); this.setVisible(false); }

42

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


pri vate void button1ActionPerformed(java.awt.event.ActionEvent e vt) { try { DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger"); Statement stmt = con.createStatement(); String sql = "insert into retailerm aster values('" + te xtField1.getText() + "','" + textField2.getText() + "','" + te xtField3.getText() + "','" + te xtField4.getText() + "')"; int records_updated = stmt.executeUpdate(sql); con.commit(); } catch (SQLException e) { } te xtField1.setText(""); te xtField2.setText(""); te xtField3.setText(""); te xtField4.setText(""); refresh(); } pri vate void formWindowActivated(java.awt.event.WindowEvent evt) { try { DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","scott", "tiger"); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select * from retailermaster order by retailerid"); textArea1.append("Retailer ID" + " " + "Retailer Name" + " " + "Retailer Address" + " "+ "Retailer Contact no."); while (rs.next()) { textArea1.append("\n" + " " + rs.getString(1) + " " + rs.getString(2) + " " + rs.getString(3) + " " + rs.getString(4)); } } catch (SQLException e) { } } private void refresh(){ te xtField1.setText(""); te xtField2.setText(""); te xtField3.setText(""); te xtField4.setText(""); te xtArea1.setText(""); try { DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger"); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select * from retailermaster order by retailerid"); textArea1.append("Retailer ID" + " " + "Retailer Name" + " " + "Retailer Address" + " "+ "Retailer Contact no."); while (rs.next()) { textArea1.append("\n" + " " + rs.getString(1) + " " + rs.getString(2) + " " + rs.getString(3) + " " + rs.getString(4)); } } catch (SQLException e) { } } public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new RetailerMaintainance().setVisible(true); } }); }

43

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


// Variables declaration pri vate java.awt.Button button1; //private ja va.awt.Button button2; pri vate java.awt.Button button3; pri vate java.awt.Label label1; pri vate java.awt.Label label2; pri vate java.awt.Label label3; pri vate java.awt.Label label4; pri vate java.awt.Label label5; pri vate java.awt.Label label6; pri vate java.awt.Te xtArea te xtArea1; pri vate java.awt.Te xtField textField1; pri vate java.awt.Te xtField textField2; pri vate java.awt.Te xtField textField3; pri vate java.awt.Te xtField textField4; }

44

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM

DistributorMaintenence.java:

User can keep the record of Companys distributor in distributor maintenance part.

45

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM

//DistributorMaintenence.java import java.sql.*; import java.awt.*; public class DistributorMaintainanace extends java.awt.Frame { public DistributorMaintainanace() { initComponents(); centre(); } public void centre() { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int x = (int) (screenSize.getWidth() / 2 - getWidth() / 2); int y = (int) (screenSize.getHeight() / 2 - getHeight() / 2); setLocation(x, y); } pri vate void initComponents() { label1 = new java.awt.Label(); label2 = new java.awt.Label(); label3 = new java.awt.Label(); te xtField1 = new java.awt.TextField(); te xtField2 = new java.awt.TextField(); te xtField3 = new java.awt.TextField(); label4 = new java.awt.Label(); button1 = new java.awt.Button(); //button2 = new java.awt.Button(); te xtArea1 = new java.awt.Te xtArea(); label5 = new java.awt.Label(); button3 = new java.awt.Button(); label6 = new java.awt.Label(); te xtField4 = new java.awt.TextField(); setAlwaysOnTop(true); setBackground(new java.awt.Color(153, 204, 255)); setBounds(new java.awt.Rectangle(300, 200, 0, 0)); setMinimumSize(new java.awt.Dimension(600, 470)); setResizable(false); setTitle("Distributor Master Maintainance"); addWindowListener(new java.awt.event.WindowAdapter() { public void windowActivated(java.awt.e vent.WindowEvent evt) { formWindowActivated(evt); } public void windowClosing(java.awt.event.WindowEvent evt) {

46

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


e xitForm(evt); } }); setLayout(null); label1.setFont(new java.awt.Font("Dialog", 1, 16)); label1.setText("Distributor Maintainance"); add(label1); label1.setBounds(190, 30, 220, 25); label2.setText("Distributor Name"); add(label2); label2.setBounds(30, 110, 140, 20); label3.setText("Distributor Address"); add(label3); label3.setBounds(30, 140, 140, 20); add(textField1); te xtField1.setBounds(200, 80, 210, 20); add(textField2); te xtField2.setBounds(200, 110, 210, 20); add(textField3); te xtField3.setBounds(200, 140, 210, 20); label4.setText("Distributor Conatact no."); add(label4); label4.setBounds(30, 170, 150, 20); button1.setLabel("Add"); button1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { button1ActionPerformed(evt); } }); add(button1); button1.setBounds(440, 90, 50, 24); add(textArea1); te xtArea1.setBounds(30, 230, 510, 180); label5.setFont(new java.awt.Font("Dialog", 1, 13)); label5.setText("Current Distributors"); add(label5); label5.setBounds(210, 200, 150, 22); button3.setLabel("Exit"); button3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { button3ActionPerformed(evt); } }); add(button3); button3.setBounds(440, 120, 50, 24); label6.setText("Distributor ID"); add(label6); label6.setBounds(30, 80, 80, 20); add(textField4); te xtField4.setBounds(200, 170, 210, 20); pack();

47

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


} pri vate void exitForm(java.awt.event.WindowEvent evt) { XYZEnt xyz = new XYZEnt(); xyz.setVisible(true); this.setVisible(false); } private void button3ActionPerformed(java.awt.event.ActionEvent evt) { XYZEnt xyz = new XYZEnt(); xyz.setVisible(true); this.setVisible(false); } pri vate void formWindowActivated(java.awt.event.WindowEvent evt) { try { DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger") ; Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select * from distributormaster order by distributorid"); textArea1.append("Distributor ID" + " " + "Distributor Name" + " " + "Distributor Address" + " " + "Distributor Contact no."); while (rs.next()) { textArea1.append("\n" + " " + rs.getString(1) + " " + rs.getString(2) + " " + rs.getString(3) + " " + rs.getString(4)); } } catch (SQLException e) { } } pri vate void button1ActionPerformed(java.awt.event.ActionEvent e vt) { try { DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger"); Statement stmt = con.createStatement(); String sql = "insert into distributormaster values('" + te xtField1.getText() + "','" + te xtField2.getText() + "','" + textField3.getText() + "','" + textField4.getText() + "')"; int records_updated = stmt.executeUpdate(sql); con.commit(); } catch (SQLException e) { } te xtField1.setText(""); te xtField2.setText(""); te xtField3.setText(""); te xtField4.setText(""); refresh(); } pri vate void refresh() { te xtField1.setText(""); te xtField2.setText(""); te xtField3.setText(""); te xtField4.setText(""); te xtArea1.setText(""); try { DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger"); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select * from distributormaster"); textArea1.append("Distributor ID" + " " + "Distributor Name" + " " + "Distributor Address" + " " + "Distributor Contact no."); while (rs.next()) { textArea1.append("\n" + " " + rs.getString(1) + " " + rs.getString(2) + " " + rs.getString(3) + " " + rs.getString(4)); } } catch (SQLException e) { } } public static void main(String args[]) {

48

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new DistributorMaintainanace().setVisible(true); } }); } // Variables declaration pri vate java.awt.Button button1; //private ja va.awt.Button button2; pri vate java.awt.Button button3; pri vate java.awt.Label label1; pri vate java.awt.Label label2; pri vate java.awt.Label label3; pri vate java.awt.Label label4; pri vate java.awt.Label label5; pri vate java.awt.Label label6; pri vate java.awt.Te xtArea te xtArea1; pri vate java.awt.Te xtField textField1; pri vate java.awt.Te xtField textField2; pri vate java.awt.Te xtField textField3; pri vate java.awt.Te xtField textField4; // End of variables declaration }

49

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM

AddNewCategory.java:

User can add new category of product into category database using this form. Step to be followed to get this form as follows: Master Maintenance > Item Group Master Maintenance >Add New Category.

50

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


Before Addition: After Addition:

//AddNewCategory .java import java.sql.*; import java.awt.*; public class AddNewCategory e xtends java.awt.Frame { /** Creates new form AddNewCategory */ public AddNewCategory() { initComponents(); centre(); } pri vate void initComponents() { label1 = new java.awt.Label(); button1 = new java.awt.Button(); te xtField1 = new java.awt.TextField(); button2 = new java.awt.Button(); label2 = new java.awt.Label(); label3 = new java.awt.Label(); te xtField2 = new java.awt.TextField(); label4 = new java.awt.Label(); setBackground(new java.awt.Color(153, 204, 255)); setMinimumSize(new java.awt.Dimension(400, 200)); setTitle("Add New Category"); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { e xitForm(evt); } }); setLayout(null); label1.setFont(new java.awt.Font("Dialog", 1, 16)); label1.setText("Add New Category"); add(label1); label1.setBounds(120, 30, 150, 25); button1.setLabel("Save"); button1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { button1ActionPerformed(evt); } }); add(button1); button1.setBounds(230, 150, 43, 24); te xtField1.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { textField1MouseClicked(evt); } });

51

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


te xtField1.addKeyListener(new java.awt.event.Ke yAdapter() { public void keyTyped(java.awt.event.Ke yEvent e vt) { textField1KeyTyped(evt); } }); add(textField1); te xtField1.setBounds(160, 80, 190, 20); button2.setLabel("Back"); button2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { button2ActionPerformed(evt); } }); add(button2); button2.setBounds(280, 150, 50, 24); label2.setText("Category ID"); add(label2); label2.setBounds(20, 80, 70, 20); label3.setText("Category Name"); add(label3); label3.setBounds(20, 110, 90, 20); add(textField2); te xtField2.setBounds(160, 110, 190, 20); label4.setForeground(new java.awt.Color(204, 255, 204)); label4.setText("Record Saved"); label4.setVisible(false); add(label4); label4.setBounds(20, 160, 170, 20); pack(); } pri vate void exitForm(java.awt.event.WindowEvent evt) { XYZEnt xyz = new XYZEnt(); xyz.setVisible(true); this.setVisible(false); } pri vate void button1ActionPerformed(java.awt.event.ActionEvent e vt) { try { DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger"); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select * from category where categoryid='" + textField1.getText() + "'"); if (!rs.next()) { rs.close(); String sql = "insert into Category values('" + te xtField1.getText() + "','" + te xtField2.getText() + "')"; int records_updated = stmt.executeUpdate(sql); con.commit(); } } catch (SQLException e) { System.out.print(e); } te xtField1.setText(""); te xtField2.setText(""); label4.setVisible(true); label4.setText("Category Added"); }

52

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


pri vate void button2ActionPerformed(java.awt.event.ActionEvent e vt) { XYZEnt xyz = new XYZEnt(); xyz.setVisible(true); this.setVisible(false); } pri vate void textField1KeyTyped(java.awt.event.Ke yEvent e vt) { label4.setVisible(fals e); } pri vate void textField1MouseClicked(java.awt.event.MouseEvent evt) { label4.setVisible(false); } public void centre() { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int x = (int) (screenSize.getWidth() / 2 - getWidth() / 2); int y = (int) (screenSize.getHeight() / 2 - getHeight() / 2); setLocation(x, y); } public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new AddNewCategory().setVisible(true); } }); } // Variables declaration pri vate java.awt.Button button1; pri vate java.awt.Button button2; pri vate java.awt.Label label1; pri vate java.awt.Label label2; pri vate java.awt.Label label3; pri vate java.awt.Label label4; pri vate java.awt.Te xtField textField1; pri vate java.awt.Te xtField textField2; // End of variables declaration }

53

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM

DeleteCategory.java:

User can delete category of product from category database using this form. Step to be followed to get this form as follows: Master Maintenance > Item Group Master Maintenance >Delete Category.

54

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


Before Deletion: After Deletion:

//DeleteCategory.java import java.sql.*; import java.awt.*; public class DeleteCategory extends java.awt.Fram e { public DeleteCategory() { initComponents(); centre(); } public void centre() { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int x = (int) (screenSize.getWidth() / 2 - getWidth() / 2); int y = (int) (screenSize.getHeight() / 2 - getHeight() / 2); setLocation(x, y); } pri vate void initComponents() { button1 = new java.awt.Button(); choice1 = new java.awt.Choice(); button2 = new java.awt.Button(); label1 = new java.awt.Label(); label2 = new java.awt.Label(); label3 = new java.awt.Label(); te xtField1 = new java.awt.TextField(); label4 = new java.awt.Label(); setBackground(new java.awt.Color(153, 204, 255)); setMinimumSize(new java.awt.Dimension(380, 210)); setTitle("Category Deletion"); addWindowListener(new java.awt.event.WindowAdapter() { public void windowActivated(java.awt.e vent.WindowEvent evt) { formWindowActivated(evt); } public void windowClosing(java.awt.event.WindowEvent evt) { e xitForm(evt); } }); setLayout(null); button1.setLabel("Ok"); button1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { button1ActionPerformed(evt); } }); add(button1); button1.setBounds(170, 160, 60, 24); choice1.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { choice1MouseClicked(evt); }

55

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


public void mouseEntered(java.awt.event.MouseEvent evt) { choice1MouseEntered(evt); } }); choice1.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent e vt) { choice1ItemStateChanged(evt); } }); add(choice1); choice1.setBounds(160, 90, 140, 20); button2.setLabel("Back"); button2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { button2ActionPerformed(evt); } }); add(button2); button2.setBounds(240, 160, 60, 24); label1.setFont(new java.awt.Font("Dialog", 1, 16)); label1.setText("Category Deletion"); add(label1); label1.setBounds(130, 40, 140, 25); label2.setText("Category"); add(label2); label2.setBounds(20, 90, 60, 20); label3.setFont(new java.awt.Font("Dialog", 0, 11)); label3.setForeground(new java.awt.Color(204, 255, 204)); add(label3); label3.setBounds(20, 160, 110, 19); add(textField1); te xtField1.setBounds(160, 120, 140, 20); label4.setText("Category Name"); add(label4); label4.setBounds(20, 120, 100, 20); pack(); } /** Exit the Application */ pri vate void exitForm(java.awt.event.WindowEvent evt) { XYZEnt xyze = new XYZEnt(); this.setVisible(false); xyze.setVisible(true); } pri vate void formWindowActivated(java.awt.event.WindowEvent evt) { Connection con; Statement stmt; try { DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger"); stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select CategoryID from Category order by CategoryID"); while (rs.next()) { String s1 = rs.getString("CategoryID"); choice1.addItem(s1); } } catch (SQLException e) { } }

56

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


pri vate void button1ActionPerformed(java.awt.event.ActionEvent e vt) { try { DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger"); Statement stmt = con.createStatement(); String sql = "delete from subcategory where categoryid= '" + choice1.getSelectedItem() + "'"; int records_updated = stm t.executeUpdate(sql); sql = "delete from category where categoryid= '" + choice1.getSelectedItem() + "'"; records_updated = stmt.executeUpdate(sql); label3.setVisible(true); label3.setText("Category Deleted !"); } catch (SQLException e) { } } pri vate void button2ActionPerformed(java.awt.event.ActionEvent e vt) { XYZEnt xyze = new XYZEnt(); this.setVisible(false); xyze.setVisible(true); } pri vate void choice1ItemStateChanged(java.awt.event.ItemEvent e vt) { Connection con; Statement stmt; try { DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger"); stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select Category_name from category where CategoryID ='" + choice1.getSelectedItem() + "' "); while (rs.next()) { String s = rs.getString("Category_name"); textField1.setText(s); } } catch (SQLException e) { } } pri vate void choice1MouseClicked(java.awt.event.MouseEvent evt) { } pri vate void choice1MouseEntered(java.awt.event.MouseEvent evt) { label3.setVisible(false); } public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new DeleteCategory().setVisible(true); } }); } // Variables declaration pri vate java.awt.Button button1; pri vate java.awt.Button button2; pri vate java.awt.Choice choice1; pri vate java.awt.Label label1; pri vate java.awt.Label label2; pri vate java.awt.Label label3; pri vate java.awt.Label label4; pri vate java.awt.Te xtField textField1; // End of variables declaration }

57

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM

AddNewSubCategory.java:

User can add new Sub-category of an existing product Category into Sub-category database using this form. Step to be followed to get this form as follows: Master Maintenance > Item Group Master Maintenance >Add New Sub Category.

58

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


Before Addition: After Addition:

//AddNewSubCategory.java import java.sql.*; import java.awt.*; public class AddNewSubCategory extends java.awt.Frame { public AddNewSubCategory() { initComponents(); centre(); } pri vate void initComponents() { label1 = new java.awt.Label(); label2 = new java.awt.Label(); label3 = new java.awt.Label(); label4 = new java.awt.Label(); choice1 = new java.awt.Choice(); te xtField1 = new java.awt.TextField(); te xtField2 = new java.awt.TextField(); button1 = new java.awt.Button(); button2 = new java.awt.Button(); label5 = new java.awt.Label(); setBackground(new java.awt.Color(153, 204, 255)); setMinimumSize(new java.awt.Dimension(400, 260)); setTitle("Add New SubCategory"); addWindowListener(new java.awt.event.WindowAdapter() { public void windowActivated(java.awt.e vent.WindowEvent evt) { formWindowActivated(evt); } public void windowClosing(java.awt.event.WindowEvent evt) { e xitForm(evt); } }); setLayout(null); label1.setFont(new java.awt.Font("Dialog", 1, 14)); label1.setText("Add New Sub-Category"); add(label1); label1.setBounds(110, 40, 170, 23); label2.setText("Category"); add(label2); label2.setBounds(10, 100, 60, 20); label3.setText("Sub-Category ID"); add(label3); label3.setBounds(10, 130, 94, 20); label4.setText("Sub-Category Name"); add(label4); label4.setBounds(10, 160, 120, 20);

59

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


choice1.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseEntered(java.awt.event.MouseEvent evt) { choice1MouseEntered(evt); } }); add(choice1); choice1.setBounds(160, 100, 160, 20); add(textField1); te xtField1.setBounds(160, 130, 160, 20); add(textField2); te xtField2.setBounds(160, 160, 160, 20); button1.setLabel("Ok"); button1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { button1ActionPerformed(evt); } }); add(button1); button1.setBounds(180, 200, 50, 24); button2.setLabel("Back"); button2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { button2ActionPerformed(evt); } }); add(button2); button2.setBounds(240, 200, 57, 24); label5.setForeground(new java.awt.Color(204, 255, 204)); label5.setText("Sub-Category Added"); label5.setVisible(false); add(label5); label5.setBounds(10, 200, 140, 20); pack(); } pri vate void exitForm(java.awt.event.WindowEvent evt) { XYZEnt xyz = new XYZEnt(); xyz.setVisible(true); this.setVisible(false); } pri vate void formWindowActivated(java.awt.event.WindowEvent evt) { Connection con; Statement stmt; try { DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger"); stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select CategoryID from Category order by CategoryID"); while (rs.next()) { String s = rs.getString("CategoryID"); choice1.addItem(s); } } catch (SQLException e) { } } pri vate void button1ActionPerformed(java.awt.event.ActionEvent e vt) { try { DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger"); Statement stmt = con.createStatement();

60

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


String sql = "insert into Subcategory values('" + textField1.getText() + "','" + textField2.getText() + "','" + choice1.getSelectedItem() + "')"; int records_updated = stmt.executeUpdate(sql); con.commit(); } catch (SQLException e) { } label5.setVisible(true); te xtField1.setText(""); te xtField2.setText(""); } pri vate void button2ActionPerformed(java.awt.event.ActionEvent e vt) { XYZEnt xyz = new XYZEnt(); xyz.setVisible(true); this.setVisible(false); } pri vate void choice1MouseEntered(java.awt.event.MouseEvent evt) { label5.setVisible(false); } public void centre() { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int x = (int) (screenSize.getWidth() / 2 - getWidth() / 2); int y = (int) (screenSize.getHeight() / 2 - getHeight() / 2); setLocation(x, y); } public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new AddNewSubCategory().setVisible(true); } }); } // Variables declaration pri vate java.awt.Button button1; pri vate java.awt.Button button2; pri vate java.awt.Choice choice1; pri vate java.awt.Label label1; pri vate java.awt.Label label2; pri vate java.awt.Label label3; pri vate java.awt.Label label4; pri vate java.awt.Label label5; pri vate java.awt.Te xtField textField1; pri vate java.awt.Te xtField textField2; // End of variables declaration }

61

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM

DeleteSubCategory.java:

User can delete sub-category of product from subcategory database using this form. Step to be followed to get this form as follows: Master Maintenance > Item Group Master Maintenance >Delete Sub Category.

62

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


Before Deletion: After deletion:

//DeleteSubCategory.java import java.sql.*; import java.awt.*; public class DeleteSubCategory extends java.awt.Frame { public DeleteSubCategory() { initComponents(); centre(); } public void centre() { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int x = (int) (screenSize.getWidth() / 2 - getWidth() / 2); int y = (int) (screenSize.getHeight() / 2 - getHeight() / 2); setLocation(x, y); } pri vate void initComponents() { label1 = new java.awt.Label(); label2 = new java.awt.Label(); label3 = new java.awt.Label(); choice1 = new java.awt.Choice(); choice2 = new java.awt.Choice(); button1 = new java.awt.Button(); button2 = new java.awt.Button(); te xtField1 = new java.awt.TextField(); label4 = new java.awt.Label(); label5 = new java.awt.Label(); setBackground(new java.awt.Color(153, 204, 255)); setMinimumSize(new java.awt.Dimension(400, 280)); setTitle("Delete Sub-Category"); addWindowListener(new java.awt.event.WindowAdapter() { public void windowActivated(java.awt.e vent.WindowEvent evt) { formWindowActivated(evt); } public void windowClosing(java.awt.event.WindowEvent evt) { e xitForm(evt); } }); addMouseMotionListener(new java.awt.event.MouseMotionAdapter() { public void mouseMoved(java.awt.event.MouseEvent evt) { formMouseMoved(evt); } }); setLayout(null); label1.setFont(new java.awt.Font("Dialog", 1, 16)); label1.setText("Delete Sub-Category"); add(label1);

63

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


label1.setBounds(120, 50, 170, 25); label2.setText("Category"); add(label2); label2.setBounds(60, 100, 53, 20); label3.setText("Sub-Category"); add(label3); label3.setBounds(60, 130, 79, 20); choice1.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent e vt) { choice1ItemStateChanged(evt); } }); add(choice1); choice1.setBounds(200, 130, 140, 20); choice2.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent e vt) { choice2ItemStateChanged(evt); } }); add(choice2); choice2.setBounds(200, 100, 140, 20); button1.setLabel("Ok"); button1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { button1ActionPerformed(evt); } }); add(button1); button1.setBounds(220, 200, 60, 24); button2.setLabel("Back"); button2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { button2ActionPerformed(evt); } }); add(button2); button2.setBounds(290, 200, 50, 24); te xtField1.setBackground(new java.awt.Color(204, 255, 255)); te xtField1.setEditable(false); add(textField1); te xtField1.setBounds(200, 160, 140, 20); label4.setText("Sub-Category Name"); add(label4); label4.setBounds(60, 160, 120, 20); label5.setForeground(new java.awt.Color(204, 255, 204)); label5.setText("Sub-Category Deleted"); label5.setVisible(false); add(label5); label5.setBounds(60, 200, 130, 20); pack(); }

64

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


/** Exit the Application */ pri vate void exitForm(java.awt.event.WindowEvent evt) { XYZEnt xyz = new XYZEnt(); xyz.setVisible(true); this.setVisible(false); } pri vate void formWindowActivated(java.awt.event.WindowEvent evt) { Connection con; Statement stmt; try { DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger"); stmt = con.createStatement(); ResultSet rs1 = stmt.executeQuery("select CategoryID from Category order by CategoryID"); while (rs1.next()) { String s1 = rs1.getString("CategoryID"); choice2.addItem(s1); } rs1.close(); } catch (SQLException e) { } } pri vate void choice2ItemStateChanged(java.awt.event.ItemEvent e vt) { Connection con; Statement stmt; choice1.removeAll(); try { DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger") ; stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select SUbCategoryID from Subcategory where CategoryID ='" + choice2.getSelectedItem() + "' order by SUbCategoryID"); while (rs.next()) { String s = rs.getString("SUbCategoryID"); choice1.addItem(s); } rs.close(); } catch (SQLException e) { } } pri vate void button1ActionPerformed(java.awt.event.ActionEvent e vt) { try { DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger"); Statement stmt = con.createStatement(); String sql1 = ("delete from Subcategory where subCategoryID ='" + choice1.getSelectedItem() + "' and categoryid='" + choice2.getSelectedItem() + "'"); int records_updated = stmt.executeUpdate(sql1); te xtField1.setText(""); label5.setVisible(true); } catch (SQLException e) { } } pri vate void button2ActionPerformed(java.awt.event.ActionEvent e vt) { XYZEnt xyz = new XYZEnt(); xyz.setVisible(true); this.setVisible(false); } pri vate void choice1ItemStateChanged(java.awt.event.ItemEvent e vt) { Connection con; Statement stmt; try { DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger");

65

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select SUbCategory_name from Subcategory where subCategoryID ='" + choice1.getSelectedItem() + "'"); while (rs.next()) { String s = rs.getString("SUbCategory_name"); //choice1.addItem(s); textField1.setText(s); } } catch (SQLException e) { } } pri vate void formMouseMoved(java.awt.event.MouseEvent evt) { label5.setVisible(false); } public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new DeleteSubCategory().setVisible(true); } }); } // Variables declaration pri vate java.awt.Button button1; pri vate java.awt.Button button2; pri vate java.awt.Choice choice1; pri vate java.awt.Choice choice2; pri vate java.awt.Label label1; pri vate java.awt.Label label2; pri vate java.awt.Label label3; pri vate java.awt.Label label4; pri vate java.awt.Label label5; pri vate java.awt.Te xtField textField1; // End of variables declaration }

66

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM

AddStock.java:

to maintain the stock of XYZEnterprise, its badly needed to keep the information about stock during addition / deletion of stock. Here we are going to add a new product of existing category or sub-category to stock database.

67

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


Before Addition: After Addition :

//AddStock.java import java.sql.*; import java.awt.*; public class AddStock extends java.awt.Frame { /** Creates new form AddStock */ public AddStock() { initComponents(); centre(); } public void centre() { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int x = (int) (screenSize.getWidth() / 2 - getWidth() / 2); int y = (int) (screenSize.getHeight() / 2 - getHeight() / 2); setLocation(x, y); } pri vate void initComponents() { label1 = new java.awt.Label(); label2 = new java.awt.Label(); label3 = new java.awt.Label(); choice1 = new java.awt.Choice(); choice2 = new java.awt.Choice(); label4 = new java.awt.Label(); label5 = new java.awt.Label(); te xtField1 = new java.awt.TextField(); te xtField2 = new java.awt.TextField(); label6 = new java.awt.Label(); te xtField3 = new java.awt.TextField(); button1 = new java.awt.Button(); button2 = new java.awt.Button(); label7 = new java.awt.Label(); te xtField4 = new java.awt.TextField(); label8 = new java.awt.Label(); setBackground(new java.awt.Color(153, 204, 255)); setMinimumSize(new java.awt.Dimension(450, 380)); setResizable(false); setTitle("Add Stock"); addMouseListener(new java.awt.event.MouseAdapter() { public void mouseEntered(java.awt.event.MouseEvent evt) { formMouseEntered(evt); } }); addWindowListener(new java.awt.event.WindowAdapter() {

68

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


public void windowActivated(java.awt.e vent.WindowEvent evt) { formWindowActivated(evt); } public void windowClosing(java.awt.event.WindowEvent evt) { e xitForm(evt); } }); setLayout(null); label1.setFont(new java.awt.Font("Dialog", 1, 16)); label1.setText("Add Stock"); add(label1); label1.setBounds(170, 50, 90, 25); label2.setText("Category"); add(label2); label2.setBounds(100, 100, 53, 20); label3.setText("Sub-Category"); add(label3); label3.setBounds(100, 130, 79, 20); choice1.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent e vt) { choice1ItemStateChanged(evt); } }); add(choice1); choice1.setBounds(230, 100, 90, 20); choice2.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent e vt) { choice2ItemStateChanged(evt); } }); add(choice2); choice2.setBounds(230, 130, 90, 20); label4.setText("Quantity"); add(label4); label4.setBounds(100, 160, 60, 20); label5.setText("Unit Price"); add(label5); label5.setBounds(100, 190, 60, 20); te xtField1.addKeyListener(new java.awt.event.Ke yAdapter() { public void keyPressed(java.awt.event.Ke yEvent evt) { textField1KeyPressed(evt); } }); add(textField1); te xtField1.setBounds(230, 160, 160, 20); te xtField2.addKeyListener(new java.awt.event.Ke yAdapter() { public void keyPressed(java.awt.event.Ke yEvent evt) { textField2KeyPressed(evt); } }); add(textField2); te xtField2.setBounds(230, 190, 160, 20); label6.setText("Purchase Date"); add(label6); label6.setBounds(100, 220, 90, 20);

69

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


te xtField3.setBackground(new java.awt.Color(204, 204, 204)); te xtField3.setEditable(false); te xtField3.setEnabled(false); add(textField3); te xtField3.setBounds(230, 220, 160, 20); button1.setLabel("Ok"); button1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { button1ActionPerformed(evt); } }); add(button1); button1.setBounds(270, 280, 60, 24); button2.setLabel("Back"); button2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { button2ActionPerformed(evt); } }); add(button2); button2.setBounds(340, 280, 60, 24); label7.setText("Purchase ID"); add(label7); label7.setBounds(100, 250, 72, 20); te xtField4.addKeyListener(new java.awt.event.Ke yAdapter() { public void keyPressed(java.awt.event.Ke yEvent evt) { textField4KeyPressed(evt); } }); add(textField4); te xtField4.setBounds(230, 250, 160, 20); label8.setForeground(new java.awt.Color(204, 255, 204)); label8.setText("label8"); add(label8); label8.setBounds(10, 330, 470, 40); pack(); } pri vate void exitForm(java.awt.event.WindowEvent evt) { XYZEnt xyz = new XYZEnt(); xyz.setVisible(true); this.setVisible(false); } pri vate void formWindowActivated(java.awt.event.WindowEvent evt) { Connection con; Statement stmt; te xtField3.setText(TryDateFormats.displayDate()); label8.setText("Select Category !"); label8.setVisible(true); try { DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger"); stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select CategoryID from Category order by CategoryID"); while (rs.next()) { String s1 = rs.getString("CategoryID"); choice1.addItem(s1);

70

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


} rs.close(); } catch (SQLException e) { } } pri vate void choice1ItemStateChanged(java.awt.event.ItemEvent e vt) { Connection con; Statement stmt; label8.setText("Select Sub-Category !"); try { DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger"); stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select SUbCategoryID from Subcategory where CategoryID ='" + choice1.getSelectedItem() + "' order by SUbCategoryID"); while (rs.next()) { String s = rs.getString("SUbCategoryID"); choice2.addItem(s); } rs.close(); } catch (SQLException e) { } } pri vate void button1ActionPerformed(java.awt.event.ActionEvent e vt) { Connection con; Statement stmt; int v_qty = 0, records_updated; try { DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger"); stmt = con.createStatement(); String sql = "select qty from stock where categoryid='" + choice1.getSelectedItem() + "' and subcategoryid='" + choice2.getSelectedItem() + "'"; ResultSet rs = stmt.executeQuery(sql); if (rs.next()) { v_qty = rs.getInt(1); rs.close(); records_updated = stmt.executeUpdate("update stock set qty=" + (v_qty + Integer.parseInt(textField1.getText())) + " where categoryid='" + choice1.getSelectedItem() + "' and subcategoryid='" + ch oice2.getSelectedItem() + "'"); } else { sql = "insert into stock values('" + choice1.getSelectedItem() + "','" + choice2.getSelectedItem() + "','" + textField1.getText() + "','" + textField2.getText() + "','" + textField3.getText() + "','" + textField4.getText() + "')"; records_updated = stmt.executeUpdate(sql); con.commit(); } } catch (SQLException e) { } label8.setText("Stock added to Database Successfully '\n' Select category to add new stock"); te xtField1.setText(""); te xtField2.setText(""); te xtField4.setText(""); } pri vate void button2ActionPerformed(java.awt.event.ActionEvent e vt) { XYZEnt xyz = new XYZEnt(); this.setVisible(false); xyz.setVisible(true); } pri vate void choice2ItemStateChanged(java.awt.event.ItemEvent e vt) { label8.setText("Gi ve Quantity !"); }

71

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


pri vate void textField1KeyPressed(java.awt.event.Ke yEvent evt) { label8.setText("Gi ve price !"); } pri vate void textField2KeyPressed(java.awt.event.Ke yEvent evt) { label8.setText("Gi ve the Purchase Id !"); } pri vate void textField4KeyPressed(java.awt.event.Ke yEvent evt) { label8.setText("Press Ok to Add Stock !"); } pri vate void formMouseMoved(java.awt.event.MouseEvent evt) { } pri vate void formMouseEntered(java.awt.event.MouseEvent evt) { } public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new AddStock().setVisible(true); } }); } // Variables declaration pri vate java.awt.Button button1; pri vate java.awt.Button button2; pri vate java.awt.Choice choice1; pri vate java.awt.Choice choice2; pri vate java.awt.Label label1; pri vate java.awt.Label label2; pri vate java.awt.Label label3; pri vate java.awt.Label label4; pri vate java.awt.Label label5; pri vate java.awt.Label label6; pri vate java.awt.Label label7; pri vate java.awt.Label label8; pri vate java.awt.Te xtField textField1; pri vate java.awt.Te xtField textField2; pri vate java.awt.Te xtField textField3; pri vate java.awt.Te xtField textField4; // End of variables declaration }

72

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM

DeleteStock.java:

this form is used to delete stock of XYZEnterprise of


existing category or sub-category from stock database.

73

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


Before Delete: After Delete:

Category Deleted

//DeleteStock.java import java.awt.*; import java.sql.*; public class DeleteStock extends java.awt.Frame { public DeleteStock() { initComponents(); centre(); } public void centre() { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int x = (int) (screenSize.getWidth() / 2 - getWidth() / 2); int y = (int) (screenSize.getHeight() / 2 - getHeight() / 2); setLocation(x, y); } pri vate void initComponents() { label1 = new java.awt.Label(); label2 = new java.awt.Label(); label3 = new java.awt.Label(); te xtField2 = new java.awt.TextField(); choice1 = new java.awt.Choice(); label4 = new java.awt.Label(); button1 = new java.awt.Button(); button2 = new java.awt.Button(); choice2 = new java.awt.Choice(); label5 = new java.awt.Label(); setBackground(new java.awt.Color(153, 204, 255)); setMinimumSize(new java.awt.Dimension(350, 250)); setResizable(false); setTitle("Delete Stock"); addWindowListener(new java.awt.event.WindowAdapter() { public void windowActivated(java.awt.e vent.WindowEvent evt) { formWindowActivated(evt); } public void windowClosing(java.awt.event.WindowEvent evt) { e xitForm(evt); } }); addMouseMotionListener(new java.awt.event.MouseMotionAdapter() { public void mouseMoved(java.awt.event.MouseEvent evt) { formMouseMoved(evt); } }); setLayout(null);

74

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


label1.setFont(new java.awt.Font("Dialog", 1, 16)); label1.setText("Delete Stock"); add(label1); label1.setBounds(120, 40, 140, 20); label2.setText("Category "); add(label2); label2.setBounds(70, 90, 80, 20); label3.setText("Sub-Category"); add(label3); label3.setBounds(70, 120, 80, 20); te xtField2.setBackground(new java.awt.Color(255, 255, 255)); te xtField2.setName(""); te xtField2.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { textField2MouseClicked(evt); } }); te xtField2.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() { public void mouseMoved(java.awt.event.MouseEvent evt) { textField2MouseMoved(evt); } }); add(textField2); te xtField2.setBounds(160, 150, 130, 20); choice1.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent e vt) { choice1ItemStateChanged(evt); } }); add(choice1); choice1.setBounds(160, 90, 130, 20); label4.setText("Quantity"); add(label4); label4.setBounds(70, 150, 70, 20); button1.setLabel("Ok"); button1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { button1ActionPerformed(evt); } }); add(button1); button1.setBounds(160, 180, 60, 24); button2.setLabel("Back"); button2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { button2ActionPerformed(evt); } }); add(button2); button2.setBounds(230, 180, 43, 24); choice2.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent e vt) { choice2ItemStateChanged(evt); } });

75

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


add(choice2); choice2.setBounds(160, 120, 130, 20); label5.setForeground(new java.awt.Color(204, 255, 204)); label5.setText("Stock Deleted !"); add(label5); label5.setBounds(40, 210, 280, 20); pack(); } pri vate void exitForm(java.awt.event.WindowEvent evt) { XYZEnt xyz = new XYZEnt(); this.setVisible(false); xyz.setVisible(true); } pri vate void button2ActionPerformed(java.awt.event.ActionEvent e vt) { XYZEnt xyz = new XYZEnt(); this.setVisible(false); xyz.setVisible(true); } pri vate void formWindowActivated(java.awt.event.WindowEvent evt) { Connection con; Statement stmt; choice1.removeAll(); try { DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger"); stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select CategoryID from Category order by CategoryID"); while (rs.next()) { String s1 = rs.getString("CategoryID"); choice1.addItem(s1); } rs.close(); } catch (SQLException e) { } } pri vate void choice1ItemStateChanged(java.awt.event.ItemEvent e vt) { Connection con; Statement stmt; choice2.removeAll(); try { DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger"); stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select subCategoryID from stock where CategoryID ='" + choice1.getSelectedItem() + "'"); while (rs.next()) { String s = rs.getString("subCategoryID"); choice2.addItem(s); rs.close(); con.commit(); } } catch (SQLException e) { } } private void choice2ItemStateChanged(java.awt.event.ItemEvent evt) { Connection con; Statement stmt; try { DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger"); stmt = con.createStatement();

76

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


ResultSet rs = stmt.executeQuery("select qty from stock where subCategoryID ='" + choice2.getSelectedItem() + "' order by subcategoryid"); while (rs.next()) { String s = rs.getString("qty"); te xtField2.setText(s + " left"); } rs.close(); } catch (SQLException e) { } } pri vate void button1ActionPerformed(java.awt.event.ActionEvent e vt) { choice2.removeAll(); te xtField2.setText(""); try { DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger"); Statement stmt = con.createStatement(); String sql1 = ("delete from stock where CategoryID ='" + choice1.getSelectedItem() + "' and subcategoryid='" + choice2.getSelectedItem() + "'"); int records_updated = stmt.executeUpdate(sql1); label5.setVisible(true); } catch (SQLException e) { } } public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new DeleteStock().setVisible(true); } }); } // Variables declaration pri vate java.awt.Button button1; pri vate java.awt.Button button2; pri vate java.awt.Choice choice1; pri vate java.awt.Choice choice2; pri vate java.awt.Label label1; pri vate java.awt.Label label2; pri vate java.awt.Label label3; pri vate java.awt.Label label4; pri vate java.awt.Label label5; pri vate java.awt.Te xtField textField2; // End of variables declaration }

77

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM

UserMaintenence.java:

This will help to add a new user to be an authorized user. Data will be added to the UserLogin database.

78

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM

//AddNewUser.java import java.sql.*; import java.awt.*; public class AddNewUser extends java.awt.Frame { public AddNewUser() { initComponents(); centre(); } public void centre() { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int x = (int) (screenSize.getWidth() / 2 - getWidth() / 2); int y = (int) (screenSize.getHeight() / 2 - getHeight() / 2); setLocation(x, y); } pri vate void initComponents() { label1 = new java.awt.Label(); te xtField1 = new java.awt.TextField(); te xtField2 = new java.awt.TextField(); label2 = new java.awt.Label(); label3 = new java.awt.Label(); button1 = new java.awt.Button(); button2 = new java.awt.Button(); setAlwaysOnTop(true); setBackground(new java.awt.Color(153, 204, 255)); setBounds(new java.awt.Rectangle(300, 300, 300, 300)); setIconImages(null); setMinimumSize(new java.awt.Dimension(400, 200)); setResizable(false); setTitle("Adding New User"); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { e xitForm(evt); } }); setLayout(null); label1.setFont(new java.awt.Font("Dialog", 1, 16)); // NOI18N label1.setForeground(new java.awt.Color(0, 0, 0)); label1.setText("Add New User"); add(label1); label1.setBounds(150, 40, 110, 25); add(textField1); te xtField1.setBounds(110, 90, 200, 20); add(textField2); te xtField2.setBounds(110, 120, 200, 20); label2.setFont(new java.awt.Font("Dialog", 1, 12)); // NOI18N label2.setText("User ID"); add(label2); label2.setBounds(30, 90, 60, 20); label3.setFont(new java.awt.Font("Dialog", 1, 12)); // NOI18N label3.setText("Password");

79

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


add(label3); label3.setBounds(30, 120, 60, 20); button1.setLabel("Save"); add(button1); button1.setBounds(200, 150, 50, 24); button2.setLabel("Exit"); button1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { button1ActionPerformed(evt); } }); button2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { button2ActionPerformed(evt); } }); add(button2); button2.setBounds(260, 150, 50, 24); pack(); } pri vate void exitForm(java.awt.event.WindowEvent evt) { UserLogin ul = new UserLogin(); this.setVisible(false); ul.setVisible(true); } pri vate void button2ActionPerformed(java.awt.event.ActionEvent e vt) { XYZEnt ul = new XYZEnt(); this.setVisible(false); ul.setVisible(true); } pri vate void button1ActionPerformed(java.awt.event.ActionEvent e vt) { try { DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger"); Statement stmt = con.createStatement(); System.out.println("Database is online now"); String sql = "insert into userlogin values('" +textField1.getText() + "','" + textField2.getText() + "')"; System.out.println(sql); int records_updated = stmt.executeUpdate(sql); con.commit(); } catch (SQLException e) { } te xtField1.setText(""); te xtField2.setText(""); } public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new AddNewUser().setVisible(true); } }); } // Variables declaration pri vate java.awt.Button button1; pri vate java.awt.Button button2; pri vate java.awt.Label label1; pri vate java.awt.Label label2; pri vate java.awt.Label label3; pri vate java.awt.Te xtField textField1; pri vate java.awt.Te xtField textField2; }

80

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM

Sales.java:

This form appears in Transaction menu of XYZEnterprise main page which keeps track of the data sold & stores in sales database.

81

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM

//Sales.java import java.sql.*; import java.awt.*; public class Sales extends java.awt.Frame { static int qoh1, qoh2, qoh3; public Sales() { initComponents(); centre(); } public void centre() { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int x = (int) (screenSize.getWidth() / 2 - getWidth() / 2); int y = (int) (screenSize.getHeight() / 2 - getHeight() / 2); setLocation(x, y); } pri vate void initComponents() { label1 = new java.awt.Label(); label2 = new java.awt.Label(); label3 = new java.awt.Label(); button1 = new java.awt.Button(); button2 = new java.awt.Button(); button3 = new java.awt.Button(); te xtField1 = new java.awt.TextField(); te xtField2 = new java.awt.TextField(); label4 = new java.awt.Label(); label5 = new java.awt.Label(); choice1 = new java.awt.Choice(); choice2 = new java.awt.Choice(); checkbox1 = new java.awt.Checkbox(); choice3 = new java.awt.Choice(); label6 = new java.awt.Label(); label7 = new java.awt.Label(); choice4 = new java.awt.Choice(); te xtField3 = new java.awt.TextField(); label8 = new java.awt.Label(); label9 = new java.awt.Label(); label10 = new java.awt.Label(); te xtField4 = new java.awt.TextField(); te xtField5 = new java.awt.TextField(); checkbox2 = new java.awt.Checkbox(); choice5 = new java.awt.Choice(); choice6 = new java.awt.Choice();

82

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


te xtField6 = new java.awt.TextField(); te xtField7 = new java.awt.TextField(); te xtField8 = new java.awt.TextField(); checkbox3 = new java.awt.Checkbox(); choice7 = new java.awt.Choice(); choice8 = new java.awt.Choice(); te xtField9 = new java.awt.TextField(); te xtField10 = new java.awt.TextField(); te xtField11 = new java.awt.TextField(); label11 = new java.awt.Label(); choice11 = new java.awt.Choice(); label12 = new java.awt.Label(); label13 = new java.awt.Label(); setBackground(new java.awt.Color(153, 204, 255)); setMinimumSize(new java.awt.Dimension(550, 440)); setResizable(false); setTitle("Sales Entry"); addWindowListener(new java.awt.event.WindowAdapter() { public void windowActivated(java.awt.e vent.WindowEvent evt) { formWindowActivated(evt); } public void windowClosing(java.awt.event.WindowEvent evt) { e xitForm(evt); } }); setLayout(null); label1.setText("Sale Date"); add(label1); label1.setBounds(40, 80, 60, 20); label2.setText("Bill No."); add(label2); label2.setBounds(40, 130, 43, 20); label3.setFont(new java.awt.Font("Dialog", 0, 14)); label3.setText("Retailer Information"); add(label3); label3.setBounds(250, 90, 140, 23); button1.setEnabled(false); button1.setLabel("Ok"); button1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { button1ActionPerformed(evt); } }); add(button1); button1.setBounds(310, 350, 50, 24); button2.setLabel("Refresh"); button2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { button2ActionPerformed(evt); } }); add(button2); button2.setBounds(370, 350, 60, 24); button3.setLabel("Back"); button3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) {

83

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


button3ActionPerformed(evt); } }); add(button3); button3.setBounds(440, 350, 43, 24); te xtField1.setEditable(false); add(textField1); te xtField1.setBounds(40, 100, 110, 20); add(textField2); te xtField2.setBounds(40, 150, 110, 20); label4.setText(" Name"); add(label4); label4.setBounds(180, 150, 41, 20); label5.setText("Address"); add(label5); label5.setBounds(180, 180, 50, 20); add(choice1); choice1.setBounds(250, 150, 190, 20); add(choice2); choice2.setBounds(250, 180, 190, 20); checkbox1.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent e vt) { checkbox1ItemStateChanged(evt); } }); checkbox1.addInputMethodListener(new java.awt.event.InputMethodListener() { public void caretPositionChanged(java.awt.event.InputMethodEvent e vt) { } public void inputMethodTextChanged(java.awt.event.InputMeth odEvent e vt) { checkbox1InputMethodTe xtChanged(evt); } }); checkbox1.addPropertyChangeListener(new java.beans.PropertyChangeListener() { public void propertyChange(java.beans.PropertyChangeEvent evt) { checkbox1PropertyChange(evt); } }); add(checkbox1); checkbox1.setBounds(30, 240, 30, 20); choice3.setEnabled(false); choice3.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent e vt) { choice3ItemStateChanged(evt); } }); choice3.addInputMethodListener(new java.awt.event.InputMethodListener() { public void caretPositionChanged(java.awt.event.InputMethodEvent e vt) { choice3CaretPositionChanged(evt); } public void inputMethodTextChanged(java.awt.event.InputMethodEvent e vt) { } }); add(choice3); choice3.setBounds(80, 240, 70, 20); label6.setText("Catg."); add(label6); label6.setBounds(100, 220, 33, 20);

84

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


label7.setName(""); // NOI18N label7.setText("Sub-Catg."); add(label7); label7.setBounds(180, 220, 60, 20); choice4.setEnabled(false); choice4.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent e vt) { choice4ItemStateChanged(evt); } }); add(choice4); choice4.setBounds(160, 240, 80, 20); te xtField3.setEnabled(false); te xtField3.addKeyListener(new java.awt.event.Ke yAdapter() { public void keyPressed(java.awt.event.Ke yEvent evt) { textField3KeyPressed(evt); } }); add(textField3); te xtField3.setBounds(260, 240, 70, 20); label8.setText("Qty."); add(label8); label8.setBounds(280, 220, 38, 20); label9.setText("U/Price"); add(label9); label9.setBounds(360, 220, 44, 20); label10.setText("Total Amt."); add(label10); label10.setBounds(440, 220, 58, 20); te xtField4.setEnabled(false); te xtField4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { textField4ActionPerformed(evt); } }); add(textField4); te xtField4.setBounds(350, 240, 60, 20); te xtField5.setEditable(false); te xtField5.setEnabled(false); te xtField5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { textField5ActionPerformed(evt); } }); add(textField5); te xtField5.setBounds(430, 240, 70, 20); checkbox2.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent e vt) { checkbox2ItemStateChanged(evt); } }); add(checkbox2); checkbox2.setBounds(30, 270, 30, 20);

85

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


choice5.setEnabled(false); choice5.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent e vt) { choice5ItemStateChanged(evt); } }); add(choice5); choice5.setBounds(80, 270, 70, 20); choice6.setEnabled(false); choice6.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent e vt) { choice6ItemStateChanged(evt); } }); add(choice6); choice6.setBounds(160, 270, 80, 20); te xtField6.setEnabled(false); te xtField6.addKeyListener(new java.awt.event.Ke yAdapter() { public void keyPressed(java.awt.event.Ke yEvent evt) { textField6KeyPressed(evt); } }); add(textField6); te xtField6.setBounds(260, 270, 70, 20); te xtField7.setEnabled(false); te xtField7.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { textField7ActionPerformed(evt); } }); add(textField7); te xtField7.setBounds(350, 270, 60, 20); te xtField8.setEditable(false); te xtField8.setEnabled(false); add(textField8); te xtField8.setBounds(430, 270, 70, 20); checkbox3.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent e vt) { checkbox3ItemStateChanged(evt); } }); add(checkbox3); checkbox3.setBounds(30, 300, 30, 20); choice7.setEnabled(false); choice7.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent e vt) { choice7ItemStateChanged(evt); } }); add(choice7); choice7.setBounds(80, 300, 70, 20); choice8.setEnabled(false); choice8.addItemListener(new java.awt.event.ItemListener() {

86

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


public void itemStateChanged(java.awt.event.ItemEvent e vt) { choice8ItemStateChanged(evt); } }); add(choice8); choice8.setBounds(160, 300, 80, 20); te xtField9.setEnabled(false); te xtField9.addKeyListener(new java.awt.event.Ke yAdapter() { public void keyPressed(java.awt.event.Ke yEvent evt) { textField9KeyPressed(evt); } }); add(textField9); te xtField9.setBounds(260, 300, 70, 20); te xtField10.setEnabled(false); te xtField10.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { textField10ActionPerformed(evt); } }); add(textField10); te xtField10.setBounds(350, 300, 60, 20); te xtField11.setEditable(false); te xtField11.setEnabled(false); add(textField11); te xtField11.setBounds(430, 300, 70, 20); label11.setText("ID"); add(label11); label11.setBounds(180, 120, 45, 20); add(choice11); choice11.setBounds(250, 120, 60, 20); label12.setFont(new java.awt.Font("Dialog", 1, 18)); label12.setText("Sales"); add(label12); label12.setBounds(240, 40, 60, 28); add(label13); label13.setBounds(50, 350, 240, 20); pack(); } pri vate void exitForm(java.awt.event.WindowEvent evt) { XYZEnt xyz = new XYZEnt(); xyz.setVisible(true); this.setVisible(false); } pri vate void checkbox1ItemStateChanged(java.awt.event.ItemEvent e vt) { boolean b = checkbox1.getState(); if (b) { choice3.setEnabled(b); Connection con; Statement stmt; try { Dri verManager.registerDriver(new oracle.jdbc.OracleDriver()); con = Dri verManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger"); stmt = con.createStatement();

87

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


ResultSet rs = stmt.executeQuery("select CategoryID from Category order by CategoryID"); while (rs.next()) { String s1 = rs.getString("CategoryID"); choice3.addItem(s1); } } catch (SQLException e) { } } else { choice3.setEnabled(false); choice4.setEnabled(false); te xtField3.setEnabled(false); te xtField4.setEnabled(false); te xtField5.setEnabled(false); button1.setEnabled(false); } } pri vate void textField4ActionPerformed(java.awt.event.ActionEvent e vt) { te xtField5.setEnabled(true); button1.setEnabled(true); te xtField5.setText(String.valueOf(Integer.parseInt(textField3.getText()) * Integer.parseInt(textField4.getText()))); } pri vate void textField5ActionPerformed(java.awt.event.ActionEvent e vt) { } pri vate void checkbox1PropertyChange(java.beans.PropertyChangeEvent evt) { } pri vate void button3ActionPerformed(java.awt.event.ActionEvent e vt) { XYZEnt xyz = new XYZEnt(); this.setVisible(false); xyz.setVisible(true); } pri vate void formWindowActivated(java.awt.event.WindowEvent evt) { te xtField1.setText(TryDateFormats.displayDate()); Connection con; Statement stmt; choice1.removeAll(); try { DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger"); stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select retailername from retailermaster order by retailername"); while (rs.next()) { String s = rs.getString("retailername"); choice1.addItem(s); } rs.close(); rs = stmt.executeQuery("select retaileraddress from retailermaster order by retaileraddress"); while (rs.next()) { String s1 = rs.getString("retaileraddress"); choice2.addItem(s1); } rs.close(); rs = stmt.executeQuery("select retailerid from retailermaster order by retailerid"); while (rs.next()) { String s2 = rs.getString("retailerid"); choice11.addItem(s2); } } catch (SQLException e) { } } pri vate void checkbox1InputMethodTextChanged(java.awt.event.InputMethodEvent e vt) { } pri vate void choice3CaretPositionChanged(java.awt.event.InputMethodEvent e vt) { } pri vate void choice3ItemStateChanged(java.awt.event.ItemEvent e vt) { choice4.setEnabled(true);

88

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


choice4.removeAll(); Connection con; Statement stmt; try { DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger"); stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select SUbCategoryID from stock where CategoryID ='" + choice3.getSelectedItem() + "'"); while (rs.next()) { String s = rs.getString("SUbCategoryID"); choice4.addItem(s); } rs.close(); } catch (SQLException e) { } } pri vate void choice4ItemStateChanged(java.awt.event.ItemEvent e vt) { te xtField3.setEnabled(true); try { DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger"); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select qty from stock where categoryid='" + choice3.getSelectedItem() + "' and subcategoryid='" + choice4.getSelectedItem() + "'"); rs.next(); qoh1 = rs.getInt(1); label13.setText("You have " + qoh1 + " units left"); rs.close(); con.commit(); } catch (SQLException e) { } } pri vate void checkbox2ItemStateChanged(java.awt.event.ItemEvent e vt) { boolean b = checkbox2.getState(); if (b) { choice5.setEnabled(true); Connection con; Statement stmt; try { Dri verManager.registerDriver(new oracle.jdbc.OracleDriver()); con = Dri verManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger"); stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select CategoryID from Category order by CategoryID"); while (rs.next()) { String s1 = rs.getString("CategoryID"); choice5.addItem(s1); } } catch (SQLException e) { } } else { choice5.setEnabled(false); choice6.setEnabled(false); te xtField6.setEnabled(false); te xtField7.setEnabled(false); te xtField8.setEnabled(false); button1.setEnabled(false); } } pri vate void choice5ItemStateChanged(java.awt.event.ItemEvent e vt) { choice6.setEnabled(true); Connection con; Statement stmt;

89

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


try { DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger"); stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select SUbCategoryID from Subcategory where CategoryID ='" + choice3.getSelectedItem() + "' order by SUbCategoryID"); while (rs.next()) { String s = rs.getString("SUbCategoryID"); choice6.addItem(s); } rs.close(); } catch (SQLException e) { } } pri vate void checkbox3ItemStateChanged(java.awt.event.ItemEvent e vt) { boolean b = checkbox3.getState(); if (b) { choice7.setEnabled(true); Connection con; Statement stmt; try { Dri verManager.registerDriver(new oracle.jdbc.OracleDriver()); con = Dri verManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger"); stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select CategoryID from Category order by CategoryID"); while (rs.next()) { String s1 = rs.getString("CategoryID"); choice7.addItem(s1); } } catch (SQLException e) { } } else { choice7.setEnabled(false); choice8.setEnabled(false); te xtField9.setEnabled(false); te xtField10.setEnabled(false); te xtField11.setEnabled(false); button1.setEnabled(false); } } pri vate void choice7ItemStateChanged(java.awt.event.ItemEvent e vt) { choice8.setEnabled(true); Connection con; Statement stmt; try { DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger") ; stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select SUbCategoryID from Subcategory where CategoryID ='" + choice3.getSelectedItem() + "' order by SUbCategoryID"); while (rs.next()) { String s = rs.getString("SUbCategoryID"); choice8.addItem(s); } rs.close(); } catch (SQLException e) { } } pri vate void choice6ItemStateChanged(java.awt.event.ItemEvent e vt) { te xtField6.setEnabled(true); }

90

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


pri vate void textField7ActionPerformed(java.awt.event.ActionEvent e vt) { te xtField8.setEnabled(true); button1.setEnabled(true); te xtField8.setText(String.valueOf(Integer.parseInt(textField6.getText()) * Integer.parseInt(textField7.getText()))); } pri vate void choice8ItemStateChanged(java.awt.event.ItemEvent e vt) { te xtField9.setEnabled(true); } pri vate void textField10ActionPerformed(java.awt.event.ActionEvent evt) { te xtField11.setEnabled(true); button1.setEnabled(true); te xtField11.setText(String.valueOf(Integer.parseInt(textField9.getText()) * Integer.parseInt(textField10.getText()))); } pri vate void textField9KeyPressed(java.awt.event.Ke yEvent evt) { te xtField10.setEnabled(true); } private void te xtField6KeyPressed(java.awt.event.KeyEvent e vt) { te xtField7.setEnabled(true); } pri vate void textField3KeyPressed(java.awt.event.Ke yEvent evt) { te xtField4.setEnabled(true); } pri vate void button2ActionPerformed(java.awt.event.ActionEvent e vt) { checkbox1.setState(false); checkbox2.setState(false); checkbox3.setState(false); choice3.setEnabled(false); choice4.setEnabled(false); choice5.setEnabled(false); choice6.setEnabled(false); choice7.setEnabled(false); choice8.setEnabled(false); te xtField3.setEnabled(false); te xtField4.setEnabled(false); te xtField5.setEnabled(false); te xtField6.setEnabled(false); te xtField7.setEnabled(false); te xtField8.setEnabled(false); te xtField3.setText(null); te xtField4.setText(null); te xtField5.setText(null); te xtField6.setText(null); te xtField7.setText(null); te xtField8.setText(null); te xtField9.setText(null); te xtField10.setText(null); te xtField11.setText(null); button1.setEnabled(false); } pri vate void button1ActionPerformed(java.awt.event.ActionEvent e vt) { boolean b2 = checkbox2.getState(); boolean b3 = checkbox3.getState(); if (checkbox1.getState() == true) { try { Dri verManager.registerDriver(new oracle.jdbc.OracleDriver()); Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger"); Statement stmt = con.createStatement(); String sql = "insert into sales(billno,bill_date,retailerID,categoryid,subcategoryid,qty_sold,unit_price) values('" + textField2.getText() + "','" + textField1.getText() + "','" + choice11.getSelectedIte m() + "','" + choice3.getSelectedItem() + "','" + choice4.getSelectedItem() + "','" + te xtField3.getText() + "','" + te xtField4.getText() + "')";

91

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


int records_updated = stmt.executeUpdate(sql); records_updated = stmt.executeUpdate("update stock set qty=" + (qoh1 - Integer.parseInt(textField3.getText())) + " where categoryid='" + choice3.getSelectedItem() + "' and subcategoryid='" + choice4.getSelectedItem() + "'"); con.commit(); } catch (SQLException e) { System.out.print(e); } } if (b2) { try { Dri verManager.registerDriver(new oracle.jdbc.OracleDriver()); Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger"); Statement stmt = con.createStatement(); String sql = "insert into sales" + "(billno,bill_date,retailerID,categoryid,subcategoryid,qty_sold,unit_price)" + "values('" + textField2.getText() + "','" + textField1.getText() + "','" + choice11.getSelectedItem() + "','" + choice5.getSelectedItem() + "','" + choice6.getSelectedItem() + "','" + te xtField6.getText() + "','" + te xtField7.getText() + "')"; int records_updated = stmt.executeUpdate(sql); con.commit(); } catch (SQLException e) { System.out.print(e); } } if (b3) { try { Dri verManager.registerDriver(new oracle.jdbc.OracleDriver()); Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger"); Statement stmt = con.createStatement(); String sql = "insert into sales(billno,bill_date,retailerID,categoryid,subcategoryid,qty_sold,unit_price) values('" + textField2.getText() + "','" + textField1.getText() + "','" + choice11.getSelectedItem() + "','" + choice7.getSelectedItem() + "','" + choice8.getSelectedItem() + "','" + te xtField9.getText() + "','" + te xtField10.getText() + "')"; int records_updated = stmt.executeUpdate(sql); con.commit(); } catch (SQLException e) { } } } public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Sales().setVisible(true); } }); } // Variables declaration pri vate java.awt.Button button1; pri vate java.awt.Button button2; pri vate java.awt.Button button3; pri vate java.awt.Checkbox checkbox1; pri vate java.awt.Checkbox checkbox2; pri vate java.awt.Checkbox checkbox3; pri vate java.awt.Choice choice1; pri vate java.awt.Choice choice11; pri vate java.awt.Choice choice2; pri vate java.awt.Choice choice3; pri vate java.awt.Choice choice4; pri vate java.awt.Choice choice5; pri vate java.awt.Choice choice6; pri vate java.awt.Choice choice7;

92

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


pri vate java.awt.Choice choice8; pri vate java.awt.Label label1; pri vate java.awt.Label label10; pri vate java.awt.Label label11; pri vate java.awt.Label label12; pri vate java.awt.Label label13; pri vate java.awt.Label label2; pri vate java.awt.Label label3; pri vate java.awt.Label label4; pri vate java.awt.Label label5; pri vate java.awt.Label label6; pri vate java.awt.Label label7; pri vate java.awt.Label label8; pri vate java.awt.Label label9; pri vate java.awt.Te xtField textField1; pri vate java.awt.Te xtField textField10; pri vate java.awt.Te xtField textField11; pri vate java.awt.Te xtField textField2; pri vate java.awt.Te xtField textField3; pri vate java.awt.Te xtField textField4; pri vate java.awt.Te xtField textField5; pri vate java.awt.Te xtField textField6; pri vate java.awt.Te xtField textField7; pri vate java.awt.Te xtField textField8; pri vate java.awt.Te xtField textField9; // End of variables declaration }

93

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM

DamagedReturn.java:

This form is in Transaction menu of XYZEnterprise main page which keeps information about returned product.

94

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM

//DamagedReturn.java import java.sql.*; import java.awt.*; public class DamagedReturn extends java.awt.Frame { public DamagedReturn() { initComponents(); centre(); } public void centre() { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int x = (int) (screenSize.getWidth() / 2 - getWidth() / 2); int y = (int) (screenSize.getHeight() / 2 - getHeight() / 2); setLocation(x, y); } private void initComponents() { label1 = new java.awt.Label(); label2 = new java.awt.Label(); label3 = new java.awt.Label(); label4 = new java.awt.Label(); label5 = new java.awt.Label(); te xtArea1 = new java.awt.Te xtArea(); button1 = new java.awt.Button(); button2 = new java.awt.Button(); button3 = new java.awt.Button(); te xtField4 = new java.awt.TextField(); te xtField5 = new java.awt.TextField(); label6 = new java.awt.Label(); choice1 = new java.awt.Choice(); label7 = new java.awt.Label(); choice2 = new java.awt.Choice(); choice3 = new java.awt.Choice(); setAlwaysOnTop(true); setBackground(new java.awt.Color(153, 204, 255)); setMinimumSize(new java.awt.Dimension(600, 400)); setResizable(false); setTitle("Damaged Stock Return"); addWindowListener(new java.awt.event.WindowAdapter() { public void windowActivated(java.awt.e vent.WindowEvent evt) { formWindowActivated(evt); } public void windowClosing(java.awt.event.WindowEvent evt) { e xitForm(evt); } }); setLayout(null); label1.setText("Bill No.");

95

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


add(label1); label1.setBounds(60, 90, 43, 20); label2.setText("Return Date"); add(label2); label2.setBounds(270, 140, 70, 20); label3.setText("Category ID"); add(label3); label3.setBounds(270, 180, 68, 20); label4.setText("Sub-Category"); add(label4); label4.setBounds(270, 220, 79, 20); label5.setText("Qty. Returned"); add(label5); label5.setBounds(270, 260, 80, 20); add(textArea1); te xtArea1.setBounds(10, 140, 250, 210); button1.setLabel("Search"); button1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { button1ActionPerformed(evt); } }); add(button1); button1.setBounds(240, 90, 55, 24); button2.setEnabled(false); button2.setLabel("Ok"); button2.addActionLis tener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { button2ActionPerformed(evt); } }); add(button2); button2.setBounds(430, 300, 50, 24); button3.setLabel("Back"); button3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { button3ActionPerformed(evt); } }); add(button3); button3.setBounds(490, 300, 43, 24); te xtField4.setEnabled(false); te xtField4.addKeyListener(new java.awt.event.Ke yAdapter() { public void keyPressed(java.awt.event.Ke yEvent evt) { textField4KeyPressed(evt); } }); add(textField4); te xtField4.setBounds(380, 260, 170, 20); te xtField5.setEditable(false); te xtField5.setEnabled(false); add(textField5); te xtField5.setBounds(380, 140, 170, 20); label6.setText("Bill Details"); add(label6);

96

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


label6.setBounds(100, 120, 70, 20); add(choice1); choice1.setBounds(110, 90, 110, 20); label7.setFont(new java.awt.Font("Dialog", 1, 16)); label7.setText("Damaged Stock Return"); add(label7); label7.setBounds(220, 30, 181, 30); choice2.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent e vt) { choice2ItemStateChanged(evt); } }); add(choice2); choice2.setBounds(380, 180, 90, 20); add(choice3); choice3.setBounds(380, 220, 90, 20); pack(); } pri vate void exitForm(java.awt.event.WindowEvent evt) { XYZEnt xyz = new XYZEnt(); xyz.setVisible(true); this.setVisible(false); } pri vate void formWindowActivated(java.awt.event.WindowEvent evt) { Connection con; Statement stmt; te xtField5.setText(TryDateFormats.displayDate()); try { DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger"); stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select distinct billno from sales order by billno"); while (rs.next()) { String s = rs.getString("billno"); choice1.addItem(s); } rs = stmt.executeQuery("select CategoryID from Category order by CategoryID"); while (rs.next()) { String s1 = rs.getString("CategoryID"); choice2.addItem(s1); } } catch (SQLException e) { } } pri vate void button1ActionPerformed(java.awt.event.ActionEvent e vt) { try { DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger"); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select * from sales where billno ='" + choice1.getSelectedItem() + "'"); rs.next(); te xtArea1.setText(""); te xtArea1.append("Bill no: " + rs.getString("billno") + "\n" + "Bill Date: " + rs.getString("bill_date")); button2.setEnabled(true); } catch (SQLException e) { } } private void choice2ItemStateChanged(java.awt.event.ItemEvent e vt) { Connection con; Statement stmt; try {

97

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:o rcl", "scott", "tiger"); stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select SUbCategoryID from Subcategory where CategoryID ='" + choice2.getSelectedItem() + "' order by SUbCategoryID"); while (rs.next()) { String s = rs.getString("SUbCategoryID"); choice3.addItem(s); } rs.close(); } catch (SQLException e) { } } pri vate void button3ActionPerformed(java.awt.event.ActionEvent e vt) { XYZEnt xyze = new XYZEnt(); this.setVisible(false); xyze.setVisible(true); } pri vate void button2ActionPerformed(java.awt.event.ActionEvent e vt) { try { DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger"); Statement stmt = con.createStatement(); String sql = "insert into DamagedReturn(return_date,Against_Bill_no,categoryid,subcategory,qty_returned)values('" +textFiel d5.getText() + "','" + choice1.getSelectedItem() + "','" + choice2.getSelectedItem() + "','" + choice3.getSelectedItem() + "','" + textField4.getText() + "')"; System.out.println(sql); int records_updated = stmt.executeUpdate(sql); con.commit(); } catch (SQLException e) { } } pri vate void textField4KeyPressed(java.awt.event.Ke yEvent evt) { button1.setEnabled(true); } public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new DamagedReturn().setVisible(true); } }); } // Variables declaration pri vate java.awt.Button button1; pri vate java.awt.Button button2; pri vate java.awt.Button button3; pri vate java.awt.Choice choice1; pri vate java.awt.Choice choice2; pri vate java.awt.Choice choice3; pri vate java.awt.Label label1; pri vate java.awt.Label label2; pri vate java.awt.Label label3; pri vate java.awt.Label label4; pri vate java.awt.Label label5; pri vate java.awt.Label label6; pri vate java.awt.Label label7; pri vate java.awt.Te xtArea te xtArea1; pri vate java.awt.Te xtField textField4; pri vate java.awt.Te xtField textField5; // End of variables declaration }

98

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM

HelpContents.java:

This part of Sales helps user to know about the software in details. This is represents the over all steps which are to be done through this software. This is used to show about the project,project coordinator and development team name.

StartPage.java:

About.java:

99

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM

//HelpContent.java import java.awt.*; public class HelpContents extends java.awt.Frame { public HelpContents() { initComponents(); centre(); } public void centre() { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int x = (int) (screenSize.getWidth() / 2 - getWidth() / 2); int y = (int) (screenSize.getHeight() / 2 - getHeight() / 2); setLocation(x, y); } pri vate void initComponents() { te xtArea1 = new java.awt.Te xtArea(); label1 = new java.awt.Label(); setAlwaysOnTop(true); setBackground(new java.awt.Color(153, 204, 255)); setBounds(new java.awt.Rectangle(0, 0, 0, 0)); setMinimumSize(new java.awt.Dimension(470, 320)); setResizable(false); setTitle("Help Contents"); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { e xitForm(evt); } }); setLayout(null); te xtArea1.setBackground(new java.awt.Color(204, 255, 255)); te xtArea1.setEditable(false); te xtArea1.setFont(new java.awt.Font("Dialog", 0, 13)); // NOI18N te xtArea1.setText(" This \"Stock Management & Inventory Control System \" is prepared with\n some basic options that is needed in any transaction. It checks for proper \n user ID to Login into th system.It can also add a new user after successful \n login.It can also add Creditor,Distributor,Retailer details to the database,\n It can also keep track on the transactions i.e. sales & returns of damage\n stocks.\n\t\tThe system keeps track of the items purchased as \n well as sold by a trading company. This includes various master mainten-\n ance modules, including inventory management and transaction entry.\n Various reports are also generated to aid the management in its decision \n making process. "); add(textArea1); te xtArea1.setBounds(10, 80, 440, 200); label1.setFont(new java.awt.Font("Dialog", 1, 16)); label1.setText("Help Contents"); add(label1);

100

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


label1.setBounds(160, 50, 110, 20); pack(); } pri vate void exitForm(java.awt.event.WindowEvent evt) { XYZEnt xyz = new XYZEnt(); xyz.setVisible(true); this.setVisible(false); } public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new HelpContents().setVisible(true); } }); } // Variables declaration pri vate java.awt.Label label1; pri vate java.awt.Te xtArea te xtArea1; // End of variables declaration }

Start Page

//StartPage.java import java.awt.*; public class HelpStartPage extends java.awt.Frame { public HelpStartPage() { initComponents(); centre(); } public void centre() { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int x = (int) (screenSize.getWidth() / 2 - getWidth() / 2); int y = (int) (screenSize.getHeight() / 2 - getHeight() / 2); setLocation(x, y);

101

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


} pri vate void initComponents() { te xtArea1 = new java.awt.Te xtArea(); setBackground(new java.awt.Color(153, 204, 255)); setMinimumSize(new java.awt.Dimension(525, 600)); setResizable(false); setTitle("Start Page"); addWindowListener(new java.awt.event.WindowAdapter() { public void windowActivated(java.awt.e vent.WindowEvent evt) { formWindowActivated(evt); } public void windowClosing(java.awt.event.WindowEvent evt) { e xitForm(evt); } }); setLayout(null); te xtArea1.setBackground(new java.awt.Color(204, 255, 255)); te xtArea1.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N add(textArea1); te xtArea1.setBounds(30, 40, 472, 550); pack(); } pri vate void exitForm(java.awt.event.WindowEvent evt) { XYZEnt xyz = new XYZEnt(); xyz.setVisible(true); this.setVisible(false); } pri vate void formWindowActivated(java.awt.event.WindowEvent evt) { te xtArea1.setEditable(false); te xtArea1.setText("This \"Sales Monitoring and Inventory Controlling System \" would require a\nUSER ID & PASSWORD " + "to connect to the " + "\n\"Sales Monitoring and Inventory Controlling System\" Main Menu." + "\n________________________________________________________________ \nAfter the successfull insertion of " + "USER ID & PASSWORD\nit will be in the \"Sales Monitoring and Inventory Controlling System \" Main Menu." + "\n________________________________________________________________ \nOn the \"Sales Monitoring and Inventory Controlling System \" " + "Main Menu a\nEND-USER is provided with a MENU BAR." + "\n________________________________________________________________ \nFrom the Menu Bar " + "named \" Master Maintenence\" user will find a lot of options to \n" + "do different jobs. The menu Master Maintenence Have the given MenuItem & Sub-\nMenu Item." + " Their Jobs Are As Follows :--\n" + "\nCreditorMaster :\t\t To Add or Delete Creditor to Creditor database." + "\nRetailerMaster :\t\t To Add or Delete Retailer to Retailer database." + "\nDisributorMaster :\t To Add od Delete Distributor to Distrobutor database." + "\n________________________________________________________________ \n" + "From the MenuItem named \"Item Group Master Maintenence\"" + "\nthe user will find another four Sub-Menu Items, these are as follows :\n" + "\n Add New Category :\t To Add a new Category to Category database." + "\nDelete Category : \t To Delete an Exis ting Category from category database." + "\n Add new Sub-Category :\t To Add a new Sub-Category to Sub-Category database." + "\nDelete Sub-Category :\t To Delete an Existing Sub-Category from Sub-Category \n\t\t\t database." + "\n_______________________________________________________________ \n" + "From the MenuItem named \" Stock Master Maintenence \" " + "the user will get two Sub-\nmenu Items, they are :--\n" + "Add Stock :\t\t To Add an item's CategoryId,Sub-categoryId, " + "quantity,\n\t\t\t price & purchase date to stock database" + "\nDelete Stock :\t\t To Delete An Existing entire stockItem from " + "stock-\n\t\t\t database" + " \n_______________________________________________________________\n" +

102

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


"\n The MenuItem \"User Maintenence\" the authorised users can add a new user" + "\n\t\t\t or remove an existing user." + "\n________________________________________________________________ \n\n" + "The last option of Master maintenence can help an user to EXIT from main window" + "\n\t\t\tby clicking on the \"Exit\" menuItem.\n" + "\n________________________________________________________________" + "\n________________________________________________________________ \n" + "Here the Menu named \"Transactions\" helps to :--\n" + "Sales :\t\t\t To sale an item with the proper tracking report kept on\n" + "\t\t\t \"sales\" database." + "\n________________________________________________________________ \n" + "Damaged Stock Return :\t \"sales Monitoring & Inventory Controling System \"kept\n" + "\t\t\t the records of damaged items for better transaction.\n" + "\n________________________________________________________________ \n" + ""); } public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new HelpStartPage().setVisible(true); } }); } // Variables declaration pri vate java.awt.Te xtArea te xtArea1; // End of variables declaration }

About

//About.java import java.awt.*; public class HelpAbout extends java.awt.Frame { public HelpAbout() { initComponents(); centre(); } public void centre() { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int x = (int) (screenSize.getWidth() / 2 - getWidth() / 2); int y = (int) (screenSize.getHeight() / 2 - getHeight() / 2); setLocation(x, y); } pri vate void initComponents() { te xtArea1 = new java.awt.Te xtArea();

103

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


label1 = new java.awt.Label(); setBackground(new java.awt.Color(153, 204, 255)); setMinimumSize(new java.awt.Dimension(400, 400)); setResizable(false); setTitle("About"); addWindowListener(new java.awt.event.WindowAdapter() { public void windowActivated(java.awt.e vent.WindowEvent evt) { formWindowActivated(evt); } public void windowClosing(java.awt.event.WindowEvent evt) { e xitForm(evt); } }); setLayout(null); te xtArea1.setBackground(new java.awt.Color(204, 255, 255)); te xtArea1.setEditable(false); te xtArea1.setFont(new java.awt.Font("Lucida Fax", 0, 12)); te xtArea1.setText(" Application Details :-\n\t\t\t The system keeps track of the items \n purchased as well as sold by a trading company. This includes \n various master maintenance modules, including inventory man-\n agement and transaction entry. Various reports are also gene-\n rated to aid the management in its decision-making process. \n\n About this project development:-\n\t\t\tThis \"Sales Monitoring and Inventory \n Controling System \" project has been developed as the Minor - \n Project by the Students Of George College (Group H). \n\t\t\tWe are thankfull to George College \n for providing us such an opportunity where we get to know about\n many of the practical circumstances taking places in the IT indust-\n ries rapidly now a days!\n\n Group H-\n 1.Subhamoy Ghosh\t\t(Team Leader & Coder)\n 2.Bipru Thakur \t\t\t(Deputy Team Leader & Coder)\n 3.Sujoy Majumder\t\t(Maintainer & Designer)\n 4.Nisanta Buxi\t\t\t(Tester & Designer) \n 5.Debmalya Ghosh\t\t(Data Manipulatior)\n \n Project Developed Under-\n\n Mr.Nirmalya Kr. Bhattacharjee . without his kind help this project\n would never be done."); add(textArea1); te xtArea1.setBounds(10, 40, 385, 300); label1.setFont(new java.awt.Font("Dialog", 1, 14)); label1.setText("Help About"); add(label1); label1.setBounds(160, 10, 170, 20); pack(); } pri vate void exitForm(java.awt.event.WindowEvent evt) { XYZEnt xyz = new XYZEnt(); xyz.setVisible(true); this.setVisible(false); } pri vate void formWindowActivated(java.awt.event.WindowEvent evt) { te xtArea1.setText(" Application Details :-" + "\n\t\t\t The system keeps track of the \n" + "items purchased as well as sold by a trading company.\n" + " This includes various master maintenance modules, \n " + "including inventory management and transaction entry.\n" + " Various reports are also generated to aid the management in its \n" + "decision-making process. " + "\n\n About this project development:-\n" + "\t\t\tThis \"Sales Monitoring and \nInventory Controling System \" project has been " + "developed \n as the Minor Project by the Students Of George College \n(Group H). " + "\n\t\t\tWe are thankfull to George College \nfor providing us such an " + "opportunity where we get to know \nabout many of the practical" + " circumstances taking places \nin the IT industries rapidly" + " now a days!\n\nGroup H-\n1.Subhamoy Ghosh\t\t(Team Leader & Coder)\n2." + "Bipru Thakur \t\t\t(Deputy Team Leader & Coder)\n3.Sujoy Majumder\t\t" + "(Maintainer & Documentation)\n4.Nisanta Buxi\t\t\t(Tester & Designer)" + "\n5.Debmalya Ghosh\t\t(Tester)\n6.Kallol Chakraborty\t\t(Designer)" + "\n\nProject Developed Under-\n\n" + "Our respectable principle Dr.Nirmalya Kr. Bhattacharjee . without his " + "kind help this \nproject would never be done."); }

104

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new HelpAbout().setVisible(true); } }); } // Variables declaration pri vate java.awt.Label label1; pri vate java.awt.Te xtArea te xtArea1; // End of variables declaration }

105

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


8.0

Testing:Introduction:

Testing is approved of executing a program w ith the explicit intention of finding error, i.e. making the program fail. Testing is a complex processes. In order to make this processes simpler, the testing are broken into smaller activities.

Techniques:
Testing means the processes of analy zing the softw are item to detect the different between existing or required condition and evaluate the features of the software item. Through testing of the system before release of the software needs to be done to vide the various test case and modes so that the software becomes devoid of bugs uses minimum space requirement as w ell as minimum time to perform. The test cases were selected before hand with expected result defined and actual result recorded for comparison. The selection of test cases is done vide White Box Testing techniques to check internal programming logic and effic iency vide Black Box Testing techniques to check softw are requirement fulfillment w ith intention of finding maximum number of errors with minimum effort of time. Although test case are design by considering the cyclomatic complexity, conditional test, still the software code is not in its optional form, as all other possible alternative parts in the software are not consider. At the integration level, software to the third party tests, which further enhance the software optimality and efficiency.

Test Data Implementation and Their Resolution:


The quality and standardization of the software package dependent truly on the version predefined testing norms and on the performance of the software over the norms. There are various standard exis ting in the software industry the engineering and product end product strives to achieve. ISO 9002, SEI, CMM, Level 5 etc. these standard are achieve only when the concern software fulfils the test as per as the respectiv e testing norms predefined in them vide the various test cases and parameter using the CASE tool.

The follow ing flow graph methodology was used while testing the software:

Here each circle represents one or more non-branching procedural language or source code Statement in flow graph. While performing condition testing, domain-testing methodology was selected. While performing loop testing, simple loops concatenated loops, nes ted and unstructured loops were tested thoroughly.

Test Characters:
A A A A good test has a probability of finding an error. good test is not redundant. good test should be best of breed. good test should be neither too simple nor too complex.

106

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM


Black Box Testing:
A Black Box Test examines some fundamental aspect of a system w ith little regard for the internal logical structure of the software. Black Box Testing is used to find the errors in the follow ing categories Incorrect or missing function Interface error Error in data structure/external database access Memory access error Initializing and termination error

White Box Testing:


White Box Testing of software is predic ated on close examination of procedural detail. White Box Testing is used to find the error in the follow ing Categories Ensure that all independent parts w ithin the module have been exercis ed at least once. Exercise all logical decisions on their true and fals e side. Exercise all loops at their boundaries and within operational bound. Exercise internal data structure to ensure their validity.

8.2

Test Plan:-

Testing means the processes of analyzing software item to detect the difference betw een the exis ting and required permission and to evaluate of the software item. Once test plan and the test case are completely designed, different of testing starts.

Unit Te sting:
The unit testing is performed to test the validity to the individual units. This is done in the coding phase w ith the interactive testing maintain uniformity throughout the screen. screen. Specific Test: This testing is done on the functional part of the object in the General Testing: This testing is performed on the interface design to

Integration testing:
to the desired benchmarked. When the integration test phase is stared the interface between the modules are tested. System Testing: It incorporates the performance stress testing so as to meet the product criteria w ith respect Recovery Test: It test the response of the system to the presence of the faults, or loss of power, devic es, services, data, etc. the system is subjected to the loss of the mentioned resources in order to check if the system recover satisfactory. Security Test: It is carried out to ensure the security of the SRS document and prevent unauthorized access. Stress Test: It is know n as endurance testing. It evaluates system performance when it is stressed for short period of time. Perform ance Test: It is carried out to check whether the system meets the nonfunctional requirement identified in the SRS document. Test case Generation: provides with an outright failure or whether some of the expected result of the test were actually observed.

Validation Testing:
Tests were performed to find conformity with the requirement. Plans and procedure were designed to ensure that all functional requirements are satisfied. Alpha Test: The alpha test is conducted at the developer site by a customer under the control of the developer. Beta Test: In Beta testing the developer system is to be tested by the user or customer for whom the system is developed.

8.3

Test Log:Testing Phase Component Function to be tested Checked w hether the method returns the expected value Checked w hether all the method are running properly Checked the w hole system is working according to the user requirement Scheduled 17th November, 2009 19th November, 2009 Actual Date 17th November, 2009 19th November, 2009 Comment Properly Working

Integrated Testing

Properly Working

System Testing

20th November, 2009

22th November, 2009

Properly Working

107

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM

9.0

User Manual:-

USER :
A user will not able to log into the system without any ID & PASSWORD. User have to turn the system off properly otherwise bad data or sudden crash may occur to the system. No keyboard shortcuts are provided.

Frequently Asked questions (FAQ):


Q. RECORD NOT S AVED? A. YOU MAY HAVE TO ENTE R DE TA ILS AS BEFORE CLICK ING ADD BUTTON.

Q. IT IS NOT ACCEPTI NG ME AS A US ER? A. YOU MAY HAVE FORGOTTE N THE ID & PASSWORD. YOU ARE ENTE RING INVA LID OR INCORRECT PASSWORD O R YOU MAY CHECK ON THE CAPS LOCK B UTTON TO BE OFF OF THE KEYBOARD. OR ASK THE SYSTEM USER FOR ID & PASSWORD.

108

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM

Conclusion

Todays world is running with a great speed and concept of existence is most important everywhere. In this great struggle of keeping existence, the whole society is in the glorious proceeding just getting COMPUTERIZATION as the only tool. Computerization with its newer and newer solution, has given the modern of great success and victory.

Computerization is a new vision, new challenge to modern world. It is a tools to develop and prosper to a decide level in terms of efficiency and productivity.

Computerization makes the whole business process faster, simple and easy to operate. Now any type of queries and transaction can be done within a fraction of second. There are a lot of scope for modification, cancelling and structured way on maintaining stock management. This process will save lot of time, give satisfaction, ensure effective management and lastly high security. So we have the confidence that the project Stock management and inventory control system will give the complete satisfaction to user as well as to the enterprise.

109

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM

Bibliography

Books referred: Herbert Schildt JAVA 2 complete reference. Website Referred: Wikipedia and Google search on java,jdbc for some help and reference.

110

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM

SIGNATURE

This is to certify that the project entitled Stock management and Inventory Control System has been prepared according to the regulation of degree of Bachelor in Computer Application (BCA) under West Bengal University of Technology (WBUT). The project is being submitted by student of BCA 3rd year 1st semester, George College (Affiliated to WBUT) have fulfilled the requirement for submission of this project. 1. 2. 3. 4. 5. 6. Subhamoy Ghosh (PL) Bipru Thakur (DPL) Sujoy Majumder Nisanta Buxi Debmalya Ghosh Kallol Chakraborty

The whole procedure has been carried out under my supervision. I have gone through the project & have seen that it is fulfilling the requirement of minor project under WBUT.

Approved By: Date:

Dr. Nirmalya Bhattacharya

______________________________________ (Principal and Project -In-Charge)

111

STOCK MANAGEMENT AND INVENTORY CONTROL SYSTEM

Project Report:

Prepared by Subhamoy Ghosh(Project Leader)


Student Name Subhamoy Ghosh Bipru Thakur Sujoy Majumder Nisanta Buxi Kallol Chakraborty Debmalya Ghosh Work Done Coding Coding Documentation Testing Maintenance Testing Work Done Work done successfully Work done successfully Work done successfully Work done successfully Work done successfully Work done successfully

______________________________________

Signature of Group Leader

112

You might also like