You are on page 1of 105

Report Analysis of Inventory Management Using ELK Stack

i
ABSTRACT

Having good decision support is absolutely necessary nowadays because of the need
to improve and gain value. For any organization, it is vital to obtain accurate knowledge
of inventory level is key for staying in business and making it a profitable one. If inventory
tracking is not efficient would lead to major trouble in any business. For a business to
thrive, it is essential to find the ideal level of inventory where it can sufficiently meet demand
without under or overstocking value from anything it can. To understand the flow of any
business it is essential to ensure the profitability of the product and the performing level. To
make sense of what is happening and what had happened and to get important hints and
directions. The impediment in the normal Inventory valuation reports is to obtain support as
visualization to get a clear picture, in real time if possible and the solution used needs to be
very malleable. To ease in managing data we chose to use Elastic Stack to manage
organization data. The process of making sense of plain database is based on three big steps:
collect, process and use. In order to do so and to make sense of all of this, this project
proposes to use an Elastic Stack solution, also known as ELK (Elasticsearch , Logstash and
Kibana), to easily and rapidly manage and to search and to create dashboard for better sense
to extract valuable information to stand as decision support. In order to achieve that purpose
and obtain valuable information from data all components are used to process data and
analyze the result to offer support for decision making
The main goal of this system can be used to store the details of the inventory, stock
maintenance, update the inventory based on the sales details, generate sales and inventory
report daily or weekly based and to analyze and visualizing the report from the old plain
database not only helps the companies in their decision making but also in improving their
products and services.

ii
LIST OF FIGURES

S.NO FIGURE NO FIGURE NAME PAGE NO


1 4.1 Entity Relationship Diagram 10
3 4.2 Level 0- Data Flow Diagram 18
4 4.3 Level 1-Data Flow Diagram 18
5 4.4 Level 2-Data Flow Diagram 19
6 4.5 Level 3-Data Flow Diagram 19
7 4.6 Use Case Diagram 20
8 4.7 Sequence Diagram 21
9 4.8 Class Diagram 22
10 4.9 Activity Diagram 23
11 4.10 Component Diagram 23

LIST OF TABLES

S.NO TABLE NO TABLE NAME PAGE NO

1 4.1.2.1 Customer Detail. 11


2 4.1.2.2 Machine master 12
3 4.1.2.3 Component Master 12
4 4.1.2.4 Purchase order master 13
5 4.1.2.5 Raw master 13
6 4.1.2.6 Mould master 14

CONTENTS

iii
Title Page No
Abstract……...……………………………………………………………………………...….i
List of Table…………………………………………………………………………………...vi
List of Figures……………………………………………………………………………...….vii
Chapter I: Introduction
1.1 Organization profile…………………………………………………..……….…..01
Chapter II: System Study
2.1Existing System ………………………………...………………….…….……......02
2.2 Problem Definition………………………………………………….…………….02
2.3Proposed System …………….……………………………………....….……........03
Chapter III: System Analysis and Feasibility Study
3.1Hardware Requirements…………...………………………………...………….....04
3.2 Software Requirements…………………...…………………………….................04
3.3 Software Description………………………………………..…….……...…….....05
3.4 Feasibility Study …………………………………..……..……………...…….....07
3.4.1 Economical feasibility ……………………………...………...…….....07
3.4.2 Operational Feasibility ………………………………...…….....07
3.4.3Technical Feasibility………………………………..…………...…….....08

Chapter IV: System Design


4.1 Data Model………………………………………………………………..………09
4.1.1 Entity Relationship Diagram..…………..…………………...........….....10
4.1.2 Data Design……………………………...…………………..……..…...11
4.1.3 Data Dictionary………………………………………………..….…..…15
4.1.4 Normalization..………………………………………………..….…..…15

4.2. Process Model…………………………………………………………………….17


4.2.1. Architecture Design…………………………………………….………17
4.2.2. Data Flow Diagram……………………………………...……………...18
4.2.3 UML Diagrams........................................................................................20

Chapter V: Software Development


iv
5.1. Phases of Software Development………………………………....………....…....24
5.1.1 Phase I: Planning……………………………………………………......24
5.1.2 Phase II: Analysis…………………………………………….................24
5.1.3 Phase III: Design ……………………….……………………………….25
5.1.4 Phase IV: Development………………..……...…………………….......25
5.2.Modular Description…………………………………….…………….…..25
Chapter VI: Testing
6.1. System Testing………………………………………………………………….....28
6.1.1 Verification……………………………………………………………...28
6.1.2 Validation...……………………………………………………………...28
6.1.3 Integration Testing …………………………...……………………........29
6.1.4 Unit Testing…………………………………..………………..………..29
6.1.5 Installation Testing……………………..…..………………..………….29

Chapter VII: System Implementation


7.1. Introduction…………………………………….……………….…………...……30
7.2. Implementation………………………………….…….…………….……............31

Chapter VIII: Performance and Limitations


8.1 Merits of the system……………………………………………………………….32
8.2 Future Enhancements…………………………………………...………………..32
8.3 Conclusion..............................................................................................................32
Chapter IX: Appendices-I
9.1. Sample Code …………………………………………...………………..33
9.2 Sample Screens ........................................................................................................93
9.3 Reports ………………............................................................................................96
9.4 References................................................................................................................98

Chapter X: Appendices-II
10.1Journal Publication….............................................................................................99

v
vi
I. INTRODUCTION

1.1    Organization Profile


BNP Paribas SA is a France-based company engaged in the financial industry. The
Company provides banking and financial services. The Company operates in two divisions:
Retail Banking and Services, and Corporate and Institutional Banking (CIB). The Retail
Banking and Services division includes retail banking networks and specialized financial
services in France and abroad. The Retail Banking and Services division is divided into
Domestic Markets and International Financial Services. Domestic Markets include French
Retail Banking (FRB); BNL banca commerciale (BNL bc), Italian retail banking; Belgian
Retail Banking (BRB), and Other Domestic Markets activities, including Luxembourg Retail
Banking (LRB). Its International Financial Services include Europe-Mediterranean,
BancWest, Personal Finance, Insurance, and Wealth and Asset Management. CIB includes
Corporate Banking, Global Markets and Securities Services. It operates through Financiere
des Paiements Electroniques SAS.
BNP Paribas Leasing Solutions include Equipment & Logistics Solutions for
professional rolling equipment: farming machinery, construction and public works
equipment, light commercial and industrial vehicles; Technology Solutions for office
software, information technology (IT), telecom and specialized technologies, and Bank
Leasing Services, offering leasing products and services to customers of BNP Paribas
banking entities.

1
CHAPTER: II
SYSTEM ANALYSIS
System Analysis is a combined process dissecting the system responsibilities that
are based on the problem domain characteristics and user requirements it is a process of col-
lecting and interpreting facts, identifying the problems, and decomposition of a system into
its components.

System analysis is conducted for the purpose of studying a system or its parts in order to
identify its objectives. Analysis can also be a series of components that perform organic
functions together.

2.1 EXISTING SYSTEM


 Current system is a manual one in which users are maintaining ledgers, books
etc to store the information like suppliers details, inwards, deliveries and
returns of items in all godowns, customer details as well as employee details.
 Not a clear picture of what is happening in an organization.
 Manually digging database and analyzing is a tedious problem.
 Boring and time consuming report generation process with complex queries.
specific training is required for the employees to understand the report
2.2 PROBLEM DEFINITION
 In traditional system we can’t view particular details in efficient manner.
 specific training is required for the employees to use this application
 Difficult to understand the flow of the business.
 Manually grepping of data to analyze the business.

2.2.1 PROBLEM DEFINED


 Current system is a manual one in which users are maintaining ledgers,
books etc to store the information like suppliers details, inwards, deliveries
and returns of items in all go downs, customer details as well as employee
details.
 It is very difficult to maintain historical data.
 Also regular investments need to purchase stationary every year.

2
 All information is not placed separately.

2.3 PROPOSED SYSTEM:

Proposed system is a software application which avoids more manual hours that need
to spend in record keeping and generating reports.
It is very easy to manage historical data in database. No specific training is required
for the employees to use this application. They can easily use the tool that decreases manual
hours spending for normal things and hence increases the performance. As the data is
centralized it is very easy to maintain the stocks of the various items in all godowns. Real
time tracking with elastic search in order to ensure the need is satisfied to user or client.Can
generate required reports in a visualization manner.Easy to take decision based on clear
report.To achieve that level of visibility.This helps to view the reports in an efficient manner.

ADVANTAGE:
The following are the advantages of proposed system
 Easy to manage all the daily transactions
 Can generate required reports easily
 Easy to manage historical data in a secure manner
 Centralized database helps in avoiding conflicts
 Easy to use GUI that does not requires specific training

3
CHAPTER III
SYSTEM ANALYSIS AND FEASABILITY STUDY

3. SYSTEM ANALYSIS:
The system analysis is produced at the culmination of the analysis task. The function and
performance allocated to software as part of system engineering are refined by
establishing a complete information description as functional representation of system
behavior, an indication of performance requirements and design constraints, appropriate
validation criteria.

SYSTEM REQUIREMENT

3.1 HARDWARE SPECIFICATION:


Processor : Intel core i3
RAM : 4 GB
Hard Disk Drive : 300 GB

3.2 SOFTWARE SPECIFICATION:


Front-End : Java swing
Framework : Hibernate
Operating System : Window 8.1
Back-End : h2 1.4.196
Visualization tool : ELK 6.5.4(Elastic)

4
3.3 SOFTWARE DESCRIPTION
JAVA SWING INTRODUCTION:
Java Swing or Swing was developed based on earlier APIs called Abstract Windows
Toolkit (AWT).Swing provides richer and more sophisticated GUI components than AWT.
The GUI components are ranging from a simple label to complex tree and table

Swing is platform independent and enhanced MVC (Model -View -Controller) frame-
work for Java application. Here are the most important features in Swing architecture.

 Pluggable look and feel:  


o Swing supports several looks and feels and currently supports
Windows, UNIX, Motif, and native Java metal look and feel.
o Swing allows users to switch look and feel at runtime without

restarting the application.

 Lightweight components:
o All swing components are lightweight except some top-level
containers. 
o Lightweight means component renders or paints itself using
drawing primitives of the Graphics object instead of relying on
the host operating system (OS).
 Simplified MVC:
o Swing uses simplified model-view-architecture (MVC) as the
core design behind each of its components called model-delegate.
o Based on this architecture, each swing component contains a
model and a UI delegate.

HIBERNATE FRAMEWORK

Hibernate is a pure Java object-relational mapping (ORM) and persistence framework


that allows you to map plain old Java objects to relational database tables. The main goal of
hibernate is to relieve the developer from the common data persistence related tasks. It maps
the objects in the java with the tables in the database very efficiently and also you can get
maximum using its data query and retrieval facilities. Mainly by using Hibernate in your
projects you can save incredible time and effort.

5
H2 Database
In many cases H2 is faster than other (open source and not open source) database
engines. Please note this is mostly a single connection benchmark run on one computer, with
many very simple operations running against the database. This benchmark does not include
very complex queries. The embedded mode of H2 is faster than the client-server mode be-
cause the per-statement overhead is greatly reduced.
FEATURES OF H2 DATABASE
It is an extremely fast database engine.
H2 is open source and written in java .
Elastic search
Elasticstack is open source they can easily afford. There is no need of the technical
expertise in-order to generate the report and to create a dashboard. The heart of the Elastic
stack is Elasticsearch. Elasticsearch is a search engine and it is based on top of Apache's
Lucene engine. Elasticsearch is easy to scale the business with total data size. Elasticsearch is
capable in indexing and searching. search tool. Elasticsearch makes an index of the content
and it looks to the indexes as opposed to the contents. There is number of tools to ingest data
into elasticsearch.Elastic Search is a robust search and analytics tool that stores data in a
document oriented data store. The most popular usage of ElasticSearch today is Log
Management The documented oriented storage differs sharply from traditional table oriented
RDBMS (Such as Oracle, MS SQL Server). With document oriented data storage, data is
stored as structured JSON (JavaScript Object Notation) documents. Every field is indexed by
default.
LOGSTASH
Logstash is the workhorse that collects the log files from Application Servers, parses
them, formats them and sends them to Elastic Search.We using Logstash tool to get data into
elasticsearch from the database. Elasticsearch is a content indexing web Thus, it is quick.
Logstash is a tool for managing and to Collect data, parse them, and store them for later use
(like, for searching). Logstash is an open source, server-side data processing pipeline. We can
use it to ingest data from multiple sources, transform it and send to the Elasticsearch.
Logstash can dynamically combine data from various sources and normalize the data into
destinations of your choice.

6
KIBANA
If we store them in Elasticsearch, we can view and analyze them with Kibana. The
Kibana web interface is an adjustable dashboard that we can stretch out and change to suit
our surroundings. It permits tables and diagrams creation and in addition complex
representations. The Kibana web interface utilizes the Apache Lucene question linguistic
structure to permit us to make inquiries.
3.4 FEASIBILITY STUDY

The feasibility of the project is analyzed in this phase and business proposal is put
forth with a very general plan for the project and some cost estimates. During system
analysis the feasibility study of the proposed system is to be carried out. This is to ensure
that the proposed system is not a burden to the company. For feasibility analysis, some
understanding of the major requirements for the system is essential. Three key
considerations involved in the feasibility analysis are

• OPERATIONAL FEASIBILITY
• ECONOMIC FEASIBILITY
• TECHNICAL FEASIBILITY

3.4.1 Operational Feasibility


In this current system During operational feasibility study, it is determined
whether the system will operate in the way that user wants. Operational feasibility depends
upon human resources for the development and implementation of the system. It is
considered whether the qualified and experienced manpower is available for development
and implementation of the system. User involvement is more required in determining the
operational feasibility. The current system will also focus on analyzing reports in an efficient
manner.

3.4.2 Economical Feasibility


This project possesses a greater value on the economic side of the organization.
The system will be benefit any type of organization and report generation tools is open source
and easy to analyze reports in an effective way so this system is economically feasible.

7
3.4.3 Technical Feasibility
The technical feasibility is used to explain the technical requirements of the
system in the current project, we mainly used open source tool. Which will show

tremendous result on analyzing the reports in an visualization manner.

8
CHAPTER IV
SYSTEM DESIGN
System Design involves identification of classes their relationship as well as their
collaboration. In objector, classes are divided into entity y classes and control classes. The
Computer Aided Software Engineering (CASE) tools that are available commercially do not
provide any assistance in this transition. CASE tools take advantage of Meta modeling that is
helpful only after the construction of the class diagram. In the FUSION method some object-
oriented approach likes Object Modeling Technique (OMT), Classes, and Responsibilities.
Collaborators (CRC), etc, are used. Objector used the term” agents” to represent some of the
hardware and software system. In Fusion method, there is no requirement phase, where a user
will supply the initial requirement document. Any software project is worked out by both the
analyst and the designer. The analyst creates the user case diagram. The designer creates the
class diagram. But the designer can do this only after the analyst creates the use case diagram.
Once the design is over, it is essential to decide which software is suitable for the application

