Академический Документы
Профессиональный Документы
Культура Документы
• Acknowledment……………………………………………………………2
• Introduction………………………………………………………………...3
• Problem Defination………………………………………………………...4
• Proposed System…………………………………………………………...5
• Requirement Analysis……………………………………………………...6
o Feasiblity Study……………………………………………....6
o Data collection………………………………………………..7
o E-R diagram………………………………………………......8
o Normalization…………………………………………………9
• System design……………………………………………………………....11
o UML Diagrams……………………………………………....11
• I/O Screens………………………………………………………………….15
• Test Case Design…………………………………………………………....38
• Coding……………………………………………………………………….40
• Limitations and Futur Enhancement………………………………………...127
• Bibliography…………………………………………………………………128
1
ACKNOWLDEMENT
“It is not possible to prepare a project without the assistance & encouragement of other people. This
one is certainly no exception.”
On the very outset of this report, we would like to extend our sincere & heartfelt obligation towards
all the personages who have helped us in this endeavor. Without their active guidance, help, cooperation &
encouragement, we would not have made headway in the project.
We ineffably indebted to Mrs.Dhande and Mr.Gajare for conscientious guidance and encouragement
to accomplish this assignment.
We extend our gratitude to department of computer science for giving us this opportunity.
We also acknowledge with a deep sense of reverence, our gratitude towards our parents
and member of our family, who has always supported us morally as well as economically. At last but not least
gratitude goes to all of our friends who directly or indirectly helped us to complete this project.
2
INTRODUCTION
As we know, today computer is a part of our life, the development in computer
field can be referred as pre-dominating technology as on today. In our day-to-day life we need computers as
they work miracles in the twinkling of an eye.
The project deals with managing a jewellery store where sales of jewellery
services for women & men are done .In this jewellery management system the customer information is saved
for every new customer. The lists of items which are available for sale in store are entered in the system. Items
will be available in Gold, Silver, Platinum, Navaratna, etc. Each item has category like Necklace, Earrings,
Rings, Bracelet, Anklet, Bangles, etc.
It also provides services like custom jewellery design ,jewellery repair
,jewellery cleaning and inspection ,pearl stringing ,jewellery engraving ,financing ,etc. which is stored in system
along with customer details.
The system will always show customer information, total amount to be
received from customer as per their items purchase, services, total amount received from sales. List of items for
sale can be viewed.
HARDWARE REQUIREMENTS:
Hardware interface describe the logical and physical characteristics of each interface between the
software product and the hardware components of the system.
SOFTWARE REQUIREMENTS:
Software interface describe the connections between this product and other specific software
components (name and version), including databases, operating systems, tools, libraries and integrated
commercial components. It describes the services needed and the nature of communications.
3
PROBLEM DEFINATION
EXISTING SYSTEM:
At present all the activities are handled manually. Manual data processing system,
whole providing economy, flexibility and adaptability at low data volumes become more complex when the
volume of data becomes large. As an organization expands in size and function, a stage is reached when manual
procedures become inadequate and inefficient. No matter how many clerks are employed a stage is reached then
it becomes impossible to systemize such a large amount of information. What is required then is an upgrading
in the class of information processing technology.
The present system is not sufficient to hold all the information that is necessary for
the processing. So the library is in need of new computerized system, which is very flexible, user-friendly and
capable of holding the system in a robust manner. By computerizing the existing system, problems of existing
and its drawbacks can be eliminated a best result can be achieved.
4
PROPOSED SYSTEM
The system study phase studies the problem, identifies alternate solution, evaluates
these solutions and finally recommends best solution. The system gives the structure and function of the system.
A detailed system study is essential for developing an efficient system. The proposed system provides a better
user interface.
5
REQUIRMENT ANALYSYS
FEASIBILITY STUDY
During system analysis, a feasibility study of the proposed system is carried out
to see whether it is beneficial to the organization.
The integration unit is currently manual. To get the detailed information on
production, bagging etc. large bundles of files have to be looked into. It is very time consuming affair. An
operator has to keep in mind or search a file for the details of the data. So working with the existing system is
quite tedious. Whereas considering the merits of the new system it is very beneficial. The results of the
feasibility study are given below:
6
DATA COLLECTION
To design an application for Jewellery management system, some
information was necessarily required to know the actual scenario of nursery. Like-
QUESTIONNAIRE :
We have used questionnaire method for gathering data from existing system. The use of
questionnaires allows analyst to collect information about various aspects of a system from large no. of persons.
The use of standardized question format can yield more reliable data then interview and another techniques and
the wide distribution ensures greater anonymity for respondents, which can lead to more honest responses.
This method does not allow to analysts to observe the expressions or reactions, response may be
limited.
Analysts often use open-ended questionnaire to learn about feelings, opinions, general
experience to explore a problem.
The high cost of developing and distributing questionnaire demands that analysts carefully
consider the objective of the questionnaire and determine what structure will be most useful to study and most
easily understood by the respondents.
OBSERVATION :
Observation allows analysts to gain information they cannot obtain by any other
technique. Analysts can obtained finish and information about how activities are carried out, observe how
documents are handled. Experienced observer know what to look for & how to assess the significance of what
they observe. We have collected the information by using this technique.
7
E-R DIAGRAM
8
NORMALIZATION
1.Customer:
Field Type Null Key Default
cust_id int(11) NO Primary Key
cust_name varchar(15) NO
address varchar(50) NO
mobile_no varchar(10) NO Unique
res_no varchar(10) YES Unique NULL
mail_id varchar(30) YES Unique NULL
balance varchar(10) NO
2.Login:
Field Type Null Key Default
username varchar(20) NO Primary Key
password varchar(10) YES NULL
3.Product:
Field Type Null Key Default
prod_id int(11) NO Primary key
type_id int(11) YES NULL
prod_name varchar(30) NO
weight float NO
metal varchar(15) YES Foreign key NULL
rate float NO
sold varchar(10) YES NULL
4.Orders:
Field Type Null Key Default
ord_id int(11) NO Primary key
orderdesc varchar(30) NO
ord_date date NO
del_date date NO
cust_id int(11) YES Foreign key NULL
design_no int(11) YES NULL
advance float NO
totalamt float NO
completed int(11) NO
9
5.Service:
Field Type Null Key Default
service_id int(11) NO Primary key
service_desc varchar(30) NO
service_dt date NO
delivery_dt date NO
advance float NO
totalamt float NO
cust_id int(11) YES Foreign key NULL
completed int(11) NO
6.Bill:
Field Type Null Key Default
bill_no int(11) NO Primary key
cust_id int(11) YES Foreign key NULL
billdate date NO
amount float NO
7.Product type:
Field Type Null Key Default
type_id int(11) NO Primary key
type varchar(20) NO
8.Product rate:
Field Type Null Key Default
metal varchar(15) NO Primary key
rate float YES NULL
10
SYSTEM DESIGN
1 USE CASES AND USE CASE DIAGRAMS:
A use-case is a UML modeling element that describes how a user of the proposed system will interact
with the system to perform a discrete unit of work. It describes and signifies a single interact with the system to
perform a discrete unit of work. It describes and signifies a single interaction over time that has meaning for the
end user (person, machine or other system), and is required to leave the system in a complete state: either the
interaction completed or was rolled back to the initial state.
• A use case typically has requirements and constraints that describe the essential features and rules under
which it operates.
• A use case may have an associated Sequence diagram illustrating behavior over time – who does what
and to whom, when.
• A use case typically has scenarios associated with it that describe the work flow over time that produces
the end result. Alternate work flows (to capture exceptions, etc.) are also allowed.
A use case diagram captures use cases and actor interactions. It describes
the functional requirements of the system, the manner that outside things (actors) interact at the system boundary and
the response of the system.
11
2 SEQUENCE DIAGRAM:
A sequence diagram is a structures representation of behavior as a series of sequential steps over time. It is
used to depict work flow, message passing and how elements in general cooperate over time to achieve results.
A sequence diagram models a dynamic view of the interactions between model elements at runtime.
Sequence diagrams are commonly used as explanatory models for use case scenarios.
o Each sequence element is arranged in a horizontal sequence, with messages passing back
and forward between elements.
o An actor element may be used to represent the user initiating the flow of events.
o Stereotyped elements, such as boundary, control and entity, may be used to illustrate
screens, controllers and database items respectively.
o Each element has a dashed stem called a lifeline, where that element that exists and
potentially takes part in the illustrations.
Sequence diagram in UML, indicates how events cause transitions from object to object. Once examining
a use-case has identified events, the modeler creates a sequence diagram- a representation of how events cause
flow from one object to another as a function of time. The sequence diagram is a shorthand version of the use-
case. It represents key classes and the events that cause behavior to flow from class to class.
12
3 ACTIVITY DIAGRAM:
The UML activity diagram is used to indicate the flow of the interaction within a specific scenario
by means of graphical representation. An activity diagram uses rounded rectangles to imply a specific system
function, arrow to represent flow through the system, decision diamonds to deflect a branching decision and
solid horizontal lines to indicate that parallel activities are occurring.
13
4 CLASS DAIGRAM:
14
I/O SCREENS
WELCOME SCREENS
15
LOGIN SCREEN
1. Login screen
16
3.If invalid user then pop up messege as “Invalid User”
17
5.If username and password both valid then it will pop up message “Login success”.
18
1.If alphabet/Speciaal symbol typed.
19
MASTER MENU
Master menu using both button and drop down menu.
20
1.When New button clicked ,product type id will automatic generated.
21
3.Product type created.
22
5.When Delete button clicked.
23
7.If incorrect product type id is enterd (for delete and view)
24
1.Save button clicked.
2.Delete product.
25
CUSTOMER ENTRY FORM
26
2. Customer Mobile no and residance no must be digits only.
27
4.Invalid email id
5.Customer created.
28
SALE BILL ENTRY SCREEN
1.When New button clicked, bill no and bill date will be automatically generated.
2.Generate bill.
29
3.Print bill.
30
2.Sale order created.
31
1. Service Entered.
32
2.View Order
33
SERVICE ORDER DELIVERY FORM
1.Deliver service order
34
VIEW ALL CUSTOMERS
1.View report.
2.Print report.
35
VIEW JEWELLERY FOR SALE
1.View report
36
VIEW PENDING SERVICE ORDERS
37
TEST CASE DESIGN
INTRODUCTION:
Testing is the set of activities that can be planned in advanced and s conducted
systematically. Testing requires that the developer discard preconceived notions of the “correctness” of the
software just developed and overcome a conflict of interest that occurs when errors are encountered. Testing
principles are
All tests should be traceable to customer requirements
Testing should be planned long before the testing begins
Testing should begin “in the small” and progress towards testing “in the large”.
Exhaustive testing is not possible
To be most effective, testing should be conducted by an independent third party.
There are various testing strategies available to accommodate from low-level testing to high-level testing as
discussed below.
TEST PLAN
Testing is the major quality control measure employed during software development. In the project,
the first test considered is the unit testing. In this unit testing, each modules of the system are tested separately.
This is carried out during programming stage itself. Each module should work satisfactory as regard from the
module.
After the entire module are checked independently and completed then the integration testing is
performed to check whether there is any interface errors. Then those errors are verified and corrected.
And also the security test is performed to allow only authorized persons to this system. Finally, the
validation testing is performed to validate whether the customer requirements are stratified are not.
38
UNIT TESTING
The unit testing is carried out on coding. Here different modules are tested against the specifications
produced during design for the modules. Unit testing mainly focused first in the smallest and low level modules,
proceeding one at a time. Each module was tested against required functionally and test cases were developed to
test the boundary values.
Unit testing focuses verification effort on the smallest unit of software design the software component or
module. The unit test focuses on the internal processing logic and data structures within the boundary of the
component. This type of testing can be conducted in parallel for multiple components.
INTEGRATION TESTING:
Integration testing is a systematic technique for consulting the software architecture while at the
same time conducting test to uncover errors associated with interfacing. The objective is to take unit tested
components and build a program structure that has been dictated by design.
VALIDATION TESTING:
Validation testing is that validation succeeds when software functions in a manner that can be
reasonably expected by the user. Validation testing begins after the culmination of integration testing, software
is completely assembled as a package; interfacing errors have been uncovered and corrected.
The error detecting during this testing is
Incorrect Function
Input Condition Errors
Database Error
Performance Error
Initialization and Interface Error
SECURITY TESTING:
Security testing verifies that protection mechanisms built into a system will, in fact,
protect it from improper penetration. The system security must, of course, be tested for invulnerability from
flank or rear attack.
Test case
The system provides authentication by means of validating the username and password. It won’t allow
the user gives the exact password and username.
39
CODING
WELCOME: img.java
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Img extends JFrame implements ActionListener
{
ImageIcon img;
JButton b;
Container c;
public Img()
{
super("Jewellary Shop Management System");
c=getContentPane();
c.setLayout(null);
Toolkit kit=Toolkit.getDefaultToolkit();
Dimension screens=kit.getScreenSize();
int scrh=screens.height;
int scrw=screens.width;
img=new ImageIcon("ganesha.jpg");
b=new JButton(img);
b.setBounds(0,0,scrw,scrh);
b.addActionListener(this);
c.add(b);
c.setBackground(Color.BLACK);
b.setBackground(Color.BLACK);
setSize(scrw,scrh);
setLocation(0,0);
setVisible(true);
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==b)
{
Welcome w=new Welcome();
setVisible(false);
w.setVisible(true);
}
}
Toolkit kit=Toolkit.getDefaultToolkit();
Dimension screens=kit.getScreenSize();
int scrh=screens.height;
int scrw=screens.width;
img=new ImageIcon("Welcome.png");
b=new JButton(img);
b.setBounds(0,0,scrw,scrh);
b.addActionListener(this);
c.add(b);
b.setBackground(Color.black);
c.setBackground(Color.BLACK);
setSize(scrw,scrh);
setLocation(0,0);
setVisible(true);
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==b)
{
Login l=new Login();
setVisible(false);
l.setVisible(true);
}
}
}
41
LOGIN: Login.java
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
import java.sql.*;
ok=new JButton("OK");
cancel=new JButton("Cancel");
l4.setForeground(new Color(212,175,55));
t1=new JTextField();
t2=new JPasswordField();
l.setBounds(0,0,1323,711) ;
l4.setBounds(350,50,850,70) ;
42
l3.setBounds(550,120,300,70) ;
l1.setBounds(500,230,150,40) ;
t1.setBounds(700,230,150,40);
l2.setBounds(500,300,180,40);
t2.setBounds(700,300,150,40);
ok.setBounds(650,420,100,50) ;
cancel.setBounds(780,420,100,50);
ok.addActionListener(this);
cancel.addActionListener(this);
c.add(l);
l.add(l4);
l.add(l3);
l.add(l1);
l.add(t1);
l.add(l2);
l.add(t2);
l.add(ok);
l.add(cancel);
Toolkit kit=Toolkit.getDefaultToolkit();
Dimension screens=kit.getScreenSize();
int scrh=screens.height;
int scrw=screens.width;
c.setBackground(Color.LIGHT_GRAY);
setSize(scrw,(scrh-25));
setLocation(0,0);
setVisible(true);
}
un=t1.getText();
pwd=t2.getText();
if(un==null || pwd==null)
{
JOptionPane.showMessageDialog(this,"Enter user name & password or Cancel" );
}
else
{
rs=st.executeQuery("select * from Login");
rs.next();
if(rs.getString("username").equals(un))
{
if(rs.getString("password").equals(pwd))
{
JOptionPane.showMessageDialog(this,"Login success");
setVisible(false);
Product_Rate m=new Product_Rate();
m.setVisible(true);
}
else
{
JOptionPane.showMessageDialog(this,"Invalid Password...!!!");
t1.setText(null);
t2.setText(null);
}
}
else
{
JOptionPane.showMessageDialog(this,"Invalid user");
t1.setText(null);
t2.setText(null);
}
if(ctr>=3)
{
JOptionPane.showMessageDialog(this," Sorry you have exceeded login limit.Please try later....!!!" );
System.exit(0);
}
}
}catch(Exception e){}
}
if(ae.getSource()==cancel)
{
this.setVisible(false);
System.exit( 0 );
}
}
}
44
PRODUCT RATE ENTRY SCREEN: Product_Rate.java
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
import javax.swing.border.*;
public class Product_Rate extends JFrame implements ActionListener,KeyListener
{
JTextField t1,t2,t3,t4,t5;
JLabel l,l1,l2,l3,li1,li2,li3,li4,li5,l4,l5,l6,l7;
ImageIcon i1,i2,i3,i4,i5;
JButton Upd,Ext;
Connection cn1;
ResultSet rs,rs1;
Statement st;
st=cn1.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
}catch(ClassNotFoundException e){JOptionPane.showMessageDialog(this,e);}
catch(SQLException s){JOptionPane.showMessageDialog(this,s);}
}
public Product_Rate()
{
super("Product Rate");
Container c1=getContentPane();
Toolkit kit = Toolkit.getDefaultToolkit();
Dimension screens = kit.getScreenSize();
int scrh = screens.height;
int scrw = screens.width;
setSize( scrw , scrh );
setLocation( 0 , 0 );
i1=new ImageIcon("background.jpg");
li1 = new JLabel(i1);
li1.setBounds(0,0,scrw,scrh) ;
l.setBounds(320,30,1000,100) ;
45
l1.setBounds(500,100,1000,100) ;
t1=new JTextField();
t1.setFont(new Font("MT Bold",Font.BOLD,20));
t2=new JTextField();
t2.setFont(new Font("MT Bold",Font.BOLD,20));
t3=new JTextField();
t3.setFont(new Font("MT Bold",Font.BOLD,20));
t4=new JTextField();
t4.setFont(new Font("MT Bold",Font.BOLD,20));
t5=new JTextField();
t5.setFont(new Font("MT Bold",Font.BOLD,20));
Upd=new JButton("Update");
Ext=new JButton("Proceed");
Upd.setFont(new Font("Script MT Bold",Font.BOLD,20));
Ext.setFont(new Font("Script MT Bold",Font.BOLD,20));
l7=new JLabel("Price/gm");
l7.setFont(new Font("Script MT Bold",Font.BOLD,20));
l7.setForeground(Color.WHITE);
l2.setBounds(450,250,200,30);
t1.setBounds(650,250,100,30);
l3.setBounds(450,350,200,30);
t2.setBounds(650,350,200,30);
l4.setBounds(450,450,150,30);
t3.setBounds(650,450,250,30);
46
l5.setBounds(450,550,150,30);
t4.setBounds(650,550,250,30);
l6.setBounds(450,650,150,30);
t5.setBounds(650,650,250,30);
l7.setBounds(650,200,150,30);
Upd.setBounds(1000,400,150,40);
Ext.setBounds(1000,500,150,40);
Upd.addActionListener(this);
Ext.addActionListener(this);
t1.addKeyListener(this);
t2.addKeyListener(this);
t3.addKeyListener(this);
t4.addKeyListener(this);
t5.addKeyListener(this);
c1.setLayout(null);
c1.add(li1);
li1.add(l);
li1.add(l1);
li1.add(l2);
li1.add(t1);
li1.add(l3);
li1.add(t2);
li1.add(l4);
li1.add(t3);
li1.add(l5);
li1.add(t4);
li1.add(l6);
li1.add(t5);
li1.add(l7);
li1.add(Upd);
li1.add(Ext);
setVisible(true);
}
public void cleartext()
{
t1.setText(null);
t2.setText(null);
t3.setText(null);
47
t4.setText(null);
t5.setText(null);
}
if( k.getSource()==t2)
{
if(k.getKeyCode()==8||Character.isDigit(k.getKeyChar())){}
else
{
if( k.getSource()==t3)
{
if(k.getKeyCode()==8||Character.isDigit(k.getKeyChar())){}
else
{
JOptionPane.showMessageDialog(this,"Enter only Digits" );
t3.setText(null);
}
}
if( k.getSource()==t4)
{
if(k.getKeyCode()==8||Character.isDigit(k.getKeyChar())){}
else
{
JOptionPane.showMessageDialog(this,"Enter only Digits" );
t4.setText(null);
}
}
if( k.getSource()==t5)
{
if(k.getKeyCode()==8||Character.isDigit(k.getKeyChar())){}
48
else
{
JOptionPane.showMessageDialog(this,"Enter only Digits" );
t5.setText(null);
}
}
}
public void keyReleased(KeyEvent k) {}
public void keyTyped(KeyEvent k) {}
JButton m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12,m13,m15,m16,m17;
public MasterMenu()
{
super("MENU");
c = getContentPane();
l1.setBounds(500,60,850,70) ;
l.setBounds(-20,-20,scrw,scrh);
MenuBar mbar=new MenuBar();
setBackground( Color.black);
setSize( scrw , scrh );
setLocation( 0 , 0 );
50
setFont(new Font("Arial",Font.BOLD,20));
mbar.setFont(new Font("Arial",Font.BOLD,20));
setMenuBar(mbar);
mm15=new MenuItem("Exit");
mast1.add(mm1);
mast1.add(mm2);
mast1.add(mm3);
tran1.add(mm4);
tran1.add(mm5);
tran1.add(mm6);
tran1.add(mm7);
tran1.add(mm8);
repo1.add(mm9);
repo1.add(mm10);
repo1.add(mm11);
repo1.add(mm12);
repo1.add(mm13);
ext1.add(mm15);
mbar.add(mast1);
51
mbar.add(tran1);
mbar.add(repo1);
mbar.add(ext1);
mm1.addActionListener(this);
mm2.addActionListener(this);
mm3.addActionListener(this);
mm4.addActionListener(this);
mm5.addActionListener(this);
mm6.addActionListener(this);
mm7.addActionListener(this);
mm8.addActionListener(this);
mm9.addActionListener(this);
mm10.addActionListener(this);
mm11.addActionListener(this);
mm12.addActionListener(this);
mm13.addActionListener(this);
mm15.addActionListener(this);
mast.setBounds(460,130,100,30);
tran.setBounds(640,130,200,30);
repo.setBounds(880,130,100,30);
ext.setBounds(1100,130,150,30);
i1=new ImageIcon("b1s.jpg");
i2=new ImageIcon("b2s.jpg");
i3=new ImageIcon("b3s.jpg");
m1=new JButton(i1);
m2=new JButton(i2);
m4=new JButton(i3);
m1.setBounds(450,180,145,90);
m2.setBounds(450,280,145,90);
m4.setBounds(450,380,145,90);
i4=new ImageIcon("b4s.jpg");
i5=new ImageIcon("b5s.jpg");
52
i6=new ImageIcon("b6s.jpg");
i7=new ImageIcon("b7s.jpg");
i8=new ImageIcon("b8s.jpg");
m5=new JButton(i4);
m6=new JButton(i5);
m15=new JButton(i6);
m16=new JButton(i7);
m17=new JButton(i8);
m5.setBounds(650,180,145,90);
m6.setBounds(650,280,145,90);
m15.setBounds(650,380,145,90);
m16.setBounds(650,480,145,90);
m17.setBounds(650,580,145,90);
i9=new ImageIcon("b9s.jpg");
i10=new ImageIcon("b10s.jpg");
i11=new ImageIcon("b11s.jpg");
i12=new ImageIcon("b12s.jpg");
i13=new ImageIcon("b13s.jpg");
i14=new ImageIcon("b14.jpg");
m7=new JButton(i9);
m8=new JButton(i10);
m9=new JButton(i11);
m10=new JButton(i12);
m11=new JButton(i13);
m12=new JButton(i14);
m7.setBounds(880,180,145,90);
m8.setBounds(880,280,145,90);
m9.setBounds(880,380,145,90);
m10.setBounds(880,480,145,90) ;
m11.setBounds(880,580,145,90);
m12.setBounds(1100,180,181,177);
c.add(l);
l.add(li);
l.add(l1);
l.add(mast);
l.add(tran);
l.add(repo);
l.add(ext);
l.add(m1);
l.add(m2);
l.add(m4);
l.add(m5);
53
l.add(m6);
l.add(m15);
l.add(m16);
l.add(m17);
l.add(m7);
l.add(m8);
l.add(m9);
l.add(m10);
l.add(m11);
l.add(m12);
m1.addActionListener(this);
m2.addActionListener(this);
m4.addActionListener(this);
m5.addActionListener(this);
m6.addActionListener(this);
m7.addActionListener(this);
m8.addActionListener(this);
m9.addActionListener(this);
m10.addActionListener(this);
m11.addActionListener(this);
m12.addActionListener(this);
m15.addActionListener(this);
m16.addActionListener(this);
m17.addActionListener(this);
if(ae.getSource()==m1 || ae.getSource()==mm1)
new JewelType().setVisible(true);
if(ae.getSource()==m2 || ae.getSource()==mm2)
new Product().setVisible(true);
if(ae.getSource()==m4 || ae.getSource()==mm3)
new Customer().setVisible(true);
54
if(ae.getSource()==m5 || ae.getSource()==mm4)
new SaleBillEntry().setVisible(true);
if(ae.getSource()==m6 || ae.getSource()==mm5)
new OrderEntryForm().setVisible(true);
if(ae.getSource()==m15 || ae.getSource()==mm6)
new ServiceEntryForm().setVisible(true);
if(ae.getSource()==m16 || ae.getSource()==mm7)
new OrderDeliveryForm().setVisible(true);
if(ae.getSource()==m17 || ae.getSource()==mm8)
new ServiceDeliveryForm().setVisible(true);
if(ae.getSource()==m7 || ae.getSource()==mm9)
new CustomerReport().setVisible(true);
if(ae.getSource()==m8 || ae.getSource()==mm10)
new ItemReport().setVisible(true);
if(ae.getSource()==m9 || ae.getSource()==mm11)
new PendingOrderReport().setVisible(true);
if(ae.getSource()==m10 || ae.getSource()==mm12)
new PendingServiceOrderReport().setVisible(true);
if(ae.getSource()==m11 || ae.getSource()==mm13)
new SaleBillReport().setVisible(true);
if(ae.getSource()==m12 || ae.getSource()==mm15)
{
this.setVisible(false);
System.exit( 0 );
}
}
}
55
JEWELLERY TYPE ENTRY FORM: JewelType.java
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
import javax.swing.border.*;
public class JewelType extends JFrame implements ActionListener,KeyListener
{
JTextField t1,t2;
JLabel l,l1,l2,l3,li1,li2,li3,li4,li5;
ImageIcon i1,i2,i3,i4,i5;
JButton New,Upd,Del,View,Clear,Ext;
Connection cn1;
ResultSet rs;
Statement st;
setBackground( Color.LIGHT_GRAY);
setForeground(new Color(0,0,0));
setSize( scrw , scrh );
setLocation( 0 , 0 );
i1=new ImageIcon("background.jpg");
li1 = new JLabel(i1);
li1.setBounds(0,0,scrw,scrh) ;
li2 = new JLabel(i2);
li2.setBounds(0,150,150,150) ;
li3 = new JLabel(i3);
li3.setBounds(0,300,150,150) ;
li4 = new JLabel(i4);
li4.setBounds(0,450,150,150) ;
li5 = new JLabel(i5);
56
li5.setBounds(0,600,150,150) ;
l = new JLabel("TARA JEWELLARS");
l.setFont(new Font("Garamond",Font.BOLD,40));
l.setBounds(300,20,1000,50) ;
l1.setBounds(500,90,1000,50) ;
t1=new JTextField();
t1.setFont(new Font("Script",Font.BOLD,20));
t2=new JTextField();
t2.setFont(new Font("Script",Font.BOLD,20));
New=new JButton("New");
Upd=new JButton("Save");
Del=new JButton("Delete");
View=new JButton("View");
Ext=new JButton("Exit");
Clear=new JButton("Clear");
New.setFont(new Font("Script MT Bold",Font.BOLD,20));
Upd.setFont(new Font("Script MT Bold",Font.BOLD,20));
Del.setFont(new Font("Script MT Bold",Font.BOLD,20));
l2.setBounds(450,300,200,30);
t1.setBounds(650,300,100,30);
l3.setBounds(450,400,150,30);
t2.setBounds(650,400,250,30);
New.setBounds(950,200,100,40);
57
Upd.setBounds(950,280,100,40);
Del.setBounds(950,360,100,40);
Clear.setBounds(950,440,100,40);
View.setBounds(950,520,100,40);
Ext.setBounds(950,600,100,40);
New.addActionListener(this);
Upd.addActionListener(this);
Del.addActionListener(this);
Clear.addActionListener(this);
View.addActionListener(this);
Ext.addActionListener(this);
t2.addKeyListener(this);
c1.setLayout(null);
c1.add(li1);
li1.add(li2);
li1.add(li3);
li1.add(li4);
li1.add(li5);
li1.add(l);
li1.add(l1);
li1.add(l2);
li1.add(t1);
li1.add(l3);
li1.add(t2);
li1.add(New);
li1.add(Upd);
li1.add(Del);
li1.add(Clear);
li1.add(View);
li1.add(Ext);
setVisible(true);
}
public void cleartext()
{
t1.setText(null);
t2.setText(null);
}
if( k.getSource()==t2)
{
if(k.getKeyCode()==KeyEvent.VK_CAPS_LOCK || k.getKeyCode()==KeyEvent.VK_SHIFT ||
k.getKeyCode()==8 || Character.isLetter(k.getKeyChar()) || Character.isWhitespace(k.getKeyChar()))
{}
else
{
JOptionPane.showMessageDialog(this,"Enter only Alphabets" );
58
t2.setText(null);
}
}
}
public void keyReleased(KeyEvent k) {}
public void keyTyped(KeyEvent k) {}
else
{
String ins="insert into prod_type values("+t1.getText()+",'"+t2.getText()+"')";
st.executeUpdate(ins);
JOptionPane.showMessageDialog(this,"Product Type created");
}
}
}
else
if(a1.getSource()==View)
{
if(t1.getText().equals(""))
JOptionPane.showMessageDialog(this,"Enter Product Type ID");
else
{
rs=st.executeQuery("select * from prod_type where type_id="+t1.getText());
59
if(rs.next())
{
t2.setText(rs.getString("type"));
}
else
JOptionPane.showMessageDialog(this,"No such Product Type Exists");
}
}
else
if(a1.getSource()==Clear)
{
cleartext();
}
else
if(a1.getSource()==Del)
{
if(t1.getText().equals(""))
JOptionPane.showMessageDialog(this,"Enter Product type ID");
else
{
60
JEWELLERY ENTRY FORM: Product.java
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
import javax.swing.border.*;
public class Product extends JFrame implements ActionListener
{
JTextField t1,t2,t3,t4,t5;
JLabel l,l1,l2,l3,li1,li2,li3,li4,li5,l4,l5,l6,l7;
ImageIcon i1,i2,i3,i4,i5;
JButton New,Upd,Del,View,Clear,Ext;
Connection cn1;
ResultSet rs,rs1;
Statement st;
JComboBox typ,mt;
public void con()
{
try
{
Class.forName("com.mysql.jdbc.Driver");
cn1=DriverManager.getConnection("jdbc:mysql://localhost:3306/jewel","root","");
st=cn1.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
rs=st.executeQuery("select * from Product");
}catch(ClassNotFoundException e){JOptionPane.showMessageDialog(this,e);}
catch(SQLException s){JOptionPane.showMessageDialog(this,s);}
}
public Product()
{
super("Produst Type Details");
Container c1=getContentPane();
Toolkit kit = Toolkit.getDefaultToolkit();
Dimension screens = kit.getScreenSize();
int scrh = screens.height;
int scrw = screens.width;
setLocation( 0 , 0 );
i1=new ImageIcon("background.jpg");
l.setBounds(320,30,1000,100) ;
l1.setBounds(500,100,1000,100) ;
t1=new JTextField();
t1.setFont(new Font("MT Bold",Font.BOLD,20));
t2=new JTextField();
t2.setFont(new Font("MT Bold",Font.BOLD,20));
t3=new JTextField();
t3.setFont(new Font("MT Bold",Font.BOLD,20));
t5=new JTextField();
t5.setFont(new Font("MT Bold",Font.BOLD,20));
mt=new JComboBox();
mt.addItem("Gold 24K");
mt.addItem("Gold 22K");
mt.addItem("Gold HMK");
mt.addItem("Silver");
mt.addItem("Diamond");
typ=new JComboBox();
try
{
con();
rs1=st.executeQuery("select * from prod_type");
while(rs1.next())
{
typ.addItem(rs1.getString("type"));
}
}catch(SQLException s){
}
New=new JButton("New");
Upd=new JButton("Save");
Del=new JButton("Delete");
View=new JButton("View");
Ext=new JButton("Exit");
Clear=new JButton("Clear");
New.setFont(new Font("Script MT Bold",Font.BOLD,20));
Upd.setFont(new Font("Script MT Bold",Font.BOLD,20));
Del.setFont(new Font("Script MT Bold",Font.BOLD,20));
62
View.setFont(new Font("Script MT Bold",Font.BOLD,20));
Ext.setFont(new Font("Script MT Bold",Font.BOLD,20));
Clear.setFont(new Font("Script MT Bold",Font.BOLD,20));
mt.setFont(new Font("MT Bold",Font.BOLD,20));
l7=new JLabel("Price:");
l7.setFont(new Font("Script MT Bold",Font.BOLD,20));
l7.setForeground(Color.WHITE);
l2.setBounds(450,200,200,30);
t1.setBounds(650,200,100,30);
l3.setBounds(450,280,200,30);
typ.setBounds(650,280,200,30);
l4.setBounds(450,360,150,30);
t2.setBounds(650,360,250,30);
l5.setBounds(450,440,150,30);
t3.setBounds(650,440,250,30);
l6.setBounds(450,520,150,30);
mt.setBounds(650,520,250,30);
l7.setBounds(450,600,150,30);
t5.setBounds(650,600,250,30);
New.setBounds(1000,200,100,40);
Upd.setBounds(1000,280,100,40);
63
Del.setBounds(1000,360,100,40);
Clear.setBounds(1000,440,100,40);
View.setBounds(1000,520,100,40);
Ext.setBounds(1000,600,100,40);
New.addActionListener(this);
Upd.addActionListener(this);
Del.addActionListener(this);
Clear.addActionListener(this);
View.addActionListener(this);
Ext.addActionListener(this);
mt.addActionListener(this);
t5.setEnabled(false);
c1.setLayout(null);
c1.add(li1);
li1.add(l);
li1.add(l1);
li1.add(l2);
li1.add(t1);
li1.add(l3);
li1.add(typ);
li1.add(l4);
li1.add(t2);
li1.add(l5);
li1.add(t3);
li1.add(l6);
li1.add(mt);
li1.add(l7);
li1.add(t5);
li1.add(New);
li1.add(Upd);
li1.add(Del);
li1.add(Clear);
li1.add(View);
li1.add(Ext);
setVisible(true);
}
public void cleartext()
{
t1.setText(null);
t2.setText(null);
t3.setText(null);
t5.setText(null);
}
try{
if(a1.getSource()==mt)
{
String mn=(String)mt.getSelectedItem();
rs=st.executeQuery("select * from prod_rate where upper(metal)='"+mn+"'");
rs.next();
t5.setText(rs.getString("rate"));
}
if(a1.getSource()==New)
{
cleartext();
rs=st.executeQuery("select prod_id from Product");
if(rs.last())
t1.setText(Integer.toString((rs.getInt(1)+1)));
else
t1.setText("1");
t2.requestFocus();
}
else
if(a1.getSource()==Upd)
{
String sn=(String)typ.getSelectedItem();
rs1=st.executeQuery("select * from prod_type where type='"+sn+"'");
rs1.next();
int tid=rs1.getInt(1);
String ins="insert into Product
values("+t1.getText()+","+tid+",'"+t2.getText()+"',"+t3.getText()+",'"+mt.getSelectedItem()+"',"+t5.getText()+"
,0)";
st.executeUpdate(ins);
JOptionPane.showMessageDialog(this,"Product created");
}
else
if(a1.getSource()==View)
{
if(t1.getText().equals(""))
JOptionPane.showMessageDialog(this,"Enter Product ID");
else
{
rs=st.executeQuery("select * from Product where prod_id="+t1.getText());
if(rs.next())
{
t2.setText(rs.getString("prod_name"));
t3.setText(rs.getString("weight"));
t4.setText(rs.getString("quality"));
t5.setText(rs.getString("price"));
65
int tid=rs.getInt("type_id");
rs1=st.executeQuery("select * from prod_type where type_id="+tid);
rs1.next();
typ.setSelectedItem(rs1.getString("type"));
}
else
JOptionPane.showMessageDialog(this,"Product does not Exists");
}
}
else
if(a1.getSource()==Clear)
{
cleartext();
}
else
if(a1.getSource()==Del)
{
if(t1.getText().equals(""))
JOptionPane.showMessageDialog(this,"Enter Product ID");
else
{
if(rs.next())
{
st.executeUpdate("delete from Product where prod_id="+t1.getText());
cleartext();
JOptionPane.showMessageDialog(this,"Product Deleted");
}
else
JOptionPane.showMessageDialog(this,"No such Prod Exists");
}
}
else
if(a1.getSource()==Ext)
{
rs.close();
this.setVisible(false);
}
}catch(SQLException s){JOptionPane.showMessageDialog(this,s);}
}
}
66
CUSTOMER ENTRY FORM: Customer.java
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
import javax.swing.border.*;
public class Customer extends JFrame implements ActionListener,KeyListener
{
JTextField t1,t2,t3,t4,t5,t6;
JLabel l,l1,l2,l3,li1,li2,l4,l5,l6,ll;
ImageIcon i1,i2,i3,i4,i5;
JButton New,Upd,Del,View,Clear,Ext;
Connection cn1;
ResultSet rs,rs1;
Statement st;
JComboBox typ;
public void con()
{
try
{
Class.forName("com.mysql.jdbc.Driver");
cn1=DriverManager.getConnection("jdbc:mysql://localhost:3306/jewel","root","");
st=cn1.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
rs=st.executeQuery("select * from Customer");
}catch(ClassNotFoundException e){JOptionPane.showMessageDialog(this,e);}
catch(SQLException s){JOptionPane.showMessageDialog(this,s);}
}
public Customer()
{
super("Customer Detail");
Container c1=getContentPane();
Toolkit kit = Toolkit.getDefaultToolkit();
Dimension screens = kit.getScreenSize();
int scrh = screens.height;
int scrw = screens.width;
setBackground( Color.LIGHT_GRAY);
setForeground(new Color(0,0,0));
setSize( scrw , scrh );
setLocation( 0 , 0 );
i1=new ImageIcon("background.jpg");
li1 = new JLabel(i1);
li1.setBounds(0,0,scrw,scrh) ;
l.setBounds(300,20,1000,50) ;
ll.setBounds(500,90,1000,50) ;
t1=new JTextField();
t2=new JTextField();
t3=new JTextField();
t4=new JTextField();
t5=new JTextField();
t6=new JTextField();
New=new JButton("New");
Upd=new JButton("Save");
Del=new JButton("Delete");
View=new JButton("View");
Ext=new JButton("Exit");
Clear=new JButton("Clear");
New.setFont(new Font("Script MT Bold",Font.BOLD,20));
Upd.setFont(new Font("Script MT Bold",Font.BOLD,20));
Del.setFont(new Font("Script MT Bold",Font.BOLD,20));
View.setFont(new Font("Script MT Bold",Font.BOLD,20));
Ext.setFont(new Font("Script MT Bold",Font.BOLD,20));
Clear.setFont(new Font("Script MT Bold",Font.BOLD,20));
l3=new JLabel("Address:");
l3.setFont(new Font("Script MT Bold",Font.BOLD,20));
l3.setForeground(Color.WHITE);
l2.setBounds(450,260,150,30);
t2.setBounds(650,260,250,30);
l3.setBounds(450,340,150,30);
t3.setBounds(650,340,250,30);
l4.setBounds(450,420,150,30);
t4.setBounds(650,420,250,30);
l5.setBounds(450,500,150,30);
t5.setBounds(650,500,250,30);
l6.setBounds(450,580,150,30);
t6.setBounds(650,580,250,30);
New.setBounds(1000,180,100,40);
Upd.setBounds(1000,260,100,40);
Del.setBounds(1000,340,100,40);
Clear.setBounds(1000,420,100,40);
View.setBounds(1000,500,100,40);
Ext.setBounds(1000,580,100,40);
New.addActionListener(this);
Upd.addActionListener(this);
Del.addActionListener(this);
Clear.addActionListener(this);
View.addActionListener(this);
Ext.addActionListener(this);
t4.addKeyListener(this);
t5.addKeyListener(this);
t2.addKeyListener(this);
c1.setLayout(null);
c1.add(li1);
li1.add(l);
li1.add(ll);
li1.add(l1);
li1.add(t1);
li1.add(l2);
li1.add(t2);
69
li1.add(l3);
li1.add(t3);
li1.add(l4);
li1.add(t4);
li1.add(l5);
li1.add(t5);
li1.add(l6);
li1.add(t6);
li1.add(New);
li1.add(Upd);
li1.add(Del);
li1.add(Clear);
li1.add(View);
li1.add(Ext);
setVisible(true);
}
public void cleartext()
{
t1.setText(null);
t2.setText(null);
t3.setText(null);
t4.setText(null);
t5.setText(null);
t6.setText(null);
if( k.getSource()==t2)
{
if(k.getKeyCode()==KeyEvent.VK_CAPS_LOCK || k.getKeyCode()==KeyEvent.VK_SHIFT
||k.getKeyCode()==8 || Character.isLetter(k.getKeyChar()) || Character.isWhitespace(k.getKeyChar()))
{}
else
{
if( k.getSource()==t4)
{
if(k.getKeyCode()==8||Character.isDigit(k.getKeyChar())){}
else
{
if( k.getSource()==t5)
{
if(k.getKeyCode()==8||Character.isDigit(k.getKeyChar())){}
else
{
}
public void keyReleased(KeyEvent k) {}
public void keyTyped(KeyEvent k) {}
try{
if(a1.getSource()==New)
{
cleartext();
rs=st.executeQuery("select cust_id from Customer");
if(rs.last())
t1.setText(Integer.toString((rs.getInt(1)+1)));
else
t1.setText("1");
t2.requestFocus();
}
else
if(a1.getSource()==Upd)
{
if(t2.getText().equals(""))
JOptionPane.showMessageDialog(this,"Please Enter Customer");
String s1=t6.getText();
int a=s1.indexOf('@');
int b=s1.indexOf('.');
if(t4.getText().length()!=10)
71
{
JOptionPane.showMessageDialog(this,"Mobile number nust be 10 digits");
}
else
if(a==-1 || b==-1 || a>b )
{
JOptionPane.showMessageDialog(this,"Invalid email-id");
}
else
{
rs=st.executeQuery("select * from Customer where cust_id="+t1.getText());
if(rs.next())
JOptionPane.showMessageDialog(this,"Customer already exists");
else
{
String ins="insert into Customer
values("+t1.getText()+",'"+t2.getText()+"','"+t3.getText()+"','"+t4.getText()+"','"+t5.getText()+"','"+t6.getText()
+"',0)";
st.executeUpdate(ins);
JOptionPane.showMessageDialog(this,"Customer created");
}
}
}
else
if(a1.getSource()==View)
{
if(t1.getText().equals(""))
JOptionPane.showMessageDialog(this,"Enter Customer ID");
else
{
rs=st.executeQuery("select * from Customer where cust_id="+t1.getText());
if(rs.next())
{
t2.setText(rs.getString("cust_name"));
t3.setText(rs.getString("address"));
t4.setText(rs.getString("mobile_no"));
t5.setText(rs.getString("res_no"));
t6.setText(rs.getString("mail_id"));
}
else
JOptionPane.showMessageDialog(this,"Customer does not Exists");
}
}
else
72
if(a1.getSource()==Clear)
{
cleartext();
}
else
if(a1.getSource()==Del)
{
if(t1.getText().equals(""))
JOptionPane.showMessageDialog(this,"Enter Customer ID");
else
{
if(rs.next())
{
st.executeUpdate("delete from Customer where cust_id="+t1.getText());
cleartext();
JOptionPane.showMessageDialog(this,"Customer Deleted");
}
else
JOptionPane.showMessageDialog(this,"No such Customer Exists");
}
}
else
if(a1.getSource()==Ext)
{
rs.close();
this.setVisible(false);
}
else
if(a1.getSource()==Ext)
{
rs.close();
this.setVisible(false);
}
}catch(SQLException s){JOptionPane.showMessageDialog(this,s);}
}
73
SALE BILL ENTRY FORM: SaleBillEntry.java
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
import java.util.*;
import java.text.*;
}catch(ClassNotFoundException e){JOptionPane.showMessageDialog(this,e);}
catch(SQLException s){JOptionPane.showMessageDialog(this,s);}
}
public SaleBillEntry()
{
super("Sale Bill Entry");
Container c1=getContentPane();
Toolkit kit = Toolkit.getDefaultToolkit();
Dimension screens = kit.getScreenSize();
int scrh = screens.height;
int scrw = screens.width;
setBackground( Color.LIGHT_GRAY);
setForeground(new Color(0,150,0));
setSize( scrw , scrh );
setLocation( 0 , 0 );
74
img=new ImageIcon("background.jpg
l = new JLabel("TARA JEWELLARS ");
l.setFont(new Font("Garamond",Font.BOLD,30));
l.setForeground( new Color(212,175,55));
lo = new JLabel(img);
lo.setBounds(0,0,scrw,scrh);
l.setBounds(320,50,800,50) ;
ll.setBounds(500,100,800,50) ;
t1=new JTextField();
t2=new JTextField();
t3=new JTextField();
t4=new JTextField();
t5=new JTextField();
s1=new JTextField();
i1=new JTextField();
r1=new JTextField();
a1=new JTextField();
s2=new JTextField();
i2=new JTextField();
r2=new JTextField();
a2=new JTextField();
s3=new JTextField();
i3=new JTextField();
r3=new JTextField();
a3=new JTextField();
s4=new JTextField();
i4=new JTextField();
r4=new JTextField();
a4=new JTextField();
s5=new JTextField();
i5=new JTextField();
r5=new JTextField();
a5=new JTextField();
m1=new JTextField();
m2=new JTextField();
m3=new JTextField();
m4=new JTextField();
m5=new JTextField();
w1=new JTextField();
w2=new JTextField();
w3=new JTextField();
w4=new JTextField();
w5=new JTextField();
75
New=new JButton("New");
Upd=new JButton("Save");
clear=new JButton("Clear");
Ext=new JButton("Exit");
Print=new JButton("Print");
cust=new JComboBox();
try
{
con();
rs2=st.executeQuery("select * from CUSTOMER
while(rs2.next())
{
cust.addItem(rs2.getString("cust_name")+" "+rs2.getString("mobile_no"));
}
}catch(SQLException s){
}
item=new java.awt.List();
try
{
con();
rs1=st.executeQuery("select * from product where sold<>1");
while(rs1.next())
{
item.addItem(rs1.getString("prod_name"));
}
}catch(SQLException s){
}
amt=new JLabel("Amount");
vat=new JLabel("Vat");
tamt=new JLabel("Total Amount");
bamt=new JLabel("Bill Amount");
amt.setForeground(Color.WHITE);
bamt.setForeground(Color.WHITE);
vat.setForeground(Color.WHITE);
tamt.setForeground(Color.WHITE);
t1.setFont(new Font("MT Bold",Font.BOLD,15));
t2.setFont(new Font("MT Bold",Font.BOLD,15));
t3.setFont(new Font("MT Bold",Font.BOLD,15));
t4.setFont(new Font("MT Bold",Font.BOLD,15));
t5.setFont(new Font("MT Bold",Font.BOLD,15));
s1.setFont(new Font("MT Bold",Font.BOLD,15));
i1.setFont(new Font("MT Bold",Font.BOLD,15));
r1.setFont(new Font("MT Bold",Font.BOLD,15));
a1.setFont(new Font("MT Bold",Font.BOLD,15));
s2.setFont(new Font("MT Bold",Font.BOLD,15));
i2.setFont(new Font("MT Bold",Font.BOLD,15));
r2.setFont(new Font("MT Bold",Font.BOLD,15));
a2.setFont(new Font("MT Bold",Font.BOLD,15));
s3.setFont(new Font("MT Bold",Font.BOLD,15));
i3.setFont(new Font("MT Bold",Font.BOLD,15));
r3.setFont(new Font("MT Bold",Font.BOLD,15));
a3.setFont(new Font("MT Bold",Font.BOLD,15));
s4.setFont(new Font("MT Bold",Font.BOLD,15));
i4.setFont(new Font("MT Bold",Font.BOLD,15));
r4.setFont(new Font("MT Bold",Font.BOLD,15));
a4.setFont(new Font("MT Bold",Font.BOLD,15));
s5.setFont(new Font("MT Bold",Font.BOLD,15));
i5.setFont(new Font("MT Bold",Font.BOLD,15));
77
r5.setFont(new Font("MT Bold",Font.BOLD,15));
a5.setFont(new Font("MT Bold",Font.BOLD,15));
c1.setLayout(null);
c1.add(lo);
lo.add(l);
lo.add(ll);
l1.setBounds(450,200,120,30);
t1.setBounds(600,200,120,30);
l2.setBounds(750,200,120,30);
t2.setBounds(900,200,120,30);
l3.setBounds(450,250,250,30);
cust.setBounds(600,250,300,30);
sr.setBounds(350,300,60,30);
in.setBounds(410,300,200,30);
wt.setBounds(620,300,50,30);
rt.setBounds(680,300,100,30);
lb.setBounds(790,300,50,30);
amt.setBounds(850,300,100,30);
l5.setBounds(960,300,150,30);
item.setBounds(960,330,200,150);
s1.setBounds(350,330,50,30);
i1.setBounds(410,330,200,30);
w1.setBounds(620,330,50,30);
r1.setBounds(680,330,100,30);
m1.setBounds(790,330,50,30);
a1.setBounds(850,330,100,30);
s2.setBounds(350,360,50,30);
i2.setBounds(410,360,200,30);
w2.setBounds(620,360,50,30);
r2.setBounds(680,360,100,30);
m2.setBounds(790,360,50,30);
78
a2.setBounds(850,360,100,30);
s3.setBounds(350,390,50,30);
i3.setBounds(410,390,200,30);
w3.setBounds(620,390,50,30);
r3.setBounds(680,390,100,30);
m3.setBounds(790,390,50,30);
a3.setBounds(850,390,100,30);
s4.setBounds(350,420,50,30);
i4.setBounds(410,420,200,30);
w4.setBounds(620,420,50,30);
r4.setBounds(680,420,100,30);
m4.setBounds(790,420,50,30);
a4.setBounds(850,420,100,30);
s5.setBounds(350,450,50,30);
i5.setBounds(410,450,200,30);
w5.setBounds(620,450,50,30);
r5.setBounds(680,450,100,30);
m5.setBounds(790,450,50,30);
a5.setBounds(850,450,100,30);
tamt.setBounds(720,480,150,30);
t4.setBounds(850,480,100,30);
vat.setBounds(720,510,150,30);
t3.setBounds(850,510,100,30);
bamt.setBounds(720,540,150,30);
t5.setBounds(850,540,100,30);
New.setBounds(1200,200,80,40);
Upd.setBounds(1200,300,80,40);
Print.setBounds(1200,400,80,40);
clear.setBounds(1200,500,80,40);
Ext.setBounds(1200,600,80,40);
New.addActionListener(this);
Upd.addActionListener(this);
Print.addActionListener(this);
Ext.addActionListener(this);
item.addItemListener(this);
lo.add(l1);
lo.add(t1);
lo.add(l2);
lo.add(t2);
lo.add(l3);
lo.add(cust);
79
lo.add(sr);
lo.add(in);
lo.add(rt);lo.add(lb);lo.add(wt);
lo.add(amt);
lo.add(s1);
lo.add(i1);
lo.add(w1);
lo.add(r1);
lo.add(m1);
lo.add(a1);
lo.add(s2);
lo.add(i2);
lo.add(w2);
lo.add(r2);
lo.add(m2);
lo.add(a2);
lo.add(s3);
lo.add(i3);
lo.add(w3);
lo.add(r3);
lo.add(m3);
lo.add(a3);
lo.add(s4);
lo.add(i4);
lo.add(w4);
lo.add(r4);
lo.add(m4);
lo.add(a4);
lo.add(s5);
lo.add(i5);
lo.add(w5);
lo.add(r5);
lo.add(m5);
lo.add(a5);
lo.add(l5);
lo.add(item);
lo.add(tamt);
lo.add(t4);
lo.add(vat);
lo.add(t3);
80
lo.add(bamt);
lo.add(t5);
lo.add(New);
lo.add(Upd);
lo.add(Print);
lo.add(clear);
lo.add(Ext);
t1.setEnabled(false);
t2.setEnabled(false);
setVisible(true);
}
if(a1.getSource()==New)
{
cleartext();
rs=st.executeQuery("select bill_no from bill");
if(rs.last())
t1.setText(Integer.toString((rs.getInt(1)+1)));
else
t1.setText("1");
t2.requestFocus();
Calendar cal=Calendar.getInstance();
String dt1=cal.get(Calendar.YEAR)+"/"+cal.get(Calendar.DATE)+"/"+(cal.get(Calendar.MONTH)+1);
t2.setText(dt1);
}
else
if(a1.getSource()==Upd)
{
String cn=(String)cust.getSelectedItem();
String sn=cn.substring(0,cn.indexOf(" "));
if(i1.getText().length()>0)
st.executeUpdate("update product set sold=1 where prod_name='"+i1.getText()+"'");
if(i2.getText().length()>0)
st.executeUpdate("update product set sold=1 where prod_name='"+i2.getText()+"'");
if(i3.getText().length()>0)
st.executeUpdate("update product set sold=1 where prod_name='"+i3.getText()+"'");
if(i4.getText().length()>0)
st.executeUpdate("update product set sold=1 where prod_name='"+i4.getText()+"'");
if(i5.getText().length()>0)
st.executeUpdate("update product set sold=1 where prod_name='"+i5.getText()+"'");
JOptionPane.showMessageDialog(this,"Bill Saved");
}
else
82
if(a1.getSource()==clear)
{
cleartext();
}
else if(a1.getSource()==Print)
{
PrintJob printjob = getToolkit().getPrintJob(this, "Print graphics", null);
Graphics g = printjob.getGraphics();
g.drawRect(120,20,350,30);
printjob.end();
}
else
if(a1.getSource()==Ext)
{
rs.close();
this.setVisible(false);
}
}catch(SQLException s){JOptionPane.showMessageDialog(this,s);}
}
public void itemStateChanged(ItemEvent i)
{
ctr++;
try{
itm=(String)item.getSelectedItem();
rs1=st.executeQuery("select * from product where prod_name='"+itm+"'");
rs1.next();
if(ctr==1)
{
s1.setText("1");
i1.setText(itm);
r1.setText(Integer.toString(rs1.getInt(6)));
w1.setText(Integer.toString(rs1.getInt(4)));
m1.setText(Double.toString(rs1.getInt(6)*rs1.getInt(4)*0.1));
a1.setText(Double.toString(rs1.getInt(6)*rs1.getInt(4)+Double.parseDouble(m1.getText())));
tot=tot+Double.parseDouble(a1.getText());
t4.setText(Double.toString(tot));
t3.setText(Double.toString(tot*0.01));
}
else
if(ctr==2)
{
s2.setText("2");
i2.setText(itm);
r2.setText(Integer.toString(rs1.getInt(6)));
w2.setText(Integer.toString(rs1.getInt(4)));
m2.setText(Double.toString(rs1.getInt(6)*rs1.getInt(4)*0.1));
a2.setText(Double.toString(rs1.getInt(6)*rs1.getInt(4)+Double.parseDouble(m2.getText())));
83
tot=tot+Double.parseDouble(a2.getText());
t4.setText(Double.toString(tot));
t3.setText(Double.toString(tot*0.01));
}
else
if(ctr==3)
{
s3.setText("3");
i3.setText(itm);
r3.setText(Integer.toString(rs1.getInt(6)));
w3.setText(Integer.toString(rs1.getInt(4)));
m3.setText(Double.toString(rs1.getInt(6)*rs1.getInt(4)*0.1));
a3.setText(Double.toString(rs1.getInt(6)*rs1.getInt(4)+Double.parseDouble(m3.getText())));
tot=tot+Double.parseDouble(a3.getText());
t4.setText(Double.toString(tot));
t3.setText(Double.toString(tot*0.01));
}
if(ctr==4)
{
s4.setText("4");
i4.setText(itm);
r4.setText(Integer.toString(rs1.getInt(6)));
w4.setText(Integer.toString(rs1.getInt(4)));
m4.setText(Double.toString(rs1.getInt(6)*rs1.getInt(4)*0.1));
a4.setText(Double.toString(rs1.getInt(6)*rs1.getInt(4)+Double.parseDouble(m4.getText())));
tot=tot+Double.parseDouble(a4.getText());
t4.setText(Double.toString(tot));
t3.setText(Double.toString(tot*0.01));
}
if(ctr==5)
{
s5.setText("5");
i5.setText(itm);
r5.setText(Integer.toString(rs1.getInt(6)));
w5.setText(Integer.toString(rs1.getInt(4)));
m5.setText(Double.toString(rs1.getInt(6)*rs1.getInt(4)*0.1));
a5.setText(Double.toString(rs1.getInt(6)*rs1.getInt(4)+Double.parseDouble(m5.getText())));
tot=tot+Double.parseDouble(a5.getText());
t4.setText(Double.toString(tot));
t3.setText(Double.toString(tot*0.01));
}
t5.setText(Double.toString(Double.parseDouble(t4.getText())+Double.parseDouble(t3.getText())));
}catch(Exception e){}
}
}
84
JEWELLERY ORDER ENTRY FORM: OrderEntryForm.java
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
import java.util.*;
import java.text.*;
JTextField t1,t2,t3,t4,t5,t6,t7;
ImageIcon img;
JLabel lo,ll,l,l0,l1,l2,l3,l4,l5,l6,l7,l8;
JButton New,Upd,View,Clear,Ext,Del;
JComboBox cust;
Connection cn1;
ResultSet rs,rs1;
Statement st;
Class.forName("com.mysql.jdbc.Driver");
cn1=DriverManager.getConnection("jdbc:mysql://localhost:3306/jewel?user=root&password=");
st=cn1.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
rs1=st.executeQuery("select * from Customer");
rs=st.executeQuery("select * from orders");
}catch(ClassNotFoundException e){JOptionPane.showMessageDialog(this,e);}
catch(SQLException s){JOptionPane.showMessageDialog(this,s);}
}
public OrderEntryForm()
{
super("Order Entry Form");
Container c1=getContentPane();
Toolkit kit = Toolkit.getDefaultToolkit();
Dimension screens = kit.getScreenSize();
int scrh = screens.height;
int scrw = screens.width;
setBackground( Color.LIGHT_GRAY);
setForeground(new Color(0,150,0));
setSize( scrw , scrh );
setLocation( 0 , 0 );
85
img=new ImageIcon("background.jpg");
lo = new JLabel(img);
lo.setBounds(0,0,scrw,scrh);
l.setBounds(320,30,1000,50) ;
ll.setBounds(500,100,1000,50) ;
t1=new JTextField();
t2=new JTextField();
t3=new JTextField();
t4=new JTextField();
t5=new JTextField();
t6=new JTextField();
t7=new JTextField();
New=new JButton("New");
Upd=new JButton("Save");
View=new JButton("View");
Ext=new JButton("Exit");
Del=new JButton("Delete");
Clear=new JButton("Clear");
New.setFont(new Font("Script MT Bold",Font.BOLD,20));
Upd.setFont(new Font("Script MT Bold",Font.BOLD,20));
Del.setFont(new Font("Script MT Bold",Font.BOLD,20));
View.setFont(new Font("Script MT Bold",Font.BOLD,20));
Ext.setFont(new Font("Script MT Bold",Font.BOLD,20));
Clear.setFont(new Font("Script MT Bold",Font.BOLD,20));
cust=new JComboBox();
try
{
con();
rs1=st.executeQuery("select * from CUSTOMER");
while(rs1.next())
{
cust.addItem(rs1.getString("cust_name")+" "+rs1.getString("mobile_no"));
}
}catch(SQLException s){
}
l1.setBounds(450,200,200,30);
t1.setBounds(680,200,100,30);
l2.setBounds(450,260,250,30);
cust.setBounds(680,260,300,30);
l3.setBounds(450,320,200,30);
t2.setBounds(680,320,300,30);
l4.setBounds(450,380,200,30);
t3.setBounds(680,380,150,30);
l5.setBounds(450,440,200,30);
t4.setBounds(680,440,150,30);
87
l6.setBounds(450,500,200,30);
t5.setBounds(680,500,150,30);
l7.setBounds(450,560,200,30);
t6.setBounds(680,560,150,30);
l8.setBounds(450,620,200,30);
t7.setBounds(680,620,150,30);
New.setBounds(1080,200,100,40);
Upd.setBounds(1080,280,100,40);
Del.setBounds(1080,360,100,40);
Clear.setBounds(1080,440,100,40);
View.setBounds(1080,520,100,40);
Ext.setBounds(1080,600,100,40);
t3.setEnabled(false);
t4.setEnabled(false);
New.addActionListener(this);
Upd.addActionListener(this);
Clear.addActionListener(this);
View.addActionListener(this);
Ext.addActionListener(this);
t6.addKeyListener(this);
t7.addKeyListener(this);
cust.addItemListener(this);
lo.add(l1);
lo.add(t1);
lo.add(l2);
lo.add(cust);
lo.add(l3);
lo.add(t2);
lo.add(l4);
lo.add(t3);
lo.add(l5);
lo.add(t4);
lo.add(l6);
lo.add(t5);
lo.add(l7);
lo.add(t6);
lo.add(l8);
lo.add(t7);
lo.add(New);
lo.add(Upd);
lo.add(Del);
lo.add(Clear);
lo.add(View);
lo.add(Ext);
setVisible(true);
}
88
public void cleartext()
{
t1.setText(null);
t2.setText(null);
t3.setText(null);
t4.setText(null);
t5.setText(null);
t6.setText(null);
t7.setText(null);
}
if(!Character.isDigit(k.getKeyChar()))
{
if(!Character.isDigit(k.getKeyChar()))
{
}
public void keyReleased(KeyEvent k)
{}
public void keyTyped(KeyEvent k)
{}
try{
if(a1.getSource()==New)
89
{
cleartext();
rs=st.executeQuery("select ord_id from orders");
if(rs.last())
t1.setText(Integer.toString((rs.getInt(1)+1)));
else
t1.setText("1");
try{
Calendar cal=Calendar.getInstance();
String dt1=cal.get(Calendar.DATE)+"/"+(cal.get(Calendar.MONTH)+1)+"/"+cal.get(Calendar.YEAR);
SimpleDateFormat sdf=new SimpleDateFormat("dd/MM/yyyy");
String dt2=null;
int d=cal.get(Calendar.DATE);
cal.add(Calendar.DATE,8);
int dy=cal.get(Calendar.DATE);
if(dy<d)
dt2=cal.get(Calendar.DATE)+"/"+(cal.get(Calendar.MONTH)+1)+"/"+cal.get(Calendar.YEAR);
else
dt2=cal.get(Calendar.DATE)+"/"+cal.get(Calendar.MONTH)+"/"+cal.get(Calendar.YEAR);
t3.setText(dt1);
t4.setText(dt2);
}catch(Exception e){}
}
else
if(a1.getSource()==Upd)
{
String cn=(String)cust.getSelectedItem();
String sn=cn.substring(0,cn.indexOf(" "));
90
st.executeUpdate(ins);
JOptionPane.showMessageDialog(this,"Sales Order Entered");
}
}
else
if(a1.getSource()==View)
{
if(t1.getText().equals(""))
JOptionPane.showMessageDialog(this,"Enter Sales Order No:");
else
{
rs=st.executeQuery("select * from orders where ord_id="+t1.getText());
if(rs.next())
{
t2.setText(rs.getString("orderdesc"));
t3.setText(rs.getString("ord_date"));
t4.setText(rs.getString("del_date"));
t5.setText(rs.getString("design_no"));
t6.setText(rs.getString("advance"));
t7.setText(rs.getString("totalamt"));
int cid=rs.getInt("cust_id");
rs1=st.executeQuery("select * from Customer where cust_id="+cid);
rs1.next();
cust.setSelectedItem(rs1.getString("cust_name"));
}
else
JOptionPane.showMessageDialog(this,"No such Sales Order Number Exists");
}
}
else
if(a1.getSource()==Clear)
{
cleartext();
}
else
if(a1.getSource()==Ext)
{
rs.close();
this.setVisible(false);
}
}catch(SQLException s){JOptionPane.showMessageDialog(this,s);}
}
public void itemStateChanged(ItemEvent i) {}
91
JEWELLERY SERVICE ORDER ENTRY FORM: ServiceEntryForm.java
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
import java.util.*;
import java.text.*;
JTextField t1,t2,t3,t4,t5,t6;
ImageIcon img;
JLabel lo,ll,l,l0,l1,l2,l3,l4,l5,l6,l7;
JButton New,Upd,View,Clear,Ext,Del;
JComboBox cust;
Connection cn1;
ResultSet rs,rs1;
Statement st;
Class.forName("com.mysql.jdbc.Driver");
cn1=DriverManager.getConnection("jdbc:mysql://localhost:3306/jewel?user=root&password=");
st=cn1.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
rs1=st.executeQuery("select * from Customer");
rs=st.executeQuery("select * from service");
}catch(ClassNotFoundException e){JOptionPane.showMessageDialog(this,e);}
catch(SQLException s){JOptionPane.showMessageDialog(this,s);}
}
public ServiceEntryForm()
{
super("Service Entry Form");
Container c1=getContentPane();
Toolkit kit = Toolkit.getDefaultToolkit();
Dimension screens = kit.getScreenSize();
int scrh = screens.height;
int scrw = screens.width;
setBackground( Color.LIGHT_GRAY);
setForeground(new Color(0,150,0));
setSize( scrw , scrh );
92
setLocation( 0 , 0 );
img=new ImageIcon("background.jpg");
lo = new JLabel(img);
lo.setBounds(0,0,scrw,scrh);
l.setBounds(320,10,1000,100) ;
ll.setBounds(500,100,1000,50) ;
t1=new JTextField();
t2=new JTextField();
t3=new JTextField();
t4=new JTextField();
t5=new JTextField();
t6=new JTextField();
New=new JButton("New");
Upd=new JButton("Save");
View=new JButton("View");
Ext=new JButton("Exit");
Del=new JButton("Delete");
Clear=new JButton("Clear");
New.setFont(new Font("Script MT Bold",Font.BOLD,20));
Upd.setFont(new Font("Script MT Bold",Font.BOLD,20));
Del.setFont(new Font("Script MT Bold",Font.BOLD,20));
View.setFont(new Font("Script MT Bold",Font.BOLD,20));
Ext.setFont(new Font("Script MT Bold",Font.BOLD,20));
Clear.setFont(new Font("Script MT Bold",Font.BOLD,20));
cust=new JComboBox();
try
{
con();
rs1=st.executeQuery("select * from CUSTOMER");
while(rs1.next())
{
cust.addItem(rs1.getString("cust_name")+" "+rs1.getString("mobile_no"));
}
}catch(SQLException s){
}
93
l1=new JLabel("Service Order No:");
l2=new JLabel("Select Customer Name:");
l3=new JLabel("Service Description:");
l4=new JLabel("Service Order Date:");
l5=new JLabel("Service Delivery Date:");
l6=new JLabel("Advance Paid Rs:");
l7=new JLabel("Total Amount Rs:");
c1.setLayout(null);
c1.add(lo);
lo.add(l);
lo.add(ll);
l1.setBounds(450,200,200,30);
t1.setBounds(670,200,100,30);
l2.setBounds(450,260,220,30);
cust.setBounds(670,260,300,30);
l3.setBounds(450,320,200,30);
t2.setBounds(670,320,300,30);
l4.setBounds(450,380,200,30);
t3.setBounds(670,380,150,30);
l5.setBounds(450,440,200,30);
t4.setBounds(670,440,150,30);
94
l6.setBounds(450,500,200,30);
t5.setBounds(670,500,150,30);
l7.setBounds(450,560,200,30);
t6.setBounds(670,560,150,30);
New.setBounds(1000,200,100,40);
Upd.setBounds(1000,280,100,40);
Del.setBounds(1000,360,100,40);
Clear.setBounds(1000,440,100,40);
View.setBounds(1000,520,100,40);
Ext.setBounds(1000,600,100,40);
New.addActionListener(this);
Upd.addActionListener(this);
Clear.addActionListener(this);
View.addActionListener(this);
Ext.addActionListener(this);
t2.addKeyListener(this);
cust.addItemListener(this);
lo.add(l1);
lo.add(t1);
lo.add(l2);
lo.add(cust);
lo.add(l3);
lo.add(t2);
lo.add(l4);
lo.add(t3);
lo.add(l5);
lo.add(t4);
lo.add(l6);
lo.add(t5);
lo.add(l7);
lo.add(t6);
lo.add(New);
lo.add(Upd);
lo.add(Del);
lo.add(Clear);
lo.add(View);
lo.add(Ext);
setVisible(true);
95
}
if(!Character.isDigit(k.getKeyChar()))
{
}
public void keyReleased(KeyEvent k)
{}
public void keyTyped(KeyEvent k)
{}
try{
if(a1.getSource()==New)
{
cleartext();
rs=st.executeQuery("select service_id from service");
if(rs.last())
t1.setText(Integer.toString((rs.getInt(1)+1)));
else
t1.setText("1");
try{
96
Calendar cal=Calendar.getInstance();
String dt1=cal.get(Calendar.DATE)+"/"+(cal.get(Calendar.MONTH)+1)+"/"+cal.get(Calendar.YEAR);
SimpleDateFormat sdf=new SimpleDateFormat("dd/MM/yyyy");
String dt2=null;
int d=cal.get(Calendar.DATE);
cal.add(Calendar.DATE,8);
int dy=cal.get(Calendar.DATE);
if(dy<d)
dt2=cal.get(Calendar.DATE)+"/"+(cal.get(Calendar.MONTH)+1)+"/"+cal.get(Calendar.YEAR);
else
dt2=cal.get(Calendar.DATE)+"/"+cal.get(Calendar.MONTH)+"/"+cal.get(Calendar.YEAR);
t3.setText(dt1);
t4.setText(dt2);
}catch(Exception e){}
}
else
if(a1.getSource()==Upd)
{
String cn=(String)cust.getSelectedItem();
String sn=cn.substring(0,cn.indexOf(" "));
st.executeUpdate(ins);
JOptionPane.showMessageDialog(this,"Service Entered");
}
}
else
if(a1.getSource()==View)
97
{
if(t1.getText().equals(""))
JOptionPane.showMessageDialog(this,"Enter service No:");
else
{
rs=st.executeQuery("select * from service where service_id="+t1.getText());
if(rs.next())
{
t2.setText(rs.getString("service_desc"));
t3.setText(rs.getString("service_dt"));
t4.setText(rs.getString("delivery_dt"));
t5.setText(rs.getString("advance"));
t6.setText(rs.getString("totalamt"));
int cid=rs.getInt("cust_id");
rs1=st.executeQuery("select * from Customer where cust_id="+cid);
rs1.next();
cust.setSelectedItem(rs1.getString("cust_name"));
}
else
JOptionPane.showMessageDialog(this,"No such Order Number Exists");
}
}
else
if(a1.getSource()==Clear)
{
cleartext();
}
else
if(a1.getSource()==Ext)
{
rs.close();
this.setVisible(false);
}
}catch(SQLException s){JOptionPane.showMessageDialog(this,s);}
}
public void itemStateChanged(ItemEvent i)
{}
public static void main(String[] args)
{
new ServiceEntryForm();
}
}
98
JEWELLERY ORDER DELIVERY FORM: OrderDeliveryForm.java
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
JTextField t1,t2,t3,t4,t5,t6,t7,t8,t9;
ImageIcon img;
JLabel lo,ll,l,l0,l1,l2,l3,l4,l5,l6,l7,l8,l9;
JButton Upd,View,Clear,Ext;
Connection cn1;
ResultSet rs,rs1;
Statement st;
Class.forName("com.mysql.jdbc.Driver");
cn1=DriverManager.getConnection("jdbc:mysql://localhost:3306/jewel","root","");
st=cn1.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
rs1=st.executeQuery("select * from Customer");
rs=st.executeQuery("select * from orders");
}catch(ClassNotFoundException e){JOptionPane.showMessageDialog(this,e);}
catch(SQLException s){JOptionPane.showMessageDialog(this,s);}
}
public OrderDeliveryForm()
{
super("Order Entry Form");
Container c1=getContentPane();
Toolkit kit = Toolkit.getDefaultToolkit();
Dimension screens = kit.getScreenSize();
int scrh = screens.height;
int scrw = screens.width;
setBackground( Color.LIGHT_GRAY);
setForeground(new Color(0,150,0));
setSize( scrw , scrh );
setLocation( 0 , 0 );
img=new ImageIcon("background.jpg");
99
l = new JLabel("TARA JEWELLARS ");
l.setFont(new Font("Garamond",Font.BOLD,40));
l.setForeground( new Color(212,175,55));
lo = new JLabel(img);
lo.setBounds(0,0,scrw,scrh);
l.setBounds(320,30,1000,50) ;
ll.setBounds(500,100,1000,50) ;
t1=new JTextField();
t2=new JTextField();
t3=new JTextField();
t4=new JTextField();
t5=new JTextField();
t6=new JTextField();
t7=new JTextField();
t8=new JTextField();
t9=new JTextField();
l1.setBounds(450,180,200,30);
t1.setBounds(650,180,100,30);
l2.setBounds(450,240,200,30);
t2.setBounds(650,240,200,30);
l3.setBounds(450,300,200,30);
t3.setBounds(650,300,300,30);
l4.setBounds(450,360,200,30);
t4.setBounds(650,360,150,30);
l5.setBounds(450,420,200,30);
t5.setBounds(650,420,150,30);
l6.setBounds(450,480,200,30);
t6.setBounds(650,480,100,30);
l7.setBounds(450,540,200,30);
t7.setBounds(650,540,100,30);
l8.setBounds(450,600,200,30);
t8.setBounds(650,600,100,30);
l9.setBounds(450,660,200,30);
t9.setBounds(650,660,100,30);
101
Upd.setBounds(1050,200,160,40);
Clear.setBounds(1050,300,160,40);
View.setBounds(1050,400,160,40);
Ext.setBounds(1050,500,160,40);
Upd.addActionListener(this);
Clear.addActionListener(this);
View.addActionListener(this);
Ext.addActionListener(this);
lo.add(l1);
lo.add(t1);
lo.add(l2);
lo.add(t2);
lo.add(l3);
lo.add(t3);
lo.add(l4);
lo.add(t4);
lo.add(l5);
lo.add(t5);
lo.add(l6);
lo.add(t6);
lo.add(l7);
lo.add(t7);
lo.add(l8);
lo.add(t8);
lo.add(l9);
lo.add(t9);
lo.add(Upd);
lo.add(Clear);
lo.add(View);
lo.add(Ext);
setVisible(true);
}
cleartext();
}
else
if(a1.getSource()==Ext)
{
rs.close();
this.setVisible(false);
}
}catch(SQLException s){JOptionPane.showMessageDialog(this,s);}
}
}
103
JEWELLERY SERVICE ORDER DELIVERY FORM: ServiceDeliveryForm.java
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
JTextField t1,t2,t3,t4,t5,t6,t7,t8;
ImageIcon img;
JLabel lo,ll,l,l0,l1,l2,l3,l4,l5,l6,l7,l8;
JButton New,Upd,View,Clear,Ext,Del;
JComboBox cust;
Connection cn1;
ResultSet rs,rs1;
Statement st;
Class.forName("com.mysql.jdbc.Driver");
cn1=DriverManager.getConnection("jdbc:mysql://localhost:3306/jewel?user=root&password=");
st=cn1.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
rs1=st.executeQuery("select * from Customer");
rs=st.executeQuery("select * from service");
}catch(ClassNotFoundException e){JOptionPane.showMessageDialog(this,e);}
catch(SQLException s){JOptionPane.showMessageDialog(this,s);}
}
public ServiceDeliveryForm()
{
super("Service Entry Form");
Container c1=getContentPane();
Toolkit kit = Toolkit.getDefaultToolkit();
Dimension screens = kit.getScreenSize();
int scrh = screens.height;
int scrw = screens.width;
setBackground( Color.LIGHT_GRAY);
setForeground(new Color(0,150,0));
setSize( scrw , scrh );
setLocation( 0 , 0 );
104
img=new ImageIcon("background.jpg");
lo = new JLabel(img);
lo.setBounds(0,0,scrw,scrh);
l.setBounds(320,10,1000,100) ;
ll.setBounds(500,100,1000,50) ;
t1=new JTextField();
t2=new JTextField();
t3=new JTextField();
t4=new JTextField();
t5=new JTextField();
t6=new JTextField();
t7=new JTextField();
t8=new JTextField();
Upd=new JButton("Deliver");
View=new JButton("View");
Ext=new JButton("Exit");
Clear=new JButton("Clear");
c1.setLayout(null);
c1.add(lo);
lo.add(l);
lo.add(ll);
l1.setBounds(450,200,200,30);
t1.setBounds(650,200,100,30);
l2.setBounds(450,260,200,30);
t2.setBounds(650,260,150,30);
l3.setBounds(450,320,200,30);
t3.setBounds(650,320,300,30);
l4.setBounds(450,380,200,30);
t4.setBounds(650,380,150,30);
l5.setBounds(450,440,200,30);
t5.setBounds(650,440,150,30);
l6.setBounds(450,500,200,30);
t6.setBounds(650,500,100,30);
l7.setBounds(450,560,200,30);
t7.setBounds(650,560,100,30);
l8.setBounds(450,620,200,30);
t8.setBounds(650,620,100,30);
Upd.setBounds(1000,260,100,40);
Clear.setBounds(1000,380,100,40);
106
View.setBounds(1000,500,100,40);
Ext.setBounds(1000,620,100,40);
Upd.addActionListener(this);
Clear.addActionListener(this);
View.addActionListener(this);
Ext.addActionListener(this);
lo.add(l1);
lo.add(t1);
lo.add(l2);
lo.add(t2);
lo.add(l3);
lo.add(t3);
lo.add(l4);
lo.add(t4);
lo.add(l5);
lo.add(t5);
lo.add(l6);
lo.add(t6);
lo.add(l7);
lo.add(t7);
lo.add(l8);
lo.add(t8);
lo.add(Upd);
lo.add(Clear);
lo.add(View);
lo.add(Ext);
setVisible(true);
}
try{
if(a1.getSource()==Upd)
{
st.executeUpdate("update service set completed=1 where service_id="+t1.getText());
JOptionPane.showMessageDialog(this,"Service Order Delivered");
}
else
if(a1.getSource()==View)
{
if(t1.getText().equals(""))
JOptionPane.showMessageDialog(this,"Enter service No:");
else
{
rs=st.executeQuery("select * from service where service_id="+t1.getText());
if(rs.next())
{
t3.setText(rs.getString("service_desc"));
t4.setText(rs.getString("service_dt"));
t5.setText(rs.getString("delivery_dt"));
t6.setText(rs.getString("totalamt"));
t7.setText(rs.getString("advance"));
t8.setText(Integer.toString(Integer.parseInt(t6.getText())-Integer.parseInt(t7.getText())));
int cid=rs.getInt("cust_id");
rs1=st.executeQuery("select * from Customer where cust_id="+cid);
rs1.next();
t2.setText(rs1.getString("cust_name"));
}
else
JOptionPane.showMessageDialog(this,"No such Service Order Number Exists");
}
}
else
if(a1.getSource()==Clear)
{
cleartext();
}
else
if(a1.getSource()==Ext)
{
rs.close();
this.setVisible(false);
}
}catch(SQLException s){JOptionPane.showMessageDialog(this,s);}
}
public void itemStateChanged(ItemEvent i)
{}
}
108
VIEW CUSTOMERS: CustomerReport.java
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
import java.io.*;
import java.util.*;
import javax.swing.table.*;
ii=new ImageIcon("background.jpg");
lbl1 = new JLabel(ii);
lbl1.setBounds(0,0,scrw,scrh);
c.add(lbl1);
109
lbl1.add(lbl2);
int v= ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
int h= ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
jsp = new JScrollPane(tab,v,h);
jsp.setFont(new Font("Monotype Corsiva",Font.BOLD,20));
jsp.setBounds(450,200,scrw-500,scrh-400);
110
lbl1.add(l);
lbl1.add(jsp);
lbl1.add(lbl3);
lbl1.add(lbl4);
setVisible(true);
setSize(scrw,scrh);
}
ii=new ImageIcon("background.jpg");
lbl1 = new JLabel(ii);
lbl1.setBounds(0,0,scrw,scrh);
c.add(lbl1);
while(rs.next())
{
Object[] data=new Object[5];
data[0]=rs.getInt(1);
data[1]=rs.getString(3);
data[2]=rs.getString(8);
data[3]=rs.getInt(4);
data[4]=rs.getInt(6);
dtm.addRow(data);
tot++;
}
lbl4.setText(Integer.toString(tot));
}//try
catch(Exception e)
{
System.out.println("SQL Error : "+e.getMessage());
System.exit(0);
}
}//if
else if(a.getSource()==Print)
{
PrintJob printjob = getToolkit().getPrintJob(this, "Print graphics", null);
Graphics g = printjob.getGraphics();
g.drawRect(120,20,350,30);
printjob.end();
}
else if(a.getSource()==Close)
this.setVisible(false);
}
}
114
VIEW PENDING SERVICE ORDER: PendingServiceOrderReport.java
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
import java.io.*;
import java.util.*;
import java.awt.print.*;
import javax.swing.table.*;
JScrollPane jsp;
Connection cn1;
Statement st1;
ResultSet rs,rs1;
DefaultTableModel dtm;
JLabel l,lbl1,lbl2,lbl3,lbl4,lbl5,lbl6;
ImageIcon ii;
Class.forName("com.mysql.jdbc.Driver");
cn1=DriverManager.getConnection("jdbc:mysql://localhost:3306/jewel?user=root&password=");
st1=cn1.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE)
;
}catch(ClassNotFoundException e){JOptionPane.showMessageDialog(this,e);}
catch(SQLException s){JOptionPane.showMessageDialog(this,s);}
}
PendingServiceOrderReport()
{
super("Pending Service Orders Report");
Container c= getContentPane();
c.setLayout(null);
ii=new ImageIcon("background.jpg");
lbl1 = new JLabel(ii);
lbl1.setBounds(0,0,scrw,scrh);
c.add(lbl1);
l = new JLabel("TARA JEWELLARS ");
l.setFont(new Font("Garamond",Font.BOLD,40));
l.setForeground( new Color(212,175,55));
l.setBounds(320,20,800,50) ;
lbl1.add(l);
int v= ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
int h= ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
jsp = new JScrollPane(tab,v,h);
jsp.setFont(new Font("MT Bold",Font.BOLD,20));
jsp.setBounds(450,200,scrw-500,scrh-400);
lbl1.setBounds(0,0,scrw,scrh);
lbl1.setLayout(null);
lbl1.add(jsp);
lbl1.add(lbl3);
lbl1.add(lbl4);
lbl1.add(lbl5);
lbl1.add(lbl6);
setVisible(true);
setSize(scrw,scrh);
if(a.getSource()==View)
117
{
try
{
con();
int tot=0,bamt=0;
String str="select service.*,cust_name from service,customer where service.cust_id=customer.cust_id
and completed=0";
rs=st1.executeQuery(str);
Object[] data=new Object[5];
while(rs.next())
{
data[0]=rs.getInt(1);
data[1]=rs.getString(2);
data[2]=rs.getString(3);
data[3]=rs.getString(4);
data[4]=rs.getString(9);
dtm.addRow(data);
tot++;
}
str="select * from service where completed=0";
rs=st1.executeQuery(str);
while(rs.next())
bamt=bamt+(rs.getInt(6)-rs.getInt(5));
rs.close();
lbl4.setText(Integer.toString(tot));
lbl6.setText(Integer.toString(bamt));
}//try
catch(Exception e)
{
System.out.println("SQL Errors"+e.getMessage());
System.exit(0);
}
}//if
else if(a.getSource()==Print)
{
PrintJob printjob = getToolkit().getPrintJob(this, "Print graphics", null);
Graphics g = printjob.getGraphics();
g.drawRect(120,20,350,30);
printjob.end();
}
else if(a.getSource()==Close)
this.setVisible(false);
}
}
118
VIEW PENDING SALES ORDER: PendingOrderReport.java
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
import java.io.*;
import java.util.*;
import java.awt.print.*;
import javax.swing.table.*;
JScrollPane jsp;
Connection cn1;
Statement st1;
ResultSet rs,rs1;
DefaultTableModel dtm;
JLabel l,lbl1,lbl2,lbl3,lbl4,lbl5,lbl6;
ImageIcon ii;
}catch(ClassNotFoundException e){JOptionPane.showMessageDialog(this,e);}
catch(SQLException s){JOptionPane.showMessageDialog(this,s);}
}
PendingOrderReport()
{
super("Pending Sales Orders Report");
Container c= getContentPane();
c.setLayout(null);
ii=new ImageIcon("background.jpg");
lbl1 = new JLabel(ii);
119
lbl1.setBounds(0,0,scrw,scrh);
c.add(lbl1);
int v= ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
int h= ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
jsp = new JScrollPane(tab,v,h);
jsp.setFont(new Font("MT Bold",Font.BOLD,20));
jsp.setBounds(450,200,scrw-500,scrh-400);
lbl1.setBounds(0,0,scrw,scrh);
lbl1.setLayout(null);
lbl1.add(jsp);
lbl1.add(lbl3);
lbl1.add(lbl4);
lbl1.add(lbl5);
lbl1.add(lbl6);
setBackground(Color.BLACK);
setVisible(true);
setSize(scrw,scrh);
if(a.getSource()==View)
{
try
{
121
con();
int tot=0,bamt=0;
String str="select ord_id,orderdesc,ord_date,del_date,cust_name,totalamt,advance from orders,customer
where orders.cust_id=customer.cust_id and completed=0";
rs=st1.executeQuery(str);
Object[] data=new Object[6];
while(rs.next())
{
data[0]=rs.getInt(1);
data[1]=rs.getString(2);
data[2]=rs.getString(3);
data[3]=rs.getString(4);
data[4]=rs.getString(5);
data[5]=rs.getInt(6)-rs.getInt(7);
dtm.addRow(data);
tot++;
}
str="select * from orders where completed=0";
rs=st1.executeQuery(str);
while(rs.next())
bamt=bamt+(rs.getInt(8)-rs.getInt(7));
rs.close();
lbl5.setText(Integer.toString(tot));
lbl6.setText(Integer.toString(bamt));
}//try
catch(Exception e)
{
System.out.println("SQL Errors"+e.getMessage());
System.exit(0);
}
}//if
else if(a.getSource()==Print)
{
PrintJob printjob = getToolkit().getPrintJob(this, "Print graphics", null);
Graphics g = printjob.getGraphics();
g.drawRect(120,20,350,30);
printjob.end();
}
else if(a.getSource()==Close)
this.setVisible(false);
}
}
122
VIEW SALES BILL: SaleBillReport.java
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
import java.io.*;
import java.util.*;
import java.awt.print.*;
import javax.swing.table.*;
Class.forName("com.mysql.jdbc.Driver");
cn1=DriverManager.getConnection("jdbc:mysql://localhost:3306/jewel","root","");
st1=cn1.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE)
;
}catch(ClassNotFoundException e){JOptionPane.showMessageDialog(this,e);}
catch(SQLException s){JOptionPane.showMessageDialog(this,s);}
}
SaleBillReport()
{
super("Sales Bills Report");
Container c= getContentPane();
c.setLayout(null);
ii=new ImageIcon("background.jpg");
lbl1 = new JLabel(ii);
lbl1.setBounds(0,0,scrw,scrh);
c.add(lbl1);
l = new JLabel("TARA JEWELLARS ");
l.setFont(new Font("Garamond",Font.BOLD,40));
l.setForeground( new Color(212,175,55));
l.setBounds(320,20,800,50) ;
lbl1.add(l);
lbl1.add(Close);
Close.setBounds(1090,150,200,30);
Close.addActionListener(this);
lbl1.add(lbl3);
lbl1.add(lbl4);
lbl1.add(lbl5);
lbl1.add(lbl6);
setBackground(Color.white);
setVisible(true);
setSize(scrw,scrh);
125
}
public void actionPerformed(ActionEvent a)
{
if(a.getSource()==View)
{
try
{
con();
int tot=0,bamt=0;
String str="select bill.*,cust_name from bill,customer where bill.cust_id=customer.cust_id and
cust_name='"+(String)cust.getSelectedItem()+"'";
rs=st1.executeQuery(str);
Object[] data=new Object[5];
while(rs.next())
{
data[0]=rs.getString(1);
data[1]=rs.getString(3);
data[2]=rs.getString(5);
data[3]=rs.getInt(4);
dtm.addRow(data);
tot++;
}
str="select bill.*,cust_name from bill,customer where bill.cust_id=customer.cust_id and
cust_name='"+(String)cust.getSelectedItem()+"'";
rs=st1.executeQuery(str);
while(rs.next())
bamt=bamt+rs.getInt(4);
rs.close();
lbl4.setText(Integer.toString(tot));
lbl6.setText(Integer.toString(bamt));
}//try
catch(Exception e)
{
System.out.println("SQL Errors"+e.getMessage());
System.exit(0);
}
}//if
else if(a.getSource()==Print)
{
PrintJob printjob = getToolkit().getPrintJob(this, "Print graphics", null);
Graphics g = printjob.getGraphics();
g.drawRect(120,20,350,30);
printjob.end();
}
else if(a.getSource()==Close)
this.setVisible(false);
}
}
126
LIMITATION AND FUTURE ENHANCEMENT
This system is developed such a way that additional enhancement can be done without much difficulty.
The renovation of the project would increase the flexibility of the system.
Also the features are provided in such a way that the system can also be made better and efficient
functionality.
The programs were coded in an easier and more structured manner so that may further modifications
may be incorporated easily.
The processing time in this system is very lesser compared to existing system.
This system has good flexibility of accommodating any more changes that might arise in the future also.
In this system, data integrity is maintained and data redundancy is avoided and it increase system
efficiency.
The database is designed in such a way that it will be also helpful for enhancement of the system.
127
BIBLIOGRAPHY
128