4.1. DATA MODEL


A data model can be thought of as a diagram or flowchart that illustrates the relation
between data. The main aim of data models is to support the development of information
system by providing the definition and definition and format of data. Usually data models are
specified in a data modeling language. Although capturing all the possible relationships in a
data model can be very time intensive, it’s an important step and shouldn’t be rushed. Well
Document models allow stake holders to identify errors and make changes before any
programming code has been written data modelers often use multiple models to view the
same data and ensure that all processes, entities, relationships and data flows have been
identified. The structural part of a model theory refers to the collection of data
structures.which make up a data when it is being created these data structures represent
entities and object in database model. The manipulation part of a data model refers to the
collection of operators which applied to the data structures.

9
4.1.1 ENTITY RELATIONSHIP DIAGRAM

An entity relationship diagram (ERD) shows the relationships of entity sets stored in a


database. An entity in this context is an object, a component of data. An entity set is a
collection of similar entities. These entities can have attributes that define its properties.

Is a

Is a

Part
of

Part of

Fig 4.1.1 ENTITY RELATIONSHIP DIAGRAM

10
4.1.2 TABLE DESIGN :

Table Name : customer Detail.


Purpose : customer Detail table stores customers personal details.
Sno Field name Type Constraints
1 Name String NOT NULL
2 Code String PRIMARY KEY
3 Address String NOT NULL
4 City String NOT NULL
5 Contacts Double NOT NULL
6 Delivered String NOT NULL
7 Designation String NOT NULL
8 Destination Double NOT NULL
9 Pincode Double NOT NULL
10 Div Double NOT NULL
11 Ecc Double NOT NULL
12 Factory Double NOT NULL
13 Gst Double NOT NULL
14 Pan Double NOT NULL
15 Mobile Double NOT NULL
16 Office Double NOT NULL
17 Remarks String NOT NULL
18 Fax Double NOT NULL
19 Range Double NOT NULL
20 Remarks String NOT NULL
21 url String NOT NULL
22 Vendor String NOT NULL
23 Std String NOT NULL
24 Pager Double NOT NULL

11
Table Name :MachineMaster
Purpose :MachineMaster table is used to get machine details

Sno Field Name Type Contraints


1 MachineCode String PRIMARY KEY
2 MachineDescription String NOT NULL

Table Name : Component Master


Purpose :ComponentMaster table is used to get component details

Sno Field Name Type Constraints


1 partCode String PRIMARY KEY
2 ComponentpartCode String NOT NULL
3 AmtFrom Date NOT NULL
4 AmtQuantity Double NOT NULL
5 Amvalue Double NOT NULL
6 CusCode String NOT NULL
7 CusName String NOT NULL
8 componentName String NOT NULL
9 RawName String NOT NULL
10 rawCode String NOT NULL
11 PackMode String NOT NULL
12 MouldName String NOT NULL
13 MouldCode String NOT NULL
14 Fettling rate Double NOT NULL
15 From1 Date NOT NULL
16 From2 Date NOT NULL
17 To1 Date NOT NULL
18 To2 Date NOT NULL
19 Norm1 Date NOT NULL
20 Norm2 Date NOT NULL
21 HsnCode String NOT NULL

Table Name :purchase order Master


Purpose : purchase order table is used to get purchase order details.
12
Sno Field Name Type Constraints
1 PONO String PRIMARY KEY
2 CUS_NAME String NOT NULL
3 IGST NOT NULL
4 QUANTITY Double NOT NULL
5 CGST Double NOT NULL
6 CUSCODE Double NOT NULL
7 DATE Date NOT NULL
8 ED Double NOT NULL
9 HSN String NOT NULL
10 MRP Double NOT NULL
11 PARTCODE String NOT NULL
12 RATE Double NOT NULL
13 SGST Double NOT NULL
14 ST Double NOT NULL

Table Name :Raw Master


Purpose :Raw Master table is used to get Raw material details

Sno Field Name Type Constraints


1 RawCode String PRIMARY KEY
2 RawDescription String NOT NULL

Table Name :Mould Master


Purpose :Mould Master table is used to get mould details

Sno Field Name Type Constraints


1 MouldCode String PRIMARY KEY
2 Code String NOT NULL
3 MouldName String NOT NULL
4 totalShots Double NOT NULL
5 Name String NOT NULL

13
4.1.3 Data Dictionary

Table name: Customer Detail


Sno Field Name Descriptions
1 Name Name of the customer
2 Code Unique code to identify customer
3 Address Address of the customer
4 City City of the customer
5 Contacts Contact information of the
customer
6 Delivered Delivering information
7 Designation Designation information
8 Destination Destination address to deliver the
information
9 Pincode Pincode of the customer
10 Div Division of the customer
11 Ecc Ecc code of the customer
12 Factory Factory id of the customer
13 Gst Gst number of the customer
14 Pan Pan card number of the customer
15 Mobile Mobile number of the customer
16 Office Office number of the customer
17 Remarks Remarks of the customer
18 Fax Fa x number of the customer
19 Range Range of the customer
20 Remarks Remarks of the customer
21 url url of the customer
22 Vendor Vendor of the customer

14
23 Std Std of the customer
24 Pager Pager of the customer

Table name: Raw Material

Sno Field Name Description


1 RawCode Unique number to identify raw material
2 RawDescription Description of the raw material
Table Name: Mould Master

Sno Field Name Description


1 MouldCode Unique number to identify raw
material
2 Code Unique number to identify
3 MouldName Name of the mould
4 totalShots Total number of shots
5 Name Name of the part

4.1.4 NORMALIZATION
Normalization is a formal process for assigning attributes to entities.
It reduces and controls data redundancies .Helps eliminate data anomalies where
insertions, deletions, updates destroy the integrity of the database .At the conclusion
of this process the database will be logically correct

First Normal Form


A relational table must not contain repeating groups.
Repeating groups can be eliminated by adding the appropriate entry in at least
the primary key column(s).This leads to a much wider, longer table.
Until 1NF is achieved we cannot create a relational database at all.

15
Second Normal Form

It includes no partial dependencies; that is, no attribute is dependent on only a


portion of the primary key.

Boyce-Codd Normal Form (BCNF)


A table is in Boyce-Codd normal form (BCNF) if every determinant in the
table is a candidate key.
If a table contains only one candidate key, the 3NF and the BCNF are
equivalent
BCNF is a special case of 3NF.

4.2. PROCESS MODEL:

A Software process model is a simplified representation of a software process. Each


model represents a process from a specific perspective. These generic models are abstractions
of the process that can be used to explain different approaches to the software development.
They can be adapted and extended to create more specific processes. Process model uses
process simulation software to make data driven decisions. It is a description of the sequence
of activities carried out in an SE project, and the relative order of these activities.
A Software process model is a standardized format for
 Planning
 Organizing, and
 Running

4.2.1 ARCHITECTURE DESIGN:

16
Fig 4.2.1Architecture Diagram

4.2.2 Data Flow diagram


A data-flow diagram (DFD) is a way of representing a flow of a data of a process or a system
(usually an information system) The DFD also provides information about the outputs and
inputs of each entity and the process itself.

17
Fig 4.2.2.1: DFD level 0

Fig 4.2.2.2: DFD level 1

18
Fig4.2.2.3:DFD level 2

Fig 4.2.24: DFD level 3


4.2.3 UML DIAGRAM
UML is a standard language for specifying, visualizing, and documenting of
software systems and created by Object Management Group (OMG) in 1997.There are three
important type of UML modeling are Structural model, Behavioral model, and Architecture

19
model. To model a system the most important aspect is to capture the dynamic behavior
which has some internal or external factors for making the interaction. These internal or
external agents are known as actors. It consists of actors, use cases and their relationships. In
this fig we represent the Use Case diagram for our project.
4.2.3.1 Use case diagram:
A use case is a set of scenarios that describing an interaction between a user and a
system. A use case diagram displays the relationship among actors and use cases. The two
main components a user or another system that will interact with the system modeled. A use
case is an external view of the system that represents some action the user might perform in
order to complete a task.

Fig 4.2.3.1 Use Case diagram

4.2.3.2 SEQUENCE DIAGRAM:


Describe the flow of messages, events, actions between objects and Show concurrent
processes and activations and Show time sequences that are not easily depicted in other

20
diagrams .Typically used during analysis and design to document and understand the logical
flow of your system

Fig 4.2.3.2 Sequence Diagram

4.2.3.3 Class Diagram

21
Class diagram is a static diagram. It represents the static view of an application. Class
diagram is not only used for visualizing, describing, and documenting different aspects of a
system but also for constructing executable code of the software application.

Fig 4.2.3.3 Class Diagram

22
4.2.3.4 ACTIVITY DIAGRAM
An activity diagram also called interaction diagram is an illustration of the
relationships and interaction among software objects in the Unified Modeling Language.

Fig 4.2.3.4 Activity Diagram


4.2.3.5Component diagram

A component diagram, also known as a UML component diagram, describes the organization


and wiring of the physical components in a system. Component diagrams are often drawn to
help model implementation details and double-check that every aspect of the system's
required functions is covered by planned development.

Fig: 4.2.3.5Component diagram

CHAPTER – V

23
SOFTWARE DEVELOPMENT

Software Development Life Cycle in systems engineering and software


engineering, is the process of creating or altering systems, and the models and
methodologies that people use to develop these systems. In software engineering, the
SDLC concept underpins many kinds of software development methodologies. These
methodologies form the framework for planning and controlling the creation of
software development process.

5.1 PHASES OF SOFTWARE DEVELOPMENT


The normal phases of a development project are planning, analysis, design,
development, testing, implementation, and enhancement. Different methodologies
may call these phases by different names, but they are always present. Each phase
has its own products, which may be different names, but they are always present.
Each phase has its own products which may be documents, code or results.

5.1.1. PHASE I-PLANNING


Planning is to generate a high-level view of the intended project and
determine the goals of the project. Our project plan depends on the customer needs
and their requirements. The first phase will be how much time it will take and how
much cost it will take to finish. It plays vital role in developing the software project.

5.1.2. PHASE II-ANALYSIS


The goal of systems analysis is to determine where the problems in attempt to
fix the system. This step involves breaking down the system in different diagram to
analyze the situation. Analyze project goals, break down functions that need to be
created, and attempt to engage users so the definite requirements can be defined.

5.1.3. PHASE III-DESIGN

24
Systems design is the phase where system engineers analyze and understand the busi-
ness of the proposed system by studying the user requirements document. They figure out
possibilities and techniques by which the user requirements can be implemented. To analyze
and design the systems and products transformation. The nodejs is an open-source software
framework for dataflow programming across a range of tasks. It is a symbolic math library, and is
also used for developing web-applications . It is used for both research and production at
Google, Facebook often replacing its closed-source predecessor, not only that it can only
build a website to make it work for the smart it accept all to provide.

5.1.4. PHASE IV-DEVELOPMENT


The Development of the project is first of all to create a inventory website
model using node.js and after that brining that into the block chain for smart web
application development .

5.2 MODULE DESCRIPTION:

25
The project entitled that Inventory Management System explains each module in a detail
form. Every module has some operation to be performed in this project in the following
modules are follows.
 Masters
 Transaction
 Reports
1. Master

Masters Module holds details of the following sub Modules and they are as follows
 Customer Master:

This Customer Master holds the detail of customers. We can update, delete and
insert the Customer. Admin can access this customer master to add new customer ,and
admin can update customer details and even admin delete the customer.

 Component Master:

This Component Master holds the detail of customers. We can update, delete and
insert the Component. Admin can access this customer master to add new customer ,and
admin can update customer details and even admin delete the customer.

 Vendor Master:
This Vendor Master holds the detail of customers. We can update, delete and
insert the Component. . Admin can access this customer master to add new vendor,

and admin can update vendor details and even admin delete the vendor

 Raw Master:

This Raw Master holds the detail of customers. We can update, delete and
insert the Raw Material details. . Admin can access this raw master to add new
raw ,and admin can update raw details and even admin delete the raw.
 Mould Master:

This Mould Master holds the detail of customers. We can update, delete and
insert the Mould details. Admin can access this mould master to add new mould ,and
admin can update mould details and even admin delete the mould.

26
 Machine Master:

This Machine Master holds the detail of customers. We can update, delete and
insert the Machine details. Admin can access this machine master to add new machine
,and admin can update machine details and even admin delete the machine.

 Purchase Order Master:

This Purchase Order Master holds the detail of customers. We can update,
delete and insert the Purchase Order details. Admin can access this purchase order
master to add new purchase ,and admin can update purchase details and even admin
delete the purchase order

Transaction:
This Module describes the transaction between customer ,vendor and organization.

 Purchase Order
This module describes the client purchase details depending on the material they
choose sub module is triggered
 Raw Material:
If the customer has their own material then the material cost is
excluded and following receipt will be generated.

 Casting:
If the customer chose to buy raw material from vendor this module will
be executed.

Reports:
This module is to generate the reports in an visualization manner to otrack the
organization bussinessflow to understand what is happening in an environment.

27
CHAPTER VI
TESTING
6.1 TESTING ON APPLICATION PART

6.1.1 VERIFICATION TESTING


Verification is a process of evaluating the intermediary work products of a
software development lifecycle to check if we are in the right track of creating the final
product. Mostly, testing performs on the user interface and call flows of the application. As
like other UI applications mobile applications also require lots of human consideration.
Evaluates the intermediary products to check whether it meets the specific requirements of
the particular phase Teams can then combine automated tests with selected manual test
scenarios to balance the coverage and efficiency of the functional testing. To test some
functionalities of the application tester go for manual testing process, later on tester combines
manual testing and automation testing for better result. Checks whether the product is built as
per the specified requirement and design specification.

6.1.2 VALIDATION TESTING:

Validation is the process of evaluating the final product to check whether the software
meets the business needs. In simple words, the test execution which we do in our day to day
life is actually the validation activity which includes smoke testing, functional testing,
regression testing, systems testing etc…

28
6.1.3 INTEGRATION TESTING:

Interrupt testing is a process of testing a mobile application that functions may get
interrupted while using the application. Those interruptions can be; incoming and outgoing
SMS/MMS/calls, incoming notifications, battery/cable insertion and removal for better uses,
network outage and recovery, switch off/switch on of the media player and other connecting
devices, Low memory warning, and device power cycle (like; low battery notification).

An application should be capable to hold these interruptions by going into a suspended state
and restarting afterwards.

6.1.4 UNIT TESTING:

Unit testing is a software development process in which the smallest testable parts of
an application, called units, are individually and independently scrutinized for proper
operation. The testing process makes sure that the mobile app is now easy to use and offers a
suitable user experience to the customers.

6.1.5 INSTALLATION TESTING:

Mobile devices hold two types of applications; the one which automatically comes
with mobile OS (while installing OS, it automatically get installed), and another one you have
to install specially from the store to use the particular application.Installation testing is used
to test the particular application is installing, uninstalling, and updating properly without any
interruption (user is smoothly and flexibly installing the application).

29
CHAPTER VII
SYSTEM IMPLEMENTATION
7.1. INTRODUCTION
It is the process of bringing developed system into operational use. If the
implementation phase is not carefully planned and controlled, it can be lead to many critical
problems. Thus proper implementation is essential to provide a reliable system to meet
managerial requirements.
Implementation is one of the most important tasks in project. Implementation is the
phase, in which one has to be cautions, because all the efforts undertaken during the project
will be fruitful only if the tool is properly implemented according to the plans made.
The implementation phase is less creative than system design. It is primarily
concerned with user training; site preparation and file-sites, the test of the network along with
the system are also included under implementation.
Depending on the nature of the system extensive user training maybe required
programming is itself a design works. The initial parameters of the management information
system should be modified as a result of programming efforts. Programming provides a real
test for the assumption made by the analyst.
Implementation is used here to mean the process of converting a new or revised
system into an operation one. Here the new system is implemented to an operational use.
Maintenance is far more than fixing mistakes. The maintenance can be defined using four
activities that are undertaken after a program is released for use.
The second activity that contribute to a definition of maintenance occurs because of
the rapid change that encountered in every aspect of computing. Adaptive maintenance – as
activity that modifies software to properly interface with a changing environment – is both
necessary and common place.
The third activity that may be applied to definition of maintenance occurs when
software package is successful. As the software is used new recommendations for new
capabilities, modifications to existing function and general enhancements are received from
the user, to satisfy this request perceptive maintenance is used.
The fourth maintenance activity occurs when software is changed to improve future
maintainability or reliability, or to provide a better basic for future enhancements. This is
often called preventive maintenance, which is characterized by reverse engineering and
reengineering technique.

30
7.2. IMPLEMENTATION
The system has been tested in the location of the developer. But it is not possible to
find all errors here. It may be that even after through testing the user will find errors. In such
a case the user when reports the errors it is possible to correct those errors as that coding has
been documents and it is possible to find out the location where the error is occurring and the
reason for error can be analyzed and corrected. This developed system supports for corrective
maintenance.
As this software can be run with the requirements given above and it does not
involve any particular hardware as such and it can be run with the rapid development that is
being encountered in the computer industry. If there is a need to include any new modules
then it has been externally and then includes to it with the exits architecture. But up to now
the system holds all the possible reports generation tools, which a team needs. Later on it
correspondence with this limitation may upgrade the system. In the process of coding, the
lines of code keep multiplying, thus, size of the software increases. Gradually, it becomes
next to impossible to remember the flow of program. If one forgets how software and its
underlying programs, files, procedures are constructed it then becomes very difficult to share,
debug and modify the program. The solution to this is structured programming. It encourages
the developer to use subroutines and loops instead of using simple jumps in the code, thereby
bringing clarity in the code and improving its efficiency Structured programming also helps
programmer to reduce coding time and organize code properly.
During implementation, the project team creates the actual product. Product
implementation can be an exciting phase for the customer, because their idea for the project
becomes something tangible. Project developers begin building and coding the software.
The objective of the Implementation Phase is: first to install the system in the produc-
tion environment and to bring it into operation; and second, to ensure that the system, as de-
veloped:

 Satisfies the functional requirements


 Satisfies the business needs;
 Adheres to all mandates, physical constraints and service level agreements; and
 Operates as described in the User and Operator Manuals

31
CHAPTER VIII

PERFORMANCE AND LIMITATIONS

8.1 MERITS OF SYSTEM


 Most of the small-scale companies can afford these system since Elasticstack is open
source they can easily afford.
 It permits tables and diagrams creation and in addition complex representations.
 It enables us to track the flows and it improve us to know the knowledge about what
is running behind the process.

8.2 FUTURE ENHANCEMENT:


This application also provides a simple report on daily basis to know the daily sales and
purchase details. This application matches for small organization where the small limited
through it has some will surely benefit the organization. the efficient search and report
creation for small scale organization using open source stack ELK, we have used
inventory system database to demonstrate the usability of ELK stack but the real
usefulness of ELK stack will be on Big data sets as without much of installation steps and
being the product from open source community.

8.3 CONCLUSION:
It has every basic items which are used for the small organization. Our team is
successful in making the application where we can update insert and delete the item as per
their requirements. This application also provides a simple report on daily basis to know the
daily sales and purchase details. This application matches for small organization where the
small limited through it has some will surely benefit the organization. This system helps
organization to achieve level of visibility and flow of any business it is essential to ensure
the profitability of the product and the performing level. To make sense of what is
happening and what had happened and to get important hints and directions.

32
SAMPLE CODE:

Component Master

package com.inventory.frames;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.JOptionPane;

import java.awt.Font;
import javax.swing.JComboBox;
import java.awt.Color;
import java.awt.SystemColor;
import javax.swing.border.TitledBorder;
import javax.swing.table.DefaultTableModel;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

import com.fasterxml.classmate.members.RawConstructor;
import com.inventory.model.ComponentModel;
import com.inventory.model.CustomerModel;
import com.inventory.model.MouldModel;
import com.inventory.model.RawModel;

import javax.swing.JTextField;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JTable;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;

33
import java.util.Date;
import java.util.List;
import java.util.Vector;

import javax.swing.JButton;
import javax.swing.ImageIcon;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JScrollPane;

public class ComponentMaster extends JFrame {

private JPanel contentPane;


private JTextField comName;
private JTextField comPartno;

private JTextField comPartCode;


private JTextField hsnCode;
private JTextField norm1;
private JTextField from1;
private JTextField to1;
private JTextField to2;
private JTextField from2;
private JTextField norm2;
private JTextField norm3;
private JTextField from3;
private JTextField to3;
private JTextField aValue;
private JTextField amFrom;
private JTextField amQty;
private JTextField norm4;
private JTextField from4;
private JTextField to4;
private JLabel lblFettlingRate;
private JTextField fRate;
private JLabel lblPackagingMode;
private JComboBox packMode;
private JLabel lblNoOfCavities;
private JTextField noCav;
private JLabel lblMouldCode;
private JComboBox mouldCombo;
private JLabel mouldName;
private JTable table;

34
private JComboBox cusCombo;
private JComboBox rawCombo;
private JButton button;
private JButton button_1;
private JButton button_2;
private JLabel rawName;
private JLabel cusName;
private JScrollPane scrollPane;

/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
ComponentMaster frame = new
ComponentMaster();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}

public ComponentMaster() {
setTitle("Component Master");
addWindowListener(new WindowAdapter() {
@Override
public void windowOpened(WindowEvent arg0) {

// CustomerModel customerModel = new


CustomerModel();

SessionFactory sessionFactory = new


Configuration().configure().buildSessionFactory();
Session session = sessionFactory.openSession();
session.beginTransaction();
List<CustomerModel> products =
session.createQuery(" from CustomerModel ").list();
// System.out.println(customerModel.get());

35
DefaultComboBoxModel coModel =
(DefaultComboBoxModel) cusCombo.getModel();

for (CustomerModel customerModel1 : products) {

coModel.addElement(customerModel1.getCode());

cusCombo.setModel(coModel);

/*
* session.getTransaction().commit(); //session.flush();
* session.close(); sessionFactory.close();
*
*
* SessionFactory sessionFactory1 = new
* Configuration().configure().buildSessionFactory();
Session
* session1 = sessionFactory1.openSession();
* session1.beginTransaction();
*/
List<RawModel> raw = session.createQuery(" from
RawModel ").list();
// System.out.println(customerModel.get());
DefaultComboBoxModel model =
(DefaultComboBoxModel) rawCombo.getModel();

// DefaultComboBoxModel
model=(DefaultComboBoxModel)
// comboBox.getModel();
// coModel.removeAllElements();
for (RawModel rawModel : raw) {
// System.out.println("helllo");
model.addElement(rawModel.getCode());

rawCombo.setModel(model);

List<MouldModel> mould = session.createQuery("


from MouldModel ").list();

36
// System.out.println(customerModel.get());
DefaultComboBoxModel model1 =
(DefaultComboBoxModel) mouldCombo.getModel();

for (MouldModel mouldModel : mould) {


// System.out.println("helllo");

model1.addElement(mouldModel.getMouldCode());

mouldCombo.setModel(model1);

session.getTransaction().commit();
// session.flush();
session.close();
sessionFactory.close();

@Override
public void windowClosed(WindowEvent arg0) {

Home home = new Home();

}
});

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 998, 772);
contentPane = new JPanel();
contentPane.setBackground(SystemColor.control);
contentPane.setBorder(new EmptyBorder(0, 0, 0, 0));
setContentPane(contentPane);
contentPane.setLayout(null);

JLabel lblNewLabel = new JLabel("Customer");


lblNewLabel.setFont(new Font("Times New Roman", Font.BOLD,
14));
lblNewLabel.setBounds(41, 69, 61, 17);
contentPane.add(lblNewLabel);

cusCombo = new JComboBox();

37
cusCombo.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {

SessionFactory sessionFactory = new


Configuration().configure().buildSessionFactory();
Session session = sessionFactory.openSession();
session.beginTransaction();
String co = cusCombo.getSelectedItem().toString();
CustomerModel customerModel = (CustomerModel)
session.get(CustomerModel.class, co);

cusName.setText(customerModel.getName());

session.getTransaction().commit();
session.close();
sessionFactory.close();

}
});
cusCombo.setBackground(SystemColor.window);
cusCombo.setBounds(211, 68, 86, 20);
contentPane.add(cusCombo);

cusName = new JLabel("");


cusName.setFont(new Font("Monospaced", Font.PLAIN, 14));
cusName.setBackground(Color.WHITE);
cusName.setBounds(334, 64, 280, 22);
contentPane.add(cusName);

JLabel lblRaw = new JLabel("Raw");


lblRaw.setFont(new Font("Times New Roman", Font.BOLD, 14));
lblRaw.setBounds(41, 112, 61, 17);
contentPane.add(lblRaw);

rawCombo = new JComboBox();


rawCombo.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {

SessionFactory sessionFactory = new


Configuration().configure().buildSessionFactory();
Session session = sessionFactory.openSession();
session.beginTransaction();

38
RawModel rawModel = (RawModel)
session.get(RawModel.class, rawCombo.getSelectedItem().toString());
rawName.setText(rawModel.getDes());
session.getTransaction().commit();
session.close();
sessionFactory.close();

}
});
rawCombo.setBackground(Color.WHITE);
rawCombo.setBounds(211, 111, 86, 20);
contentPane.add(rawCombo);

rawName = new JLabel("");


rawName.setFont(new Font("Monospaced", Font.PLAIN, 14));
rawName.setBackground(Color.WHITE);
rawName.setBounds(334, 109, 280, 20);
contentPane.add(rawName);

JLabel lblNewLabel_2 = new JLabel("Component Name");


lblNewLabel_2.setFont(new Font("Times New Roman",
Font.BOLD, 14));
lblNewLabel_2.setBounds(41, 154, 110, 17);
contentPane.add(lblNewLabel_2);

comName = new JTextField();


comName.setFont(new Font("Monospaced", Font.PLAIN, 14));
comName.setBounds(211, 148, 323, 28);
contentPane.add(comName);
comName.setColumns(10);

JLabel lblComponent = new JLabel(" Comonent's Part No");


lblComponent.setFont(new Font("Times New Roman",
Font.BOLD, 14));
lblComponent.setBounds(35, 191, 128, 17);
contentPane.add(lblComponent);

comPartno = new JTextField();


comPartno.setFont(new Font("Monospaced", Font.PLAIN, 14));
comPartno.setColumns(10);
comPartno.setBounds(211, 187, 261, 28);
contentPane.add(comPartno);

39
JLabel lblPartCode = new JLabel("Part Code");
lblPartCode.setFont(new Font("Times New Roman", Font.BOLD,
14));
lblPartCode.setBounds(482, 191, 61, 17);
contentPane.add(lblPartCode);

comPartCode = new JTextField();


comPartCode.setFont(new Font("Monospaced", Font.PLAIN, 14));
comPartCode.setColumns(10);
comPartCode.setBounds(553, 185, 261, 28);
contentPane.add(comPartCode);

JLabel lblHsnsacCode = new JLabel("HSN/SAC Code");


lblHsnsacCode.setFont(new Font("Times New Roman",
Font.BOLD, 14));
lblHsnsacCode.setBounds(41, 232, 110, 17);
contentPane.add(lblHsnsacCode);

hsnCode = new JTextField();


hsnCode.setFont(new Font("Monospaced", Font.PLAIN, 14));
hsnCode.setColumns(10);
hsnCode.setBounds(211, 226, 261, 28);
contentPane.add(hsnCode);

JLabel lblNormsWeight = new JLabel("Norms Weight");


lblNormsWeight.setFont(new Font("Times New Roman",
Font.BOLD, 14));
lblNormsWeight.setBounds(41, 281, 110, 17);
contentPane.add(lblNormsWeight);

JLabel lblFromDate = new JLabel("From Date");


lblFromDate.setFont(new Font("Times New Roman", Font.BOLD,
14));
lblFromDate.setBounds(206, 281, 110, 17);
contentPane.add(lblFromDate);

JLabel lblToDate = new JLabel("To Date");


lblToDate.setFont(new Font("Times New Roman", Font.BOLD,
14));
lblToDate.setBounds(351, 281, 110, 17);
contentPane.add(lblToDate);

norm1 = new JTextField();

40
norm1.setText("0");
norm1.setFont(new Font("Monospaced", Font.PLAIN, 14));
norm1.setColumns(10);
norm1.setBounds(48, 314, 115, 28);
contentPane.add(norm1);

from1 = new JTextField();


from1.setText("00/00/0000");
from1.setFont(new Font("Monospaced", Font.PLAIN, 14));
from1.setColumns(10);
from1.setBounds(194, 314, 115, 28);
contentPane.add(from1);

to1 = new JTextField();


to1.setText("00/00/0000");
to1.setFont(new Font("Monospaced", Font.PLAIN, 14));
to1.setColumns(10);
to1.setBounds(351, 314, 115, 28);
contentPane.add(to1);

to2 = new JTextField();


to2.setFont(new Font("Monospaced", Font.PLAIN, 14));
to2.setColumns(10);
to2.setBounds(351, 353, 115, 28);
contentPane.add(to2);

from2 = new JTextField();


from2.setFont(new Font("Monospaced", Font.PLAIN, 14));
from2.setColumns(10);
from2.setBounds(194, 358, 115, 28);
contentPane.add(from2);

norm2 = new JTextField();


norm2.setFont(new Font("Monospaced", Font.PLAIN, 14));
norm2.setColumns(10);
norm2.setBounds(48, 353, 115, 28);
contentPane.add(norm2);

norm3 = new JTextField();


norm3.setFont(new Font("Monospaced", Font.PLAIN, 14));
norm3.setColumns(10);
norm3.setBounds(48, 397, 115, 28);
contentPane.add(norm3);

41
from3 = new JTextField();
from3.setFont(new Font("Monospaced", Font.PLAIN, 14));
from3.setColumns(10);
from3.setBounds(194, 397, 115, 28);
contentPane.add(from3);

to3 = new JTextField();


to3.setFont(new Font("Monospaced", Font.PLAIN, 14));
to3.setColumns(10);
to3.setBounds(351, 396, 115, 28);
contentPane.add(to3);

JLabel lblAmortiosationValuepercomponent = new


JLabel("Amortiosation Value (PerComponent)");
lblAmortiosationValuepercomponent.setFont(new Font("Times
New Roman", Font.BOLD, 14));
lblAmortiosationValuepercomponent.setBounds(21, 489, 234, 17);
contentPane.add(lblAmortiosationValuepercomponent);

aValue = new JTextField();


aValue.setFont(new Font("Monospaced", Font.PLAIN, 14));
aValue.setColumns(10);
aValue.setBounds(265, 487, 115, 20);
contentPane.add(aValue);

JLabel lblAmortiosationFromDate = new JLabel("Amortiosation


From Date");
lblAmortiosationFromDate.setFont(new Font("Times New
Roman", Font.BOLD, 14));
lblAmortiosationFromDate.setBounds(390, 489, 163, 17);
contentPane.add(lblAmortiosationFromDate);

amFrom = new JTextField();


amFrom.setFont(new Font("Monospaced", Font.PLAIN, 14));
amFrom.setColumns(10);
amFrom.setBounds(563, 487, 115, 20);
contentPane.add(amFrom);

JLabel lblAmortiosationQty = new JLabel("Amortiosation Qty");


lblAmortiosationQty.setFont(new Font("Times New Roman",
Font.BOLD, 14));
lblAmortiosationQty.setBounds(688, 489, 115, 17);

42
contentPane.add(lblAmortiosationQty);

amQty = new JTextField();


amQty.setFont(new Font("Monospaced", Font.PLAIN, 14));
amQty.setColumns(10);
amQty.setBounds(813, 487, 128, 20);
contentPane.add(amQty);

norm4 = new JTextField();


norm4.setFont(new Font("Monospaced", Font.PLAIN, 14));
norm4.setColumns(10);
norm4.setBounds(48, 436, 115, 28);
contentPane.add(norm4);

from4 = new JTextField();


from4.setFont(new Font("Monospaced", Font.PLAIN, 14));
from4.setColumns(10);
from4.setBounds(194, 435, 115, 28);
contentPane.add(from4);

to4 = new JTextField();


to4.setFont(new Font("Monospaced", Font.PLAIN, 14));
to4.setColumns(10);
to4.setBounds(351, 436, 115, 28);
contentPane.add(to4);

lblFettlingRate = new JLabel("Fettling Rate");


lblFettlingRate.setFont(new Font("Times New Roman",
Font.BOLD, 14));
lblFettlingRate.setBounds(21, 517, 81, 17);
contentPane.add(lblFettlingRate);

fRate = new JTextField();


fRate.setFont(new Font("Monospaced", Font.PLAIN, 14));
fRate.setColumns(10);
fRate.setBounds(123, 517, 115, 22);
contentPane.add(fRate);

lblPackagingMode = new JLabel("Packaging Mode");


lblPackagingMode.setFont(new Font("Times New Roman",
Font.BOLD, 14));
lblPackagingMode.setBounds(265, 518, 100, 17);
contentPane.add(lblPackagingMode);

43
packMode = new JComboBox();
packMode.setModel(new DefaultComboBoxModel(new String[]
{ "Tray", "Gunny Bag", "Box", "Bag" }));
packMode.setBackground(Color.WHITE);
packMode.setBounds(400, 516, 110, 20);
contentPane.add(packMode);

lblNoOfCavities = new JLabel("No Of Cavities");


lblNoOfCavities.setFont(new Font("Times New Roman",
Font.BOLD, 14));
lblNoOfCavities.setBounds(536, 517, 100, 17);
contentPane.add(lblNoOfCavities);

noCav = new JTextField();


noCav.setFont(new Font("Monospaced", Font.PLAIN, 14));
noCav.setColumns(10);
noCav.setBounds(646, 518, 115, 20);
contentPane.add(noCav);

lblMouldCode = new JLabel("Mould Code");


lblMouldCode.setFont(new Font("Times New Roman",
Font.BOLD, 14));
lblMouldCode.setBounds(21, 554, 100, 17);
contentPane.add(lblMouldCode);

mouldCombo = new JComboBox();


mouldCombo.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {

SessionFactory sessionFactory = new


Configuration().configure().buildSessionFactory();
Session session = sessionFactory.openSession();
session.beginTransaction();
MouldModel mouldModel = (MouldModel)
session.get(MouldModel.class,

mouldCombo.getSelectedItem().toString());
mouldName.setText(mouldModel.getMouldName());
session.getTransaction().commit();
session.close();
sessionFactory.close();

44
}
});
mouldCombo.setBackground(Color.WHITE);
mouldCombo.setBounds(123, 553, 132, 20);
contentPane.add(mouldCombo);
mouldName = new JLabel("");
mouldName.setFont(new Font("Monospaced", Font.PLAIN, 14));
mouldName.setBackground(Color.WHITE);
mouldName.setBounds(273, 556, 280, 20);
contentPane.add(mouldName);

scrollPane = new JScrollPane();


scrollPane.setBounds(35, 582, 814, 146);
contentPane.add(scrollPane);

table = new JTable();


scrollPane.setViewportView(table);

button = new JButton("Save");


button.addActionListener(new ActionListener() {

// to save

@SuppressWarnings("deprecation")
public void actionPerformed(ActionEvent arg0) {

SessionFactory sessionFactory = new


Configuration().configure().buildSessionFactory();
Session session = sessionFactory.openSession();
session.beginTransaction();

ComponentModel componentModel = new


ComponentModel();

// String date =
//
DateFormat.getDateInstance().format(amFrom.getText());

componentModel.setcCode(cusCombo.getSelectedItem().toString());
componentModel.setcName(cusName.getText());

componentModel.setRawCode(rawCombo.getSelectedItem().toString());

45
componentModel.setRawName(rawName.getText());

componentModel.setComponenetName(comName.getText());

componentModel.setCompPartno(Long.parseLong(comPartno.getText()));

componentModel.setPartCode(comPartCode.getText());
componentModel.setHsnCode(hsnCode.getText());
componentModel.setMouldCode(hsnCode.getText());
componentModel.setFrom1(new
Date(from1.getText()));

if (!from2.getText().isEmpty()) {
componentModel.setFrom2(new
Date(from2.getText()));
}

if (!from3.getText().isEmpty()) {
componentModel.setFrom3(new
Date(from3.getText()));
}

if (!from4.getText().isEmpty()) {
componentModel.setFrom4(new
Date(from4.getText()));
}

if (!to1.getText().isEmpty()) {
componentModel.setTo1(new
Date(to1.getText()));
}

if (!to2.getText().isEmpty()) {
componentModel.setTo2(new
Date(to2.getText()));
}

if (!to3.getText().isEmpty()) {
componentModel.setTo3(new
Date(to3.getText()));
}

46
if (!to4.getText().isEmpty()) {
componentModel.setTo4(new
Date(to4.getText()));
}

componentModel.setNorm1(Long.parseLong(norm1.getText()));

if (!norm2.getText().isEmpty()) {

componentModel.setNorm2(Long.parseLong(norm2.getText()));

}
if (!norm3.getText().isEmpty()) {

componentModel.setNorm3(Long.parseLong(norm3.getText()));
}
if (!norm4.getText().isEmpty()) {

componentModel.setNorm4(Long.parseLong(norm4.getText()));

}
// componentModel.setTo1(new Date(to1.getText()));

componentModel.setAmValue(Long.parseLong(aValue.getText()));
componentModel.setAmFrom(new
Date(amFrom.getText()));

componentModel.setAmQty(Long.parseLong(amQty.getText()));

componentModel.setFettlingRate(Long.parseLong(fRate.getText()));

componentModel.setNoCavities(Long.parseLong(noCav.getText()));

componentModel.setMouldCode(mouldCombo.getSelectedItem().toString());

componentModel.setMouldName(mouldName.getText());

componentModel.setPackMode(packMode.getSelectedItem().toString());

session.save(componentModel);
session.getTransaction().commit();

47
JOptionPane.showMessageDialog(null, "saved");
session.close();
sessionFactory.close();

SessionFactory sessionFactory1 = new


Configuration().configure().buildSessionFactory();
Session session1 = sessionFactory1.openSession();
session1.beginTransaction();

@SuppressWarnings("unchecked")
List<ComponentModel> products =
session1.createQuery("from ComponentModel").list();

Vector<String> tableHeaders = new


Vector<String>();
Vector tableData = new Vector();
tableHeaders.add("cuscode");
tableHeaders.add("cusname");
tableHeaders.add("rawcode");
tableHeaders.add("rawname");
tableHeaders.add("component name");
tableHeaders.add("component part no");
tableHeaders.add("partcode");
tableHeaders.add("hsn/sac code");
tableHeaders.add("norm 1");
tableHeaders.add("norm 2");
tableHeaders.add("norm 3");
tableHeaders.add("norm4");
tableHeaders.add("from date1");
tableHeaders.add("from date 2");
tableHeaders.add("from date 3");
tableHeaders.add("from date 4");
tableHeaders.add("to date 1");
tableHeaders.add("to datte 2");
tableHeaders.add("to date 3");
tableHeaders.add("to datte 4");
tableHeaders.add("amortisation value");
tableHeaders.add("amortisation from date");
tableHeaders.add("amortisation qty");
tableHeaders.add("fettling rate");
tableHeaders.add("packing mode");
tableHeaders.add("no of cavities");
tableHeaders.add("mould code");

48
tableHeaders.add("mould name");

// tableHeaders.add("name");
for (Object o : products) {
ComponentModel model = (ComponentModel)
o;
Vector<Object> oneRow = new
Vector<Object>();
oneRow.add(model.getcCode());
oneRow.add(model.getcName());
oneRow.add(model.getRawCode());
oneRow.add(model.getRawName());
oneRow.add(model.getComponenetName());
oneRow.add(model.getCompPartno());
oneRow.add(model.getPartCode());
oneRow.add(model.getHsnCode());
oneRow.add(model.getNorm1());
oneRow.add(model.getNorm2());
oneRow.add(model.getNorm3());
oneRow.add(model.getNorm4());
oneRow.add(model.getFrom1());
oneRow.add(model.getFrom2());
oneRow.add(model.getFrom3());
oneRow.add(model.getFrom4());
oneRow.add(model.getTo1());
oneRow.add(model.getTo2());
oneRow.add(model.getTo3());
oneRow.add(model.getTo4());

oneRow.add(model.getAmValue());
oneRow.add(model.getAmFrom());
oneRow.add(model.getAmQty());
oneRow.add(model.getFettlingRate());
oneRow.add(model.getPackMode());
oneRow.add(model.getNoCavities());
oneRow.add(model.getMouldCode());
oneRow.add(model.getMouldName());

tableData.add(oneRow);
}
table.setModel(new DefaultTableModel(tableData,
tableHeaders));
session1.getTransaction().commit();

49
session1.close();
sessionFactory1.close();
}
});
button.setIcon(new
ImageIcon(ComponentMaster.class.getResource("/inventory/save.png")));
button.setFont(new Font("Tahoma", Font.BOLD, 14));
button.setBounds(10, 0, 102, 29);
contentPane.add(button);

button_1 = new JButton("Update");


button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {

SessionFactory sessionFactory = new


Configuration().configure().buildSessionFactory();
Session session = sessionFactory.openSession();
session.beginTransaction();

ComponentModel componentModel = new


ComponentModel();

// String today = formatter.format(d);

componentModel.setcCode(cusCombo.getSelectedItem().toString());
componentModel.setcName(cusName.getText());

componentModel.setRawCode(rawCombo.getSelectedItem().toString());
componentModel.setRawName(rawName.getText());

componentModel.setComponenetName(comName.getText());

componentModel.setCompPartno(Long.parseLong(comPartno.getText()));

componentModel.setPartCode(comPartCode.getText());
componentModel.setHsnCode(hsnCode.getText());
componentModel.setMouldCode(hsnCode.getText());
/*
* Date str = new Date(from1.getText()); String
* s=from1.getText(); String newString = s.replace('/',
'X');
*
* componentModel.setFrom1(new Date();
50
*/
componentModel.setFrom1(new
Date(from1.getText()));
componentModel.setFrom2(new
Date(from2.getText()));
componentModel.setFrom3(new
Date(from3.getText()));
componentModel.setFrom4(new
Date(from4.getText()));

componentModel.setNorm1(Long.parseLong(norm1.getText()));

componentModel.setNorm2(Long.parseLong(norm2.getText()));

componentModel.setNorm3(Long.parseLong(norm3.getText()));

componentModel.setNorm4(Long.parseLong(norm4.getText()));
componentModel.setTo1(new Date(to1.getText()));
componentModel.setTo2(new Date(to2.getText()));
componentModel.setTo3(new Date(to3.getText()));
componentModel.setTo4(new Date(to4.getText()));

componentModel.setAmValue(Long.parseLong(aValue.getText()));
componentModel.setAmFrom(new
Date(amFrom.getText()));

componentModel.setAmQty(Long.parseLong(amQty.getText()));

componentModel.setFettlingRate(Long.parseLong(fRate.getText()));

componentModel.setNoCavities(Long.parseLong(noCav.getText()));

componentModel.setMouldCode(mouldCombo.getSelectedItem().toString());

componentModel.setMouldName(mouldName.getText());

componentModel.setPackMode(packMode.getSelectedItem().toString());

session.update(componentModel);
session.getTransaction().commit();
session.close();
sessionFactory.close();

51
SessionFactory sessionFactory1 = new
Configuration().configure().buildSessionFactory();
Session session1 = sessionFactory1.openSession();
session1.beginTransaction();

@SuppressWarnings("unchecked")
List<ComponentModel> products =
session1.createQuery("from ComponentModel").list();

Vector<String> tableHeaders = new


Vector<String>();
Vector tableData = new Vector();
tableHeaders.add("cuscode");
tableHeaders.add("cusname");
tableHeaders.add("rawcode");
tableHeaders.add("rawname");
tableHeaders.add("component name");
tableHeaders.add("component part no");
tableHeaders.add("partcode");
tableHeaders.add("hsn/sac code");
tableHeaders.add("norm 1");
tableHeaders.add("norm 2");
tableHeaders.add("norm 3");
tableHeaders.add("norm4");
tableHeaders.add("from date1");
tableHeaders.add("from date 2");
tableHeaders.add("from date 3");
tableHeaders.add("from date 4");
tableHeaders.add("to date 1");
tableHeaders.add("to datte 2");
tableHeaders.add("to date 3");
tableHeaders.add("to datte 4");
tableHeaders.add("amortisation value");
tableHeaders.add("amortisation from date");
tableHeaders.add("amortisation to date");
tableHeaders.add("fettling rate");
tableHeaders.add("packing mode");
tableHeaders.add("no of cavities");
tableHeaders.add("mould code");
tableHeaders.add("mould name");

// tableHeaders.add("name");
for (Object o : products) {

52
ComponentModel model = (ComponentModel)
o;
Vector<Object> oneRow = new
Vector<Object>();
oneRow.add(model.getcCode());

oneRow.add(model.getcName());
oneRow.add(model.getRawCode());
oneRow.add(model.getRawName());
oneRow.add(model.getComponenetName());
oneRow.add(model.getCompPartno());
oneRow.add(model.getPartCode());
oneRow.add(model.getHsnCode());
oneRow.add(model.getNorm1());
oneRow.add(model.getNorm2());
oneRow.add(model.getNorm3());
oneRow.add(model.getNorm4());
oneRow.add(model.getFrom1());
oneRow.add(model.getFrom2());
oneRow.add(model.getFrom3());
oneRow.add(model.getFrom4());
oneRow.add(model.getTo1());
oneRow.add(model.getTo2());
oneRow.add(model.getTo3());
oneRow.add(model.getTo4());

oneRow.add(model.getAmValue());
oneRow.add(model.getAmFrom());
oneRow.add(model.getAmQty());
oneRow.add(model.getFettlingRate());
oneRow.add(model.getPackMode());
oneRow.add(model.getNoCavities());
oneRow.add(model.getMouldCode());
oneRow.add(model.getMouldName());

tableData.add(oneRow);
}
table.setModel(new DefaultTableModel(tableData,
tableHeaders));
session1.close();
sessionFactory1.close();

53
});
button_1.setIcon(new
ImageIcon(ComponentMaster.class.getResource("/inventory/view all.png")));
button_1.setFont(new Font("Tahoma", Font.BOLD, 14));
button_1.setBounds(112, 0, 116, 29);
contentPane.add(button_1);

button_2 = new JButton("Delete");


button_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {

SessionFactory sessionFactory = new


Configuration().configure().buildSessionFactory();
Session session = sessionFactory.openSession();
session.beginTransaction();
ComponentModel componentModel = new
ComponentModel();

componentModel.setPartCode(comPartCode.getText());
session.delete(componentModel);
session.getTransaction().commit();
session.close();
sessionFactory.close();

SessionFactory sessionFactory1 = new


Configuration().configure().buildSessionFactory();
Session session1 = sessionFactory1.openSession();
session1.beginTransaction();

@SuppressWarnings("unchecked")
List<ComponentModel> products =
session1.createQuery("from ComponentModel").list();

Vector<String> tableHeaders = new


Vector<String>();
Vector tableData = new Vector();
tableHeaders.add("cuscode");
tableHeaders.add("cusname");
tableHeaders.add("rawcode");
tableHeaders.add("rawname");
tableHeaders.add("component name");
tableHeaders.add("component part no");
tableHeaders.add("partcode");

54
tableHeaders.add("hsn/sac code");
tableHeaders.add("norm 1");
tableHeaders.add("norm 2");
tableHeaders.add("norm 3");
tableHeaders.add("norm4");
tableHeaders.add("from date1");
tableHeaders.add("from date 2");
tableHeaders.add("from date 3");
tableHeaders.add("from date 4");
tableHeaders.add("to date 1");
tableHeaders.add("to datte 2");
tableHeaders.add("to date 3");
tableHeaders.add("to datte 4");
tableHeaders.add("amortisation value");
tableHeaders.add("amortisation from date");
tableHeaders.add("amortisation qty");
tableHeaders.add("fettling rate");
tableHeaders.add("packing mode");
tableHeaders.add("no of cavities");
tableHeaders.add("mould code");
tableHeaders.add("mould name");

// tableHeaders.add("name");
for (Object o : products) {
ComponentModel model = (ComponentModel)
o;
Vector<Object> oneRow = new
Vector<Object>();
oneRow.add(model.getcCode());
oneRow.add(model.getcName());
oneRow.add(model.getRawCode());
oneRow.add(model.getRawName());
oneRow.add(model.getComponenetName());
oneRow.add(model.getCompPartno());
oneRow.add(model.getPartCode());
oneRow.add(model.getHsnCode());
oneRow.add(model.getNorm1());
oneRow.add(model.getNorm2());
oneRow.add(model.getNorm3());
oneRow.add(model.getNorm4());
oneRow.add(model.getFrom1());
oneRow.add(model.getFrom2());
oneRow.add(model.getFrom3());

55
oneRow.add(model.getFrom4());
oneRow.add(model.getTo1());
oneRow.add(model.getTo2());
oneRow.add(model.getTo3());
oneRow.add(model.getTo4());

oneRow.add(model.getAmValue());
oneRow.add(model.getAmFrom());
oneRow.add(model.getAmQty());
oneRow.add(model.getFettlingRate());
oneRow.add(model.getPackMode());
oneRow.add(model.getNoCavities());
oneRow.add(model.getMouldCode());
oneRow.add(model.getMouldName());

tableData.add(oneRow);
}
table.setModel(new DefaultTableModel(tableData,
tableHeaders));
session1.getTransaction().commit();
session1.close();
sessionFactory1.close();
}
});
button_2.setIcon(new
ImageIcon(ComponentMaster.class.getResource("/inventory/delete.png")));
button_2.setFont(new Font("Tahoma", Font.BOLD, 14));
button_2.setBounds(228, 0, 102, 29);
contentPane.add(button_2);

JButton btnNewButton = new JButton("View All");


btnNewButton.setIcon(new
ImageIcon(ComponentMaster.class.getResource("/inventory/view all.png")));
btnNewButton.setFont(new Font("Tahoma", Font.BOLD, 14));
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {

SessionFactory sessionFactory = new


Configuration().configure().buildSessionFactory();
Session session = sessionFactory.openSession();
session.beginTransaction();

@SuppressWarnings("unchecked")

56
List<ComponentModel> products =
session.createQuery("from ComponentModel").list();

Vector<String> tableHeaders = new


Vector<String>();
Vector tableData = new Vector();
tableHeaders.add("cuscode");
tableHeaders.add("cusname");
tableHeaders.add("rawcode");
tableHeaders.add("rawname");
tableHeaders.add("component name");
tableHeaders.add("component part no");
tableHeaders.add("partcode");
tableHeaders.add("hsn/sac code");
tableHeaders.add("norm 1");
tableHeaders.add("norm 2");
tableHeaders.add("norm 3");
tableHeaders.add("norm4");
tableHeaders.add("from date1");
tableHeaders.add("from date 2");
tableHeaders.add("from date 3");
tableHeaders.add("from date 4");
tableHeaders.add("to date 1");
tableHeaders.add("to datte 2");
tableHeaders.add("to date 3");
tableHeaders.add("to datte 4");
tableHeaders.add("amortisation value");
tableHeaders.add("amortisation from date");
tableHeaders.add("amortisation to date");
tableHeaders.add("fettling rate");
tableHeaders.add("packing mode");
tableHeaders.add("no of cavities");
tableHeaders.add("mould code");
tableHeaders.add("mould name");

// tableHeaders.add("name");
for (Object o : products) {
ComponentModel model = (ComponentModel)
o;
Vector<Object> oneRow = new
Vector<Object>();
oneRow.add(model.getcCode());
oneRow.add(model.getcName());

57
oneRow.add(model.getRawCode());
oneRow.add(model.getRawName());
oneRow.add(model.getComponenetName());
oneRow.add(model.getCompPartno());
oneRow.add(model.getPartCode());
oneRow.add(model.getHsnCode());
oneRow.add(model.getNorm1());
oneRow.add(model.getNorm2());
oneRow.add(model.getNorm3());
oneRow.add(model.getNorm4());
oneRow.add(model.getFrom1());
oneRow.add(model.getFrom2());
oneRow.add(model.getFrom3());
oneRow.add(model.getFrom4());
oneRow.add(model.getTo1());
oneRow.add(model.getTo2());
oneRow.add(model.getTo3());
oneRow.add(model.getTo4());

oneRow.add(model.getAmValue());
oneRow.add(model.getAmFrom());
oneRow.add(model.getAmQty());
oneRow.add(model.getFettlingRate());
oneRow.add(model.getPackMode());
oneRow.add(model.getNoCavities());
oneRow.add(model.getMouldCode());
oneRow.add(model.getMouldName());

tableData.add(oneRow);
}
table.setModel(new DefaultTableModel(tableData,
tableHeaders));
session.getTransaction().commit();
session.close();
sessionFactory.close();

}
});
btnNewButton.setBounds(334, 0, 109, 29);
contentPane.add(btnNewButton);

JButton btnNewButton_1 = new JButton("");


btnNewButton_1.addActionListener(new ActionListener() {

58
public void actionPerformed(ActionEvent e) throws
java.lang.NullPointerException {

DefaultTableModel model = (DefaultTableModel)


table.getModel();
int index = table.getSelectedRow();

cusCombo.setSelectedItem(model.getValueAt(index,
0).toString());
cusName.setText(model.getValueAt(index,
1).toString());
rawCombo.setSelectedItem(model.getValueAt(index,
2).toString());
rawName.setText(model.getValueAt(index,
3).toString());
comName.setText(model.getValueAt(index,
4).toString());
comPartno.setText(model.getValueAt(index,
5).toString());

comPartCode.setText(model.getValueAt(index,
6).toString());
hsnCode.setText(model.getValueAt(index,
7).toString());

norm1.setText(model.getValueAt(index,
8).toString());
norm2.setText(model.getValueAt(index,
9).toString());
norm3.setText(model.getValueAt(index,
10).toString());
norm4.setText(model.getValueAt(index,
11).toString());

String str = model.getValueAt(index, 12).toString();


// String s=from1.getText();
String from = str.replace('-', '/');
// model.getValueAt(index, 12)(new
Date(newString));
from1.setText(from);

String str1 = model.getValueAt(index, 13).toString();


// String s=from1.getText();

59
String from12 = str1.replace('-', '/');
from2.setText(from12);

String str2 = model.getValueAt(index, 14).toString();


// String s=from1.getText();
String from13 = str2.replace('-', '/');
from3.setText(from13);

String str3 = model.getValueAt(index, 15).toString();


// String s=from1.getText();
String from14 = str3.replace('-', '/');
from4.setText(from14);

String str4 = model.getValueAt(index, 16).toString();


// String s=from1.getText();
String from15 = str4.replace('-', '/');
to1.setText(from15);

String str5 = model.getValueAt(index, 17).toString();


// String s=from1.getText();
String from16 = str5.replace('-', '/');
to2.setText(from16);

String str6 = model.getValueAt(index, 18).toString();


// String s=from1.getText();
String from17 = str6.replace('-', '/');
to3.setText(from17);

String str7 = model.getValueAt(index, 19).toString();


// String s=from1.getText();
String from18 = str7.replace('-', '/');
to4.setText(from18);

aValue.setText(model.getValueAt(index,
20).toString());

String str8 = model.getValueAt(index, 21).toString();


// String s=from1.getText();
String from8 = str8.replace('-', '/');
amFrom.setText(from8);
amQty.setText(model.getValueAt(index,
22).toString());

60
fRate.setText(model.getValueAt(index,
23).toString());
packMode.setSelectedItem(model.getValueAt(index,
24).toString());

noCav.setText(model.getValueAt(index,
25).toString());

mouldCombo.setSelectedItem(model.getValueAt(index, 26).toString());
mouldName.setText(model.getValueAt(index,
27).toString());
// session.getTransaction().commit();
// session.close();
// sessionFactory.close();
}
});
btnNewButton_1.setIcon(new
ImageIcon(ComponentMaster.class.getResource("/inventory/viw.png")));
btnNewButton_1.setBounds(863, 661, 89, 40);
contentPane.add(btnNewButton_1);
}
}

Customer Detail

package com.inventory.frames;

import java.awt.Component;
import java.awt.EventQueue;

import javax.swing.JFrame;
import java.awt.FlowLayout;
import javax.swing.JLabel;
import com.jgoodies.forms.layout.FormLayout;
import com.inventory.model.CustomerModel;
import com.jgoodies.forms.layout.ColumnSpec;
import com.jgoodies.forms.layout.RowSpec;

import net.proteanit.sql.DbUtils;

import com.jgoodies.forms.layout.FormSpecs;

61
import java.awt.Font;
import javax.swing.JTextField;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
//import org.hibernate.mapping.List;

import javax.swing.JTextArea;
import javax.swing.JScrollBar;
import javax.swing.JSeparator;
import javax.swing.JTable;

import java.awt.event.ActionListener;
import java.util.List;
import java.util.Vector;
import java.awt.event.ActionEvent;

import javax.persistence.Query;
import javax.swing.JButton;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.ImageIcon;
import java.awt.Color;

public class CustomerForm {


public JTextArea address;
public JFrame frmCustomerDetail;
public JTextField code1;
public JTextField name;
public JTextField pincode;
public JTextField city;
public JTextField contact;
public JTextField designation;
public JTextField destination;
public JTextField office;

62
public JTextField fax;
public JTextField factory;
public JTextField mobile;
public JTextField pager;
public JTextField email;
public JTextField url;
public JTextField pan;
public JTextField ecc;
public JTextField gst;
public JTextField vendor;
public JTextField div;
public JTextField range;
public JTextField std;
private JTextField textField_15;
private final JSeparator separator_4 = new JSeparator();
private final JSeparator separator_5 = new JSeparator();
public JTextArea deliver;
public JTextArea remarks;
private JTable table;

/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
CustomerForm window = new
CustomerForm();
window.frmCustomerDetail.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}

/**
* Create the application.
*/
public CustomerForm() {
initialize();
}

63
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frmCustomerDetail = new JFrame();
frmCustomerDetail.getContentPane().setFont(new Font("Times
New Roman", Font.BOLD, 16));
frmCustomerDetail.setTitle("Customer Detail");
frmCustomerDetail.setBounds(250, 250, 931, 772);

frmCustomerDetail.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frmCustomerDetail.getContentPane().setLayout(null);

JLabel lblNewLabel = new JLabel("Code");


lblNewLabel.setFont(new Font("Times New Roman", Font.BOLD,
18));
lblNewLabel.setBounds(10, 50, 46, 14);
frmCustomerDetail.getContentPane().add(lblNewLabel);

JLabel lblNewLabel_1 = new JLabel("Name");


lblNewLabel_1.setFont(new Font("Times New Roman",
Font.BOLD, 18));
lblNewLabel_1.setBounds(10, 86, 46, 14);
frmCustomerDetail.getContentPane().add(lblNewLabel_1);

JLabel lblAddress = new JLabel("Address");


lblAddress.setFont(new Font("Times New Roman", Font.BOLD,
18));
lblAddress.setBounds(10, 125, 62, 22);
frmCustomerDetail.getContentPane().add(lblAddress);

JLabel lblCity = new JLabel("City");


lblCity.setFont(new Font("Times New Roman", Font.BOLD, 18));
lblCity.setBounds(343, 221, 46, 22);
frmCustomerDetail.getContentPane().add(lblCity);

JLabel lblPincode = new JLabel("PinCode");


lblPincode.setFont(new Font("Times New Roman", Font.BOLD,
18));
lblPincode.setBounds(568, 225, 73, 14);
frmCustomerDetail.getContentPane().add(lblPincode);

64
JLabel lblContact = new JLabel("Contact");
lblContact.setFont(new Font("Times New Roman", Font.BOLD,
18));
lblContact.setBounds(10, 221, 73, 14);
frmCustomerDetail.getContentPane().add(lblContact);

JLabel lblDesignation = new JLabel("Designation");


lblDesignation.setFont(new Font("Times New Roman",
Font.BOLD, 18));
lblDesignation.setBounds(20, 269, 98, 22);
frmCustomerDetail.getContentPane().add(lblDesignation);

code1 = new JTextField();


code1.setFont(new Font("Monospaced", Font.PLAIN, 16));
lblNewLabel.setLabelFor(code1);
code1.setBounds(115, 48, 62, 20);
frmCustomerDetail.getContentPane().add(code1);
code1.setColumns(10);

name = new JTextField();


name.setFont(new Font("Monospaced", Font.PLAIN, 16));
lblNewLabel_1.setLabelFor(name);
name.setBounds(115, 86, 234, 29);
frmCustomerDetail.getContentPane().add(name);
name.setColumns(10);

JTextArea textArea = new JTextArea();


textArea.setBounds(115, 114, 175, -52);
frmCustomerDetail.getContentPane().add(textArea);

pincode = new JTextField();


pincode.setFont(new Font("Times New Roman", Font.PLAIN,
16));
lblPincode.setLabelFor(pincode);
pincode.setBounds(651, 219, 98, 29);
frmCustomerDetail.getContentPane().add(pincode);
pincode.setColumns(10);

city = new JTextField();


city.setFont(new Font("Monospaced", Font.PLAIN, 16));
lblCity.setLabelFor(city);
city.setColumns(10);

65
city.setBounds(399, 217, 159, 26);
frmCustomerDetail.getContentPane().add(city);

contact = new JTextField();


contact.setFont(new Font("Monospaced", Font.PLAIN, 16));
lblContact.setLabelFor(contact);
contact.setColumns(10);
contact.setBounds(115, 215, 193, 29);
frmCustomerDetail.getContentPane().add(contact);

designation = new JTextField();


designation.setFont(new Font("Monospaced", Font.PLAIN, 16));
lblDesignation.setLabelFor(designation);
designation.setColumns(10);
designation.setBounds(118, 267, 204, 29);
frmCustomerDetail.getContentPane().add(designation);

JTextArea address = new JTextArea();


address.setFont(new Font("Monospaced", Font.PLAIN, 14));
lblAddress.setLabelFor(address);
address.setLineWrap(true);
address.setBounds(109, 125, 240, 53);
frmCustomerDetail.getContentPane().add(address);

JSeparator separator = new JSeparator();


separator.setBounds(413, 50, 1, 225);
frmCustomerDetail.getContentPane().add(separator);

JLabel lblNewLabel_2 = new JLabel("Delivered To");


lblNewLabel_2.setFont(new Font("Times New Roman",
Font.BOLD, 18));
lblNewLabel_2.setBounds(413, 46, 99, 22);
frmCustomerDetail.getContentPane().add(lblNewLabel_2);

JTextArea deliver = new JTextArea();


deliver.setLineWrap(true);
deliver.setFont(new Font("Monospaced", Font.PLAIN, 16));
deliver.setBounds(522, 44, 311, 53);
frmCustomerDetail.getContentPane().add(deliver);

JLabel lblDestination = new JLabel("Destination");


lblDestination.setFont(new Font("Times New Roman",
Font.BOLD, 18));

66
lblDestination.setBounds(424, 113, 89, 22);
frmCustomerDetail.getContentPane().add(lblDestination);

destination = new JTextField();


destination.setFont(new Font("Monospaced", Font.PLAIN, 16));
destination.setBounds(542, 116, 222, 31);
frmCustomerDetail.getContentPane().add(destination);
destination.setColumns(10);

JLabel lblRemars = new JLabel("Remarks");


lblRemars.setFont(new Font("Times New Roman", Font.BOLD,
18));
lblRemars.setBounds(424, 162, 89, 22);
frmCustomerDetail.getContentPane().add(lblRemars);

JTextArea remarks = new JTextArea();


remarks.setLineWrap(true);
remarks.setFont(new Font("Monospaced", Font.PLAIN, 16));
remarks.setBounds(542, 157, 311, 53);
frmCustomerDetail.getContentPane().add(remarks);

JSeparator separator_1 = new JSeparator();


separator_1.setBounds(10, 322, 892, -5);
frmCustomerDetail.getContentPane().add(separator_1);

JSeparator separator_2 = new JSeparator();


separator_2.setBounds(10, 315, 854, -4);
frmCustomerDetail.getContentPane().add(separator_2);

JLabel lblOffice = new JLabel("Office");


lblOffice.setFont(new Font("Times New Roman", Font.BOLD,
18));
lblOffice.setBounds(10, 323, 47, 22);
frmCustomerDetail.getContentPane().add(lblOffice);

JLabel lblFax = new JLabel("Fax");


lblFax.setFont(new Font("Times New Roman", Font.BOLD, 18));
lblFax.setBounds(302, 323, 47, 22);
frmCustomerDetail.getContentPane().add(lblFax);

JLabel lblFactory = new JLabel("Factory");


lblFactory.setFont(new Font("Times New Roman", Font.BOLD,
18));

67
lblFactory.setBounds(519, 323, 59, 22);
frmCustomerDetail.getContentPane().add(lblFactory);

JLabel lblMobile = new JLabel("Mobile");


lblMobile.setFont(new Font("Times New Roman", Font.BOLD,
18));
lblMobile.setBounds(9, 372, 55, 22);
frmCustomerDetail.getContentPane().add(lblMobile);

JLabel lblPager = new JLabel("Pager");


lblPager.setFont(new Font("Times New Roman", Font.BOLD,
18));
lblPager.setBounds(302, 378, 47, 22);
frmCustomerDetail.getContentPane().add(lblPager);

office = new JTextField();


office.setFont(new Font("Monospaced", Font.PLAIN, 16));
office.setColumns(10);
office.setBounds(80, 326, 210, 29);
frmCustomerDetail.getContentPane().add(office);

fax = new JTextField();


fax.setFont(new Font("Monospaced", Font.PLAIN, 16));
fax.setColumns(10);
fax.setBounds(337, 322, 175, 29);
frmCustomerDetail.getContentPane().add(fax);

factory = new JTextField();


factory.setFont(new Font("Monospaced", Font.PLAIN, 16));
factory.setColumns(10);
factory.setBounds(588, 321, 234, 29);
frmCustomerDetail.getContentPane().add(factory);

mobile = new JTextField();


mobile.setFont(new Font("Monospaced", Font.PLAIN, 16));
mobile.setColumns(10);
mobile.setBounds(77, 370, 213, 29);
frmCustomerDetail.getContentPane().add(mobile);

pager = new JTextField();


pager.setFont(new Font("Monospaced", Font.PLAIN, 16));
pager.setColumns(10);
pager.setBounds(359, 375, 234, 29);

68
frmCustomerDetail.getContentPane().add(pager);

JLabel lblEmail = new JLabel("Email");


lblEmail.setFont(new Font("Times New Roman", Font.BOLD,
18));
lblEmail.setBounds(10, 434, 47, 22);
frmCustomerDetail.getContentPane().add(lblEmail);

JLabel lblUrl = new JLabel("URL");


lblUrl.setFont(new Font("Times New Roman", Font.BOLD, 18));
lblUrl.setBounds(367, 434, 47, 22);
frmCustomerDetail.getContentPane().add(lblUrl);

email = new JTextField();


email.setFont(new Font("Monospaced", Font.PLAIN, 16));
email.setColumns(10);
email.setBounds(77, 434, 245, 29);
frmCustomerDetail.getContentPane().add(email);

url = new JTextField();


url.setFont(new Font("Monospaced", Font.PLAIN, 16));
url.setColumns(10);
url.setBounds(447, 427, 375, 29);
frmCustomerDetail.getContentPane().add(url);

JLabel lblPanNo = new JLabel("PAN no");


lblPanNo.setFont(new Font("Times New Roman", Font.BOLD,
18));
lblPanNo.setBounds(10, 490, 69, 22);
frmCustomerDetail.getContentPane().add(lblPanNo);

pan = new JTextField();


pan.setFont(new Font("Times New Roman", Font.PLAIN, 16));
pan.setColumns(10);
pan.setBounds(77, 488, 245, 29);
frmCustomerDetail.getContentPane().add(pan);

JLabel lblEccCodeNo = new JLabel("E.C.C code no");


lblEccCodeNo.setFont(new Font("Times New Roman",
Font.BOLD, 18));
lblEccCodeNo.setBounds(10, 537, 113, 22);
frmCustomerDetail.getContentPane().add(lblEccCodeNo);

69
JLabel lblGstNo = new JLabel("GST no");
lblGstNo.setFont(new Font("Times New Roman", Font.BOLD,
18));
lblGstNo.setBounds(10, 570, 60, 22);
frmCustomerDetail.getContentPane().add(lblGstNo);

ecc = new JTextField();


ecc.setFont(new Font("Times New Roman", Font.PLAIN, 16));
ecc.setColumns(10);
ecc.setBounds(133, 535, 210, 29);
frmCustomerDetail.getContentPane().add(ecc);

gst = new JTextField();


gst.setFont(new Font("Times New Roman", Font.PLAIN, 16));
gst.setColumns(10);
gst.setBounds(92, 573, 245, 29);
frmCustomerDetail.getContentPane().add(gst);

JLabel lblVendorCode = new JLabel("Vendor code");


lblVendorCode.setFont(new Font("Times New Roman",
Font.BOLD, 18));
lblVendorCode.setBounds(377, 537, 99, 22);
frmCustomerDetail.getContentPane().add(lblVendorCode);

vendor = new JTextField();


vendor.setFont(new Font("Times New Roman", Font.PLAIN, 16));
vendor.setColumns(10);
vendor.setBounds(499, 534, 124, 29);
frmCustomerDetail.getContentPane().add(vendor);

JLabel lblDivision = new JLabel("Division");


lblDivision.setFont(new Font("Times New Roman", Font.BOLD,
18));
lblDivision.setBounds(633, 537, 99, 22);
frmCustomerDetail.getContentPane().add(lblDivision);

JLabel lblRange = new JLabel("Range");


lblRange.setFont(new Font("Times New Roman", Font.BOLD,
18));
lblRange.setBounds(387, 576, 99, 22);
frmCustomerDetail.getContentPane().add(lblRange);

div = new JTextField();

70
div.setFont(new Font("Times New Roman", Font.PLAIN, 16));
div.setColumns(10);
div.setBounds(727, 534, 124, 29);
frmCustomerDetail.getContentPane().add(div);

range = new JTextField();


range.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
}
});
range.setFont(new Font("Times New Roman", Font.PLAIN, 16));
range.setColumns(10);
range.setBounds(499, 573, 124, 29);
frmCustomerDetail.getContentPane().add(range);

JLabel lblSalesTaxDescription = new JLabel("Sales Tax


Description");
lblSalesTaxDescription.setFont(new Font("Times New Roman",
Font.BOLD, 18));
lblSalesTaxDescription.setBounds(350, 490, 167, 22);
frmCustomerDetail.getContentPane().add(lblSalesTaxDescription);

std = new JTextField();


std.setFont(new Font("Times New Roman", Font.PLAIN, 14));
std.setColumns(10);
std.setBounds(542, 490, 175, 29);
frmCustomerDetail.getContentPane().add(std);

textField_15 = new JTextField();


textField_15.setFont(new Font("Times New Roman", Font.PLAIN,
14));
textField_15.setColumns(10);
textField_15.setBounds(727, 490, 124, 29);
frmCustomerDetail.getContentPane().add(textField_15);

JSeparator separator_3 = new JSeparator();


separator_3.setBounds(10, 315, 930, -5);
frmCustomerDetail.getContentPane().add(separator_3);
separator_5.setBounds(10, 414, 867, 9);
frmCustomerDetail.getContentPane().add(separator_5);
separator_4.setBounds(6, 302, 879, 9);
frmCustomerDetail.getContentPane().add(separator_4);

71
JScrollPane scrollPane = new JScrollPane();
scrollPane.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent arg0) {

}
});
scrollPane.setBounds(10, 611, 879, 122);
frmCustomerDetail.getContentPane().add(scrollPane);

table = new JTable();


scrollPane.setViewportView(table);

JMenuItem mntmSave = new JMenuItem("save");


mntmSave.setIcon(new ImageIcon("C:\\Users\\Priya\\Pictures\\
inventory\\save.png"));
mntmSave.setFont(new Font("Arial", Font.BOLD, 14));
mntmSave.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {

SessionFactory sessionFactory = new


Configuration().configure().buildSessionFactory();
Session session = sessionFactory.openSession();
session.beginTransaction();
CustomerModel customerModel = new
CustomerModel();
customerModel.setAddress(address.getText());
customerModel.setCity(city.getText());
customerModel.setCode(code1.getText());

customerModel.setContact(Long.parseLong(contact.getText()));
customerModel.setDelivered(deliver.getText());

customerModel.setDesignation(designation.getText());
customerModel.setDestiation(destination.getText());
customerModel.setDiv(div.getText());
customerModel.setEcc(ecc.getText());
customerModel.setEmail(email.getText());

customerModel.setFactory(Long.parseLong(factory.getText()));
customerModel.setFax(Long.parseLong(fax.getText()));
customerModel.setGst(gst.getText());

72
customerModel.setMobile(Long.parseLong(mobile.getText()));
customerModel.setName(name.getText());

customerModel.setOffice(Long.parseLong(office.getText()));

customerModel.setPager(Long.parseLong(pager.getText()));
customerModel.setPan(pan.getText());

customerModel.setPinCode(Long.parseLong(pincode.getText()));
customerModel.setRange(range.getText());
customerModel.setRemarks(remarks.getText());
customerModel.setStd(std.getText());
customerModel.setUrl(url.getText());
customerModel.setVendor(vendor.getText());

if (address.getText().length() == 0) {

JOptionPane.showMessageDialog(null,
"valuue");
}
JOptionPane.showMessageDialog(null, "saved");
session.save(customerModel);

@SuppressWarnings("unchecked")
List<CustomerModel> products =
session.createQuery("from CustomerModel").list();

Vector<String> tableHeaders = new


Vector<String>();
Vector tableData = new Vector();
tableHeaders.add("code");
tableHeaders.add("name");
tableHeaders.add("address");
tableHeaders.add("city");
tableHeaders.add("contact");
tableHeaders.add("deliver");
tableHeaders.add("designation");
tableHeaders.add("destination");
tableHeaders.add("div");
tableHeaders.add("ecc");
tableHeaders.add("email");
tableHeaders.add("factory");

73
tableHeaders.add("fax");
tableHeaders.add("gst");
tableHeaders.add("pincode");
tableHeaders.add("remarks");
tableHeaders.add("office");
tableHeaders.add("mobile");
tableHeaders.add("pager");
tableHeaders.add("pan");
tableHeaders.add("std");
tableHeaders.add("url");
tableHeaders.add("vendor");
tableHeaders.add("range");

// tableHeaders.add("name");
for (Object o : products) {
CustomerModel model = (CustomerModel) o;
Vector<Object> oneRow = new
Vector<Object>();
oneRow.add(model.getCode());
oneRow.add(model.getName());
oneRow.add(model.getAddress());
oneRow.add(model.getCity());
oneRow.add(model.getContact());
oneRow.add(model.getDelivered());
oneRow.add(model.getDesignation());
oneRow.add(model.getDestiation());
oneRow.add(model.getDiv());
oneRow.add(model.getEcc());
oneRow.add(model.getEmail());
oneRow.add(model.getFactory());
oneRow.add(model.getFax());
oneRow.add(model.getGst());
oneRow.add(model.getPinCode());
oneRow.add(model.getRemarks());
oneRow.add(model.getOffice());
oneRow.add(model.getMobile());
oneRow.add(model.getPager());
oneRow.add(model.getPan());
oneRow.add(model.getStd());
oneRow.add(model.getUrl());
oneRow.add(model.getVendor());
oneRow.add(model.getRange());

74
tableData.add(oneRow);
}
table.setModel(new DefaultTableModel(tableData,
tableHeaders));
session.getTransaction().commit();
session.close();
sessionFactory.close();

}
});

// view all menu item button


mntmSave.setBounds(10, 4, 82, 26);
frmCustomerDetail.getContentPane().add(mntmSave);

JMenuItem mntmViewalll = new JMenuItem("view all customer");


mntmViewalll.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {

SessionFactory sessionFactory = new


Configuration().configure().buildSessionFactory();
Session session = sessionFactory.openSession();
session.beginTransaction();
// Query query = session.createQuery("from
CustomerModel");
// List<CustomerModel> customer =
session.createQuery("from
// Custom").list();
@SuppressWarnings("unchecked")
List<CustomerModel> products =
session.createQuery("from CustomerModel").list();

Vector<String> tableHeaders = new


Vector<String>();
Vector tableData = new Vector();
tableHeaders.add("code");
tableHeaders.add("name");
tableHeaders.add("address");
tableHeaders.add("city");
tableHeaders.add("contact");
tableHeaders.add("deliver");
tableHeaders.add("designation");
tableHeaders.add("destination");

75
tableHeaders.add("div");
tableHeaders.add("ecc");
tableHeaders.add("email");
tableHeaders.add("factory");
tableHeaders.add("fax");
tableHeaders.add("gst");
tableHeaders.add("pincode");
tableHeaders.add("remarks");
tableHeaders.add("office");
tableHeaders.add("mobile");
tableHeaders.add("pager");
tableHeaders.add("pan");
tableHeaders.add("std");
tableHeaders.add("url");
tableHeaders.add("vendor");
tableHeaders.add("range");

// tableHeaders.add("name");
for (Object o : products) {
CustomerModel model = (CustomerModel) o;
Vector<Object> oneRow = new
Vector<Object>();
oneRow.add(model.getCode());
oneRow.add(model.getName());
oneRow.add(model.getAddress());
oneRow.add(model.getCity());
oneRow.add(model.getContact());
oneRow.add(model.getDelivered());
oneRow.add(model.getDesignation());
oneRow.add(model.getDestiation());
oneRow.add(model.getDiv());
oneRow.add(model.getEcc());
oneRow.add(model.getEmail());
oneRow.add(model.getFactory());
oneRow.add(model.getFax());
oneRow.add(model.getGst());
oneRow.add(model.getPinCode());
oneRow.add(model.getRemarks());
oneRow.add(model.getOffice());
oneRow.add(model.getMobile());
oneRow.add(model.getPager());
oneRow.add(model.getPan());
oneRow.add(model.getStd());

76
oneRow.add(model.getUrl());
oneRow.add(model.getVendor());
oneRow.add(model.getRange());

tableData.add(oneRow);
}
table.setModel(new DefaultTableModel(tableData,
tableHeaders));
session.getTransaction().commit();
session.flush();
session.close();
sessionFactory.close();

}
});
mntmViewalll.setIcon(new
ImageIcon(CustomerForm.class.getResource("/inventory/view all.png")));
mntmViewalll.setFont(new Font("Arial", Font.BOLD, 14));
mntmViewalll.setBounds(92, 4, 198, 29);
frmCustomerDetail.getContentPane().add(mntmViewalll);

JMenuItem mntmUpdate = new JMenuItem("Update");


mntmUpdate.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {

SessionFactory sessionFactory = new


Configuration().configure().buildSessionFactory();
Session session = sessionFactory.openSession();
session.beginTransaction();
CustomerModel customerModel = new
CustomerModel();
customerModel.setAddress(address.getText());
customerModel.setCity(city.getText());
customerModel.setCode(code1.getText());

customerModel.setContact(Long.parseLong(contact.getText()));
customerModel.setDelivered(deliver.getText());

customerModel.setDesignation(designation.getText());
customerModel.setDestiation(destination.getText());
customerModel.setDiv(div.getText());
customerModel.setEcc(ecc.getText());
customerModel.setEmail(email.getText());

77
customerModel.setFactory(Long.parseLong(factory.getText()));

customerModel.setFax(Long.parseLong(fax.getText()));
customerModel.setGst(gst.getText());

customerModel.setMobile(Long.parseLong(mobile.getText()));
customerModel.setName(name.getText());

customerModel.setOffice(Long.parseLong(office.getText()));

customerModel.setPager(Long.parseLong(pager.getText()));
customerModel.setPan(pan.getText());

customerModel.setPinCode(Long.parseLong(pincode.getText()));
customerModel.setRange(range.getText());
customerModel.setRemarks(remarks.getText());
customerModel.setStd(std.getText());
customerModel.setUrl(url.getText());
customerModel.setVendor(vendor.getText());

session.update(customerModel);

session.getTransaction().commit();

@SuppressWarnings("unchecked")
List<CustomerModel> products =
session.createQuery("from CustomerModel").list();

Vector<String> tableHeaders = new


Vector<String>();
Vector tableData = new Vector();
tableHeaders.add("code");
tableHeaders.add("name");
tableHeaders.add("address");
tableHeaders.add("city");
tableHeaders.add("contact");
tableHeaders.add("deliver");
tableHeaders.add("designation");
tableHeaders.add("destination");
tableHeaders.add("div");
tableHeaders.add("ecc");
tableHeaders.add("email");
tableHeaders.add("factory");
78
tableHeaders.add("fax");
tableHeaders.add("gst");
tableHeaders.add("pincode");
tableHeaders.add("remarks");
tableHeaders.add("office");
tableHeaders.add("mobile");
tableHeaders.add("pager");
tableHeaders.add("pan");
tableHeaders.add("std");
tableHeaders.add("url");
tableHeaders.add("vendor");
tableHeaders.add("range");

// tableHeaders.add("name");
for (Object o : products) {
CustomerModel model = (CustomerModel) o;
Vector<Object> oneRow = new
Vector<Object>();
oneRow.add(model.getCode());
oneRow.add(model.getName());
oneRow.add(model.getAddress());
oneRow.add(model.getCity());
oneRow.add(model.getContact());
oneRow.add(model.getDelivered());
oneRow.add(model.getDesignation());
oneRow.add(model.getDestiation());
oneRow.add(model.getDiv());
oneRow.add(model.getEcc());
oneRow.add(model.getEmail());
oneRow.add(model.getFactory());
oneRow.add(model.getFax());
oneRow.add(model.getGst());
oneRow.add(model.getPinCode());
oneRow.add(model.getRemarks());
oneRow.add(model.getOffice());
oneRow.add(model.getMobile());
oneRow.add(model.getPager());
oneRow.add(model.getPan());
oneRow.add(model.getStd());
oneRow.add(model.getUrl());
oneRow.add(model.getVendor());
oneRow.add(model.getRange());

79
tableData.add(oneRow);
}
table.setModel(new DefaultTableModel(tableData,
tableHeaders));
JOptionPane.showMessageDialog(null, "updated");
// it will close the particular session after completing
the
// process
session.flush();
session.close();
sessionFactory.close();

}
});
mntmUpdate.setIcon(new
ImageIcon(CustomerForm.class.getResource("/inventory/update.png")));
mntmUpdate.setFont(new Font("Arial", Font.BOLD, 14));
mntmUpdate.setBounds(290, 4, 129, 29);
frmCustomerDetail.getContentPane().add(mntmUpdate);

JMenuItem mntmDelete = new JMenuItem("Delete");


mntmDelete.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
SessionFactory sessionFactory = new
Configuration().configure().buildSessionFactory();
Session session = sessionFactory.openSession();
session.beginTransaction();

CustomerModel customerModel = new


CustomerModel();
customerModel.setCode(code1.getText());
session.delete(customerModel);
session.getTransaction().commit();
@SuppressWarnings("unchecked")
List<CustomerModel> products =
session.createQuery("from CustomerModel").list();

Vector<String> tableHeaders = new


Vector<String>();
Vector tableData = new Vector();
tableHeaders.add("code");
tableHeaders.add("name");
tableHeaders.add("address");

80
tableHeaders.add("city");
tableHeaders.add("contact");
tableHeaders.add("deliver");
tableHeaders.add("designation");
tableHeaders.add("destination");
tableHeaders.add("div");
tableHeaders.add("ecc");
tableHeaders.add("email");
tableHeaders.add("factory");
tableHeaders.add("fax");
tableHeaders.add("gst");
tableHeaders.add("pincode");
tableHeaders.add("remarks");
tableHeaders.add("office");
tableHeaders.add("mobile");
tableHeaders.add("pager");
tableHeaders.add("pan");
tableHeaders.add("std");
tableHeaders.add("url");
tableHeaders.add("vendor");
tableHeaders.add("range");

// tableHeaders.add("name");
for (Object o : products) {
CustomerModel model = (CustomerModel) o;
Vector<Object> oneRow = new
Vector<Object>();
oneRow.add(model.getCode());
oneRow.add(model.getName());
oneRow.add(model.getAddress());
oneRow.add(model.getCity());
oneRow.add(model.getContact());
oneRow.add(model.getDelivered());
oneRow.add(model.getDesignation());
oneRow.add(model.getDestiation());
oneRow.add(model.getDiv());
oneRow.add(model.getEcc());
oneRow.add(model.getEmail());
oneRow.add(model.getFactory());
oneRow.add(model.getFax());
oneRow.add(model.getGst());
oneRow.add(model.getPinCode());
oneRow.add(model.getRemarks());

81
oneRow.add(model.getOffice());
oneRow.add(model.getMobile());
oneRow.add(model.getPager());
oneRow.add(model.getPan());
oneRow.add(model.getStd());
oneRow.add(model.getUrl());
oneRow.add(model.getVendor());
oneRow.add(model.getRange());

tableData.add(oneRow);
}
table.setModel(new DefaultTableModel(tableData,
tableHeaders));
session.close();
sessionFactory.close();

}
});
mntmDelete.setIcon(new
ImageIcon(CustomerForm.class.getResource("/inventory/delete.png")));
mntmDelete.setFont(new Font("Arial", Font.BOLD, 14));
mntmDelete.setBounds(413, 6, 129, 29);
frmCustomerDetail.getContentPane().add(mntmDelete);

JButton btnNewButton_2 = new JButton("New button");


btnNewButton_2.setIcon(new
ImageIcon(CustomerForm.class.getResource("/inventory/viw.png")));
btnNewButton_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {

table.getSelectedRow();

DefaultTableModel model = (DefaultTableModel)


table.getModel();
int index = table.getSelectedRow();

// populating selected row to textbox


// display customer data's to tables

code1.setText(model.getValueAt(index, 0).toString());
name.setText(model.getValueAt(index, 1).toString());
address.setText(model.getValueAt(index,
2).toString());

82
city.setText(model.getValueAt(index, 3).toString());
contact.setText(model.getValueAt(index,
4).toString());
deliver.setText(model.getValueAt(index,
5).toString());
designation.setText(model.getValueAt(index,
6).toString());
destination.setText(model.getValueAt(index,
7).toString());
div.setText(model.getValueAt(index, 8).toString());
ecc.setText(model.getValueAt(index, 9).toString());
email.setText(model.getValueAt(index,
10).toString());
factory.setText(model.getValueAt(index,
11).toString());
fax.setText(model.getValueAt(index, 12).toString());
gst.setText(model.getValueAt(index, 13).toString());
pincode.setText(model.getValueAt(index,
14).toString());
remarks.setText(model.getValueAt(index,
15).toString());
office.setText(model.getValueAt(index,
16).toString());
mobile.setText(model.getValueAt(index,
17).toString());
pager.setText(model.getValueAt(index,
18).toString());
pan.setText(model.getValueAt(index, 19).toString());
std.setText(model.getValueAt(index, 20).toString());
url.setText(model.getValueAt(index, 21).toString());
vendor.setText(model.getValueAt(index,
22).toString());
range.setText(model.getValueAt(index,
23).toString());

}
});
btnNewButton_2.setBounds(894, 655, 27, 53);
frmCustomerDetail.getContentPane().add(btnNewButton_2);

JSeparator separator_6 = new JSeparator();


separator_6.setBounds(10, 30, 617, -5);
frmCustomerDetail.getContentPane().add(separator_6);

83
JSeparator separator_7 = new JSeparator();
separator_7.setBounds(10, 30, 204, 0);
frmCustomerDetail.getContentPane().add(separator_7);

JSeparator separator_8 = new JSeparator();


separator_8.setBounds(10, 30, 756, 0);
frmCustomerDetail.getContentPane().add(separator_8);

JSeparator separator_9 = new JSeparator();


separator_9.setBounds(10, 37, 911, 2);
frmCustomerDetail.getContentPane().add(separator_9);

JLabel error1 = new JLabel("");


error1.setForeground(Color.RED);
error1.setFont(new Font("Tahoma", Font.PLAIN, 13));
error1.setBounds(343, 269, 458, 20);
frmCustomerDetail.getContentPane().add(error1);

JLabel label = new JLabel("");


label.setForeground(Color.RED);
label.setFont(new Font("Tahoma", Font.PLAIN, 13));
label.setBounds(603, 374, 289, 20);
frmCustomerDetail.getContentPane().add(label);

JLabel label_1 = new JLabel("");


label_1.setForeground(Color.RED);
label_1.setFont(new Font("Tahoma", Font.PLAIN, 13));
label_1.setBounds(632, 576, 258, 20);
frmCustomerDetail.getContentPane().add(label_1);
}

customerModel.setFax(Long.parseLong(fax.getText()));
customerModel.setGst(gst.getText());

customerModel.setMobile(Long.parseLong(mobile.getText()));
customerModel.setName(name.getText());

customerModel.setOffice(Long.parseLong(office.getText()));

84
customerModel.setPager(Long.parseLong(pager.getText()));
customerModel.setPan(pan.getText());

customerModel.setPinCode(Long.parseLong(pincode.getText()));
customerModel.setRange(range.getText());
customerModel.setRemarks(remarks.getText());
customerModel.setStd(std.getText());
customerModel.setUrl(url.getText());
customerModel.setVendor(vendor.getText());

if (address.getText().length() == 0) {

JOptionPane.showMessageDialog(null,
"valuue");
}
JOptionPane.showMessageDialog(null, "saved");
session.save(customerModel);

@SuppressWarnings("unchecked")
List<CustomerModel> products =
session.createQuery("from CustomerModel").list();

Vector<String> tableHeaders = new


Vector<String>();
Vector tableData = new Vector();
tableHeaders.add("code");
tableHeaders.add("name");
tableHeaders.add("address");
tableHeaders.add("city");
tableHeaders.add("contact");
tableHeaders.add("deliver");
tableHeaders.add("designation");
tableHeaders.add("destination");
tableHeaders.add("div");
tableHeaders.add("ecc");
tableHeaders.add("email");
tableHeaders.add("factory");
tableHeaders.add("fax");
tableHeaders.add("gst");
tableHeaders.add("pincode");
tableHeaders.add("remarks");
tableHeaders.add("office");

85
model = (CustomerModel) o;
Vector<Object> oneRow = new
Vector<Object>();
oneRow.add(model.getCode());
oneRow.add(model.getName());
oneRow.add(model.getAddress());
oneRow.add(model.getCity());
oneRow.add(model.getContact());
oneRow.add(model.getDelivered());
oneRow.add(model.getDesignation());
oneRow.add(model.getDestiation());
oneRow.add(model.getDiv());
oneRow.add(model.getEcc());
oneRow.add(model.getEmail());
oneRow.add(model.getFactory());
oneRow.add(model.getFax());
oneRow.add(model.getGst());
oneRow.add(model.getPinCode());
oneRow.add(model.getRemarks());
oneRow.add(model.getOffice());
oneRow.add(model.getMobile());
oneRow.add(model.getPager());
oneRow.add(model.getPan());
oneRow.add(model.getStd());
oneRow.add(model.getUrl());
oneRow.add(model.getVendor());
oneRow.add(model.getRange());

tableData.add(oneRow);
}
table.setModel(new DefaultTableModel(tableData,
tableHeaders));
session.getTransaction().commit();
session.close();
sessionFactory.close();

}
});

// view all menu item button


mntmSave.setBounds(10, 4, 82, 26);
frmCustomerDetail.getContentPane().add(mntmSave);

86
JMenuItem mntmViewalll = new JMenuItem("view all customer");
mntmViewalll.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {

SessionFactory sessionFactory = new


Configuration().configure().buildSessionFactory();
Session session = sessionFactory.openSession();
session.beginTransaction();
// Query query = session.createQuery("from
CustomerModel");
// List<CustomerModel> customer =
session.createQuery("from
// Custom").list();
@SuppressWarnings("unchecked")
List<CustomerModel> products =
session.createQuery("from CustomerModel").list();

Vector<String> tableHeaders = new


Vector<String>();
Vector tableData = new Vector();
tableHeaders.add("code");
tableHeaders.add("name");
tableHeaders.add("address");
tableHeaders.add("city");
tableHeaders.add("contact");
tableHeaders.add("deliver");
tableHeaders.add("designation");
tableHeaders.add("destination");
tableHeaders.add("div");
tableHeaders.add("ecc");
tableHeaders.add("email");
tableHeaders.add("factory");
tableHeaders.add("fax");
tableHeaders.add("gst");
tableHeaders.add("pincode");
tableHeaders.add("remarks");
tableHeaders.add("office");
tableHeaders.add("mobile");
tableHeaders.add("pager");
tableHeaders.add("pan");
tableHeaders.add("std");
tableHeaders.add("url");
tableHeaders.add("vendor");

87
tableHeaders.add("range");

// tableHeaders.add("name");
for (Object o : products) {
CustomerModel model = (CustomerModel) o;
Vector<Object> oneRow = new
Vector<Object>();
oneRow.add(model.getCode());
oneRow.add(model.getName());
oneRow.add(model.getAddress());
oneRow.add(model.getCity());
oneRow.add(model.getContact());
oneRow.add(model.getDelivered());
oneRow.add(model.getDesignation());
oneRow.add(model.getDestiation());
oneRow.add(model.getDiv());
oneRow.add(model.getEcc());
oneRow.add(model.getEmail());
oneRow.add(model.getFactory());
oneRow.add(model.getFax());
oneRow.add(model.getGst());
oneRow.add(model.getPinCode());
oneRow.add(model.getRemarks());
oneRow.add(model.getOffice());
oneRow.add(model.getMobile());
oneRow.add(model.getPager());
oneRow.add(model.getPan());
oneRow.add(model.getStd());
oneRow.add(model.getUrl());
oneRow.add(model.getVendor());
oneRow.add(model.getRange());

tableData.add(oneRow);
}
table.setModel(new DefaultTableModel(tableData,
tableHeaders));
session.getTransaction().commit();
session.flush();
session.close();
sessionFactory.close();

}
});

88
mntmViewalll.setIcon(new
ImageIcon(CustomerForm.class.getResource("/inventory/view all.png")));
mntmViewalll.setFont(new Font("Arial", Font.BOLD, 14));
mntmViewalll.setBounds(92, 4, 198, 29);
frmCustomerDetail.getContentPane().add(mntmViewalll);

JMenuItem mntmUpdate = new JMenuItem("Update");


mntmUpdate.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {

SessionFactory sessionFactory = new


Configuration().configure().buildSessionFactory();
Session session = sessionFactory.openSession();
session.beginTransaction();
CustomerModel customerModel = new
CustomerModel();
customerModel.setAddress(address.getText());
customerModel.setCity(city.getText());
customerModel.setCode(code1.getText());

customerModel.setContact(Long.parseLong(contact.getText()));
customerModel.setDelivered(deliver.getText());

customerModel.setDesignation(designation.getText());
customerModel.setDestiation(destination.getText());
customerModel.setDiv(div.getText());
customerModel.setEcc(ecc.getText());
customerModel.setEmail(email.getText());

customerModel.setFactory(Long.parseLong(factory.getText()));

customerModel.setFax(Long.parseLong(fax.getText()));
customerModel.setGst(gst.getText());

customerModel.setMobile(Long.parseLong(mobile.getText()));
customerModel.setName(name.getText());

customerModel.setOffice(Long.parseLong(office.getText()));

customerModel.setPager(Long.parseLong(pager.getText()));
customerModel.setPan(pan.getText());

customerModel.setPinCode(Long.parseLong(pincode.getText()));
customerModel.setRange(range.getText());

89
customerModel.setRemarks(remarks.getText());
customerModel.setStd(std.getText());
customerModel.setUrl(url.getText());
customerModel.setVendor(vendor.getText());

session.update(customerModel);

session.getTransaction().commit();

@SuppressWarnings("unchecked")
List<CustomerModel> products =
session.createQuery("from CustomerModel").list();

Vector<String> tableHeaders = new


Vector<String>();
Vector tableData = new Vector();
tableHeaders.add("code");
tableHeaders.add("name");
tableHeaders.add("address");
tableHeaders.add("city");
tableHeaders.add("contact");
tableHeaders.add("deliver");
tableHeaders.add("designation");
tableHeaders.add("destination");
tableHeaders.add("div");
tableHeaders.add("ecc");
tableHeaders.add("email");
tableHeaders.add("factory");
tableHeaders.add("fax");
tableHeaders.add("gst");
tableHeaders.add("pincode");
tableHeaders.add("remarks");
tableHeaders.add("office");
tableHeaders.add("mobile");
tableHeaders.add("pager");
tableHeaders.add("pan");
tableHeaders.add("std");
tableHeaders.add("url");
tableHeaders.add("vendor");
tableHeaders.add("range");

// tableHeaders.add("name");
for (Object o : products) {

90
CustomerModel model = (CustomerModel) o;
Vector<Object> oneRow = new
Vector<Object>();
oneRow.add(model.getCode());
oneRow.add(model.getName());
oneRow.add(model.getAddress());
oneRow.add(model.getCity());
oneRow.add(model.getContact());
oneRow.add(model.getDelivered());
oneRow.add(model.getDesignation());
oneRow.add(model.getDestiation());
oneRow.add(model.getDiv());
oneRow.add(model.getEcc());
oneRow.add(model.getEmail());
oneRow.add(model.getFactory());
oneRow.add(model.getFax());
oneRow.add(model.getGst());
oneRow.add(model.getPinCode());
oneRow.add(model.getRemarks());
oneRow.add(model.getOffice());
oneRow.add(model.getMobile());
oneRow.add(model.getPager());
oneRow.add(model.getPan());
oneRow.add(model.getStd());
oneRow.add(model.getUrl());
oneRow.add(model.getVendor());
oneRow.add(model.getRange());

tableData.add(oneRow);
}
table.setModel(new DefaultTableModel(tableData,
tableHeaders));
JOptionPane.showMessageDialog(null, "updated")
session.flush();
session.close();
sessionFactory.close();

}
});
}}

Logstash Configuring

91
9.2 SAMPLE SCREEN:
FORM DESIGN:

Login Page

92
Home Page:

Customer Form

93
Component Form

94
Purchase Order

Machine Master

9.2.1REPORTS:

95
If we store them in Elasticsearch, we can view and analyze them with Kibana. The Kibana
web interface is an adjustable dashboard that we can stretch out and change to suit our
surroundings. It permits tables and diagrams creation and in addition complex
representations. The Kibana web interface utilizes the Apache Lucene question linguistic
structure to permit us to make inquiries.
Flexible data modeling in elasticsearch means you can represent your data involving with two
different ways mimicking how application will consume. Example, adding a list of categories
in each document directly instead of maintaining multiple tables and creating complex
queries between those tables to determine document categories

Visualization report using ELK

96
97
CHAPTER XI
REFERENCES
BOOK REFERENCE

[1] Richard Fairley, “ Software Engineering Concepts” Tata McGraw Hill Edition, 2008
 
[2] Herbert Schildt, The Complete Reference – Java 2, 4 th Edition, Tata McGraw Hill, 2001
 
[3] Herbert Schildt, Dale Skrien, “Java Fundamentals – A Comprehensive Introduction”,
TataMc Graw Hill, 2013
 
[4] E Balagurusamy, “Object oriented Programming with Java”, edition, 2006, Tata McGraw
Hill
 
[5] Software Engineering A practitioner’s Approach. 6th edition –Roger Pressman. (Mcgraw-
hill international edition)
[6] Database System Concepts (4th Edition), By: Abraham Silberschatz, Henry F.Korth and
S.Sudarshan McGraw Hill Publication.
[7] Core Java volume I & II By: Cays Horstmann, Gary Cornell (7th edition) Pearson
Publication
[8] “Complete Reference for JAVA” By: Herbelt Schildt

 
Website Reference:
 
[1]https://www.tutorialspoint.com/java/
[2]https://www.H2.com/java/
[3]https://Hibernate.com/home/

Journal Referernce:
[1] Carlos Teixeira1, José Braga de Vasconcelos2 , Gabriel Pestana3 , A Knowledge Management System for
Analysis of Organisational Log Files, Lisboa, Portugal, Universidade Europeia, Laureate International
Universities
[2] Niu Gaifang, The Development of Logging Large-scale Management Information System, College of
Computer and Information Technology, Henan Normal University, Xinxiang, China.
[3] Tian Yue1, Li Xiaobin2, Yang Zhengqiu3, The Research And Design Of Log Management System Based On
Struts Frame, School of CST Beijing University of Posts and Telecommunications, Beijing, China

[4] Jing Li1, Xing Li2, Gang Liu3, Zhenwen He4, Log Management Approach in Three-Dimensional
Spatial Data Management System, School of Computer Science and Technology China University of
Geosciences, Wuhan, China

[5] Minoru Ikebe1, Kazuyuki Yoshida2, An Integrated Distributed Log Management System with Metadata for
Network Operation, Department of Computer Science and Intelligence Systems, Faculty of Engineering, Oita
University, Oita, Japan

98
99

You might also like