Академический Документы
Профессиональный Документы
Культура Документы
A Project Report
on
For
AISSCE 2011 Examination
[As a part of the Informatics Practices Course (065)]
SUBMITTED BY
KEERTHANA PRIYA.K
………………………… ……………………………..
Signature of Student Signature of Teacher/Guide
……….…………………
Signature of Principal
Name: ………………….
Place:…………….
Date:……………..
ACKNOWLEDGEMENT
undertook this Project work, as the part of my XII-
3. Theoretical Background------------------------------------------------ 9
7.4 I/O Forms Design & Event Coding:Error! Bookmark not defined.
functionaries.
is tied with the database for easy access and interface to the database.
This software, being simple in design and working, does not require
During coding and design of the software Project, Java NetBeans IDE,
In its current scope, the software enables user to retrieve and update the information
from centralized database designed with MySQL . This software does not require much
training time of the users due to limited functionality and simplicity.
During the development of Optical shop Information System project, Java NetBeans
IDE, a powerful, open source event-driven form-based development environment is
used for modular design and future expandability of the system.
Despite of the best effort of the developer, the following limitations and functional
boundaries are visible, which limits the scope of this application software.
1. This software can store records and produce reports in pre-designed format in
soft copy. There is no facility yet to produce customized reports. Only specified
reports are covered.
3. Some application area like accounting of books and fines etc. are not
implemented in the project. It facilitates employee to record and update only
transaction record.
So far as future scope of the project is concerned, firstly it is open to any modular
expansion i.e. other modules or functions can be designed and embedded to handle the
user need in future. Any part of the software and reports can be modified independently
without much effort.
3. Theoretical Background
To find and retrieve just the data that meets conditions you specify, including data from
multiple tables, create a query. A query can also update or delete multiple records at
the same time, and perform built-in or custom calculations on your data.
Features of NetBeans
A free, open-source Integrated Development Environment for software developers. You
get all the tools you need to create professional desktop, enterprise, web, and mobile
applications with the Java platform, as well as C/C++, PHP, JavaScript, Groovy, and
Ruby.
4. Problem Definition & Analysis
Problem definition describes the What of a system, not How . The quality of a software
product is only as good as the process that creates it. Problem definition is one of the
most crucial steps in this creation process. Without defining a problem, developers do
not know what to build, customers do not know what to expect, and there is no way to
validate that the built system satisfies the requirement.
Problem definition and Analysis is the activity that encompasses learning about the
problem to be solved, understanding the needs of customer and users, trying to find out
who the user really is, and understanding all the constraints on the solution. It includes
all activities related to the following:
Identification and documentation of customer’s or user’s needs.
Creation of a document that describes the external behavior and the association
constraints that will satisfies those needs.
Analysis and validation of the requirements documents to ensure consistency,
completeness, and feasibility
Evolution of needs.
After the analysis of the functioning of a Optical shop system, the proposed System is
expected to do the following: -
To provide a user friendly, Graphical User Interface (GUI) based integrated and
centralized environment for computerized Public Library System.
The proposed system should maintain all the records and transactions, and
should generate the required reports and information when required.
To provide efficient and secured Information storage, flow and retrieval system,
ensuring the integrity and validity of records.
To provide graphical and user-friendly interface to interact with a centralized
database based on client-server architecture.
To identify the critical operation procedure and possibilities of simplification
using modern IT tools and practices.
5. System Implementation
Table Design:
The database of optical store System contains 5 tables. The tables are normalized to
minimize the redundancies of data and enforcing the validation rules of the
organization. Most of the tables are designed to store master records. The tables and
their structure are given below.
Table: customer
Column Name Type Size
Customer_nam VARCHAR (40)
Customer_id INT (60)
Address VARCHAR (40)
Phone_no VARCHAR (10)
Email_id VARCHAR (40)
Gender VARCHAR (10)
Table:
Column Name Type Size
Table:
Column Name Type Size
Table:
Column Name Type Size
Table:
Column Name Type Size
Table:
Column Name Type Size
Table:
Column Name Type Size
Table:
Column Name Type Size
Table:
Column Name Type Size
Table:
Column Name Type Size
Table:
Column Name Type Size
Table:
Column Name Type Size
Table:
Column Name Type Size
Table:
Column Name Type Size
Table:
Column Name Type Size
Table:
Column Name Type Size
Table:
Column Name Type Size
Table:
Column Name Type Size
Table:
Column Name Type Size
private void adminActionPerformed(java.awt.event.ActionEvent evt) {
this.dispose();
frames01a al=new frames01a();
al.setVisible(true);
else
}
private void back2ActionPerformed(java.awt.event.ActionEvent evt) {
this.dispose();
}
private void homeActionPerformed(java.awt.event.ActionEvent evt) {
this.dispose();
frame01intro rp=new frame01intro();
rp.setVisible(true);
}
import javax.swing.JOptionPane;
int c_id;
public frame04u4() {
initComponents();
gencid();
}
public void gencid()
{
try{
Class.forName("com.mysql.jdbc.Driver");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/ozzerve_optical_shop","root"
,"123456");
Statement st=con.createStatement();
PreparedStatement pst=null;
ResultSet rs;
String q="SELECT Customer_id from customer order by Customer_id desc limit 1";
pst =con.prepareStatement(q);
rs= pst.executeQuery();
if(rs.next())
{int c1=rs.getInt("Customer_id");
c1++;
c_id=c1;
}
else{
c_id=101;
}
st.close();
con.close();
}
catch(Exception e)
{JOptionPane.showMessageDialog(null,e);
}
citext.setText(""+c_id);
}
String Gender="";
if (mrb.isSelected()==true)
Gender="Male";
else if(frb.isSelected()==true)
Gender="Female";
else
Gender="Transgender";
try{
Class.forName("com.mysql.jdbc.Driver");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/ozzerve_optical_shop","root"
,"123456");
Statement st=con.createStatement();
String cnname=nctext.getText();
int id=Integer.parseInt(citext.getText());
String address =ata.getText();
String phoneno= pntxt.getText();
String emailid =eitxt.getText();
String q="Insert into customer
values('"+cnname+"',"+id+",'"+address+"','"+phoneno+"','"+emailid+"','"+Gender+"');";
st.executeUpdate(q);
JOptionPane.showMessageDialog(null,"Record Added");
st.close();
con.close();
}
catch(Exception e)
{JOptionPane.showMessageDialog(null,e);
}
}
public class frame05u5 extends javax.swing.JFrame {
public frame05u5() {
initComponents();
}
public frame05u5(String s1,String s2) {
initComponents();
l1.setText(s1);
l2.setText(s2);
}
String cn=l1.getText();
String cno=l2.getText();
this.dispose();
frame06u6 sm=new frame06u6(cn,cno);
sm.setVisible(true);
cn4.setText(s2);
fullgtable();
fullftable();
fullframe();} }
}
private void fullftable()
{
try{
Class.forName("com.mysql.jdbc.Driver");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/ozzerve_optical_shop","root"
,"123456");
Statement st=con.createStatement();
PreparedStatement pst=null;
ResultSet rs;
String q1="SELECT * from frames_details";
pst =con.prepareStatement(q1);
rs= pst.executeQuery();
DefaultTableModel tm=(DefaultTableModel)ftable.getModel();
tm.setRowCount(0);
while(rs.next())
{
Object
o[]={rs.getInt("Code_no"),rs.getString("Brand_Name"),rs.getString("Frame_Material"),rs.get
String("Color"),rs.getString("Shape_of_Frame"),rs.getDouble("Price"),rs.getInt("quantity")};
tm.addRow(o);
}
}
catch(Exception e)
{JOptionPane.showMessageDialog(null,e);
}
}
}
catch(Exception e)
{JOptionPane.showMessageDialog(null,e); }
}
}
}
catch(Exception e)
{JOptionPane.showMessageDialog(null,e); }
}
try {
Class.forName("com.mysql.jdbc.Driver");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/ozzerve_optical_shop","root"
,"123456");
Statement st=con.createStatement();
DefaultTableModel model=(DefaultTableModel)gtablebill.getModel();
int r=gtablebill.getRowCount();
if(r==0)
return;
for(int i=0;i<r;i++)
{
int qty=Integer.parseInt(model.getValueAt(i, 4).toString());
if(qty==0)
JOptionPane.showMessageDialog(null,"quantity not inserted");
return;
}
for(int i=0;i<r;i++)
{
float tprice=Float.parseFloat(model.getValueAt(i, 7).toString());
float qty=Float.parseFloat(model.getValueAt(i, 4).toString());
float powerl=Float.parseFloat(model.getValueAt(i, 5).toString());
float powerr=Float.parseFloat(model.getValueAt(i, 6).toString());
float gcode=Float.parseFloat(model.getValueAt(i, 0).toString());
String st1="pending";
String q="Insert into bill_glass values('"+billno+"','"+billdate+"','"+cid+"','"+gcode+"'
,'"+tprice+"','"+powerr+"','"+powerl+"','"+qty+"');";
st.executeUpdate(q);
JOptionPane.showMessageDialog(null,"Connected");
String q1="Insert into bill values('"+billno+"','"+cid+"','"+st1+"','"+gcode+"');";
st.executeUpdate(q1);
}
JOptionPane.showMessageDialog(null,"Records Inserted");
st.close();
con.close();
}
catch (Exception ex) {
Logger.getLogger(frame06u6.class.getName()).log(Level.SEVERE, null, ex);
}
}
DefaultTableModel model=(DefaultTableModel)ftablebill.getModel();
int r=ftablebill.getRowCount();
if(r==0)
return;
for(int i=0;i<r;i++)
{
int qty=Integer.parseInt(model.getValueAt(i, 6).toString());
if(qty==0)
{
JOptionPane.showMessageDialog(null,"quantity not inserted");
return;
}}
for(int i=0;i<r;i++)
{
float tprice=Float.parseFloat(model.getValueAt(i, 7).toString());
float qty=Float.parseFloat(model.getValueAt(i, 6).toString());
float fcode=Float.parseFloat(model.getValueAt(i, 0).toString());
String st1="pending";
st.close();
con.close();
cn2.setText(s2);
fullftable();
fullframe();
Statement st=con.createStatement();
PreparedStatement pst=null;
ResultSet rs;
String q1="SELECT * from lens_details";
pst =con.prepareStatement(q1);
rs= pst.executeQuery();
DefaultTableModel tm=(DefaultTableModel)ltable.getModel();
tm.setRowCount(0);
while(rs.next())
{
Object
o[]={rs.getInt("lens_code"),rs.getString("Lens_Designs"),rs.getString("Lens_Type"),rs.getStri
ng("Color"),rs.getString("Brand"),rs.getString("Disposability"),rs.getDouble("Price"),rs.getIn
t("quantity")};
tm.addRow(o);
}
}
catch(Exception e)
{JOptionPane.showMessageDialog(null,e);
}
String cno=cn2.getText();
String nu=bn.getText();
DefaultTableModel model1=(DefaultTableModel)ltable.getModel();
DefaultTableModel model2=(DefaultTableModel)ltablebill.getModel();
int [] ind=ltable.getSelectedRows();
for(int i=0;i<ind.length;i++)
{
Object[] row={model1.getValueAt(ind[i],
0),model1.getValueAt(ind[i],1),model1.getValueAt(ind[i], 2),model1.getValueAt(ind[i],
3),model1.getValueAt(ind[i], 4),model1.getValueAt(ind[i], 5),0,0,model1.getValueAt(ind[i],
8),0};
model2.addRow(row);
}
}
private void ltableMouseClicked(java.awt.event.MouseEvent evt) {
try{
Class.forName("com.mysql.jdbc.Driver");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/ozzerve_optical_shop","root"
,"123456");
Statement st=con.createStatement();
PreparedStatement pst=null;
ResultSet rs;
int row=ltable.getSelectedRow();
String tc=(ltable.getModel().getValueAt(row,0).toString());
String q1="SELECT * from lens_details where lens_code='"+tc+"'";
pst =con.prepareStatement(q1);
rs= pst.executeQuery();
if(rs.next())
{
String tf=rs.getString("Lens_Designs");
String lt=rs.getString("Lens_Type");
String co=rs.getString("Color");
String bd=rs.getString("Brand");
String dis=rs.getString ("Disposability");
double tprice=rs.getDouble("Price");
int lcode=rs.getInt("lens_code");
int qty=rs.getInt("quantity");
}
}
catch(Exception e)
{JOptionPane.showMessageDialog(null,e); }
}
DefaultTableModel model=(DefaultTableModel)ltablebill.getModel();
int r=ltablebill.getRowCount();
if(r==0)
return;
for(int i=0;i<r;i++)
{
int qty=Integer.parseInt(model.getValueAt(i, 9).toString());
if(qty==0)
{
JOptionPane.showMessageDialog(null,"quantity not inserted");
return;
}}
for(int i=0;i<r;i++)
{
float tprice=Float.parseFloat(model.getValueAt(i, 10).toString());
float qty=Float.parseFloat(model.getValueAt(i, 9).toString());
float lcode=Float.parseFloat(model.getValueAt(i, 0).toString());
float powerl=Float.parseFloat(model.getValueAt(i, 7).toString());
float powerr=Float.parseFloat(model.getValueAt(i, 6).toString());
String st1="pending";
st.close();
con.close();
} catch (Exception ex) {
Logger.getLogger(frame07u7.class.getName()).log(Level.SEVERE, null, ex);
}
}
import java.sql.*;
import java.text.SimpleDateFormat;
import java.util.Locale;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
}
public frame08u8bglass(String s1,String s2,String s3,String s4,String s5,String s6,String
s7,String s8,String s9, String s10) {
initComponents();
per1.setText(s1);
bdate.setText(s10);
per.setText(s2);
qn.setText(s3);
this.tg=s4;
this.co=s5;
this.por=s6;
this.pol=s7;
this.qt=s8;
this.pri=s9;
ftable();
}
private void initComponents() {
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/shop
copy1234.jpg"))); // NOI18N
jLabel3.setText("jLabel3");
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELI
NE)
.addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
jPanel3.setLayout(null);
jLabel5.setFont(new java.awt.Font("Kozuka Mincho Pro H", 1, 24)); // NOI18N
jLabel5.setForeground(new java.awt.Color(51, 0, 51));
jLabel5.setText("Customer Name");
jPanel3.add(jLabel5);
jLabel5.setBounds(210, 170, 190, 50);
gtable.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Type Glass", "coating", "pow R", "pow L", "qty", "price"
}
){
Class[] types = new Class [] {
java.lang.String.class, java.lang.String.class, java.lang.String.class,
java.lang.String.class, java.lang.String.class, java.lang.String.class
};
jPanel3.add(jScrollPane1);
jScrollPane1.setBounds(160, 290, 630, 90);
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(15, 15, 15)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 1003,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE)))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 850, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 679,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)))
);
pack();
}
try{
Class.forName("com.mysql.jdbc.Driver");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/ozzerve_optical_shop","root"
,"123456");
JOptionPane.showMessageDialog(null,"Connected");
Statement st=con.createStatement();
String cname = per1.getText();
String billdate=bdate.getText();
String billno=qn.getText();
String cid=per.getText();
String st1="pending";
String q="Insert into bill_glass
values('"+billno+"','"+billdate+"','"+cid+"','"+cname+"','"+
tg+"','"+co+"','"+por+"','"+pol+"','"+qt+"','"+pri+"','"+st1+"');";
st.executeUpdate(q);
JOptionPane.showMessageDialog(null,"Connected");
String q1="Insert into bill
values('"+billno+"','"+billdate+"','"+cid+"','"+cname+"','"+st1+"','"+pri+"');";
st.executeUpdate(q1);
JOptionPane.showMessageDialog(null,"Connected");
st.close();
con.close();
}
catch(Exception e)
{JOptionPane.showMessageDialog(null,e);
}
}
void ftable()
{
DefaultTableModel tm=(DefaultTableModel)gtable.getModel();
tm.addRow(new Object[]{tg,co,por,pol,qt,pri});
ftable();
}
st.close();
con.close();
}
catch(Exception e)
{JOptionPane.showMessageDialog(null,e);
}
}
void ftable()
{
DefaultTableModel tm=(DefaultTableModel)ftable.getModel();
tm.addRow(new Object[]{tg,co,por,pol,qt,pri});
}
private void exitActionPerformed(java.awt.event.ActionEvent evt) {
this.dispose();
frame01intro sn=new frame01intro();
sn.setVisible(true);
}
import java.sql.*;
import java.text.SimpleDateFormat;
import java.util.Locale;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/shop
copy1234.jpg"))); // NOI18N
jLabel3.setText("jLabel3");
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 193,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 504,
Short.MAX_VALUE)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 239,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(52, 52, 52))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.B
ASELINE)
.addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
jPanel3.setLayout(null);
ltable.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"lens_design", "lens_type", "color", "Brand", "Disposability", "pow R",
"pow L", "qty", "price"
}
){
Class[] types = new Class [] {
java.lang.String.class, java.lang.String.class, java.lang.String.class,
java.lang.String.class, java.lang.String.class, java.lang.String.class,
java.lang.String.class, java.lang.String.class, java.lang.String.class
};
jPanel3.add(jScrollPane1);
jScrollPane1.setBounds(140, 260, 750, 90);
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN
G)
.addGroup(layout.createSequentialGroup()
.addGap(15, 15, 15)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE,
1003, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE)))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 850, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN
G)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE,
679, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)))
);
pack();
}
}
rs.close();
}
catch(Exception e)
{JOptionPane.showMessageDialog(null,e);
}
try{
Class.forName("com.mysql.jdbc.Driver");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/ozzerve_optical_shop
","root","123456");
// JOptionPane.showMessageDialog(null,"Connected");
Statement st=con.createStatement();
String ld=qn1.getText();
String lt=qn2.getText();
String cc=qn3.getText();
String bd=qn4.getText();
String ds=qn5.getText();
int code=Integer.parseInt(qn6.getText());
int qty=Integer.parseInt(qn7.getText());
double price=Double.parseDouble(qn.getText());
String q="Insert into lens_details
values('"+ld+"','"+lt+"','"+cc+"','"+bd+"','"+ds+"',"+price+","+code+","+qty+");";
st.executeUpdate(q);
JOptionPane.showMessageDialog(null,"Inserted");
st.close();
con.close();
}
catch(Exception e)
{JOptionPane.showMessageDialog(null,e);
}
ldc.setSelectedIndex(0);
qn1.setText("");
qn2.setText("");
qn3.setText("");
qn4.setText("");
qn5.setText("");
qn6.setText("");
qn7.setText("");
qn.setText("");
}
private void backActionPerformed(java.awt.event.ActionEvent evt) {
this.dispose();
frames02a2 sp=new frames02a2();
sp.setVisible(true);
}
qn1.setText("");
qn2.setText("");
qn3.setText("");
qn4.setText("");
qn5.setText("");
qn6.setText("");
qn7.setText("");
qn.setText("");
try{
Class.forName("com.mysql.jdbc.Driver");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/ozzerve_optical_shop
","root","123456");
// JOptionPane.showMessageDialog(null,"Connected");
Statement st=con.createStatement();
String cd=ldc.getSelectedItem().toString();
int cd1=Integer.parseInt(cd);
qn6.setText(""+cd1);
}
st.close();
con.close();
}
catch(Exception e)
{//JOptionPane.showMessageDialog(null,e);
}
ldc.setSelectedIndex(0);
try{
Class.forName("com.mysql.jdbc.Driver");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/ozzerve_optical_shop
","root","123456");
// JOptionPane.showMessageDialog(null,"Connected");
Statement st=con.createStatement();
PreparedStatement pst=null;
ResultSet rs;
String q="SELECT lens_code from lens_details";
pst =con.prepareStatement(q);
rs= pst.executeQuery();
while(rs.next())
{
String cnm=rs.getString("lens_code");
ldc.addItem(cnm);
}
rs.close();
}
catch(Exception e)
{JOptionPane.showMessageDialog(null,e);
}
}
catch(Exception e)
{JOptionPane.showMessageDialog(null,e);
}
qn1.setText("");
qn2.setText("");
qn3.setText("");
qn4.setText("");
qn5.setText("");
qn6.setText("");
qn7.setText("");
qn.setText("");
ldc.setSelectedIndex(0);
}
import java.sql.*;
import javax.swing.JOptionPane;
public class frames05a5 extends javax.swing.JFrame {
int c_id; int del;
public frames05a5() {
initComponents();
}
private void fullframe()
{
try{
Class.forName("com.mysql.jdbc.Driver");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/ozzerve_optical_shop
","root","123456");
Statement st=con.createStatement();
PreparedStatement pst=null;
ResultSet rs;
String q1="SELECT glass_code from glass_details order by glass_code desc limit
1";
pst =con.prepareStatement(q1);
rs= pst.executeQuery();
if(rs.next())
{
int c1=rs.getInt("glass_code");
c1++;
c_id=c1;
}
else{
c_id=101;
}
st.close();
con.close();
}
catch(Exception e)
{JOptionPane.showMessageDialog(null,e);
}
qn5.setText(""+c_id);
}
private void back2ActionPerformed(java.awt.event.ActionEvent evt) {
this.dispose();
}
int code=Integer.parseInt(qn5.getText());
int qty=Integer.parseInt(qn6.getText());
double price=Double.parseDouble(qn.getText());
String q="Update glass_details set
Types_of_Glass='"+bname+"',Coating='"+frm+"',Price="+price+",quantity="+qty+"
where glass_code="+code+"";
pst=con.prepareStatement(q);
pst.execute();
catch(Exception e)
{JOptionPane.showMessageDialog(null,e);
}
qn1.setText("");
qn2.setText("");
qn5.setText("");
qn6.setText("");
qn.setText("");
fcb.setSelectedIndex(0);
}
JOptionPane.showMessageDialog(null,"Record deleted");
st.close();
con.close();
}
catch(Exception e)
{JOptionPane.showMessageDialog(null,e);
}
qn1.setText("");
qn2.setText("");
qn5.setText("");
qn6.setText("");
qn.setText("");
fcb.removeItemAt(del);
fcb.setSelectedIndex(0);
}
qn1.setText("");
qn2.setText("");
qn5.setText("");
qn6.setText("");
qn.setText("");
fcb.setSelectedIndex(0);
try{
Class.forName("com.mysql.jdbc.Driver");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/ozzerve_optical_shop
","root","123456");
//JOptionPane.showMessageDialog(null,"Connected");
Statement st=con.createStatement();
PreparedStatement pst=null;
ResultSet rs;
String q="SELECT glass_code from glass_details";
pst =con.prepareStatement(q);
rs= pst.executeQuery();
while(rs.next())
{
String cnm=rs.getString("glass_code");
fcb.addItem(cnm);
}
rs.close();
}
catch(Exception e)
{JOptionPane.showMessageDialog(null,e);
}}
fcb.setSelectedIndex(0);
qn5.setVisible(true);
fcb.setVisible(false);
fullframe();
try{
Class.forName("com.mysql.jdbc.Driver");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/ozzerve_optical_shop
","root","123456");
Statement st=con.createStatement();
String cd=fcb.getSelectedItem().toString();
int cd1=Integer.parseInt(cd);
qn5.setText(""+cd1);
st.close();
con.close();
}
catch(Exception e)
{//JOptionPane.showMessageDialog(null,e);
}
}
import java.sql.*;
import javax.swing.JOptionPane;
public class frames06a6b extends javax.swing.JFrame {
public frames06a6b() {
initComponents();
getbillno();
}
private void back2ActionPerformed(java.awt.event.ActionEvent evt) {
this.dispose();
}
public void getbillno()
{
try{
Class.forName("com.mysql.jdbc.Driver");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/ozzerve_optical_shop
","root","123456");
Statement st=con.createStatement();
PreparedStatement pst=null;
ResultSet rs;
String q="SELECT Bill_no from bill";
pst =con.prepareStatement(q);
rs= pst.executeQuery();
while(rs.next())
{
String cnm=rs.getString("Bill_no");
fcb.addItem(cnm);
}
rs.close();
}
catch(Exception e)
{JOptionPane.showMessageDialog(null,e);
}
bd.setText(bdat);
ci.setText(cio);
st.close();
con.close();
}
catch(Exception e)
{JOptionPane.showMessageDialog(null,e);
}}
private void backActionPerformed(java.awt.event.ActionEvent evt) {
this.dispose();
frames01a sv=new frames01a();
sv.setVisible(true);
}
}
rs.close();
}
catch(Exception e)
{JOptionPane.showMessageDialog(null,e);
}
}
private void back2ActionPerformed(java.awt.event.ActionEvent evt) {
this.dispose();
}
int code=Integer.parseInt(qn5.getText());
int qty=Integer.parseInt(qn6.getText());
double price=Double.parseDouble(qn.getText());
String q="Update glass_details set
Types_of_Glass='"+bname+"',Coating='"+frm+"',Price="+price+",quantity="+qty+"
where glass_code="+code+"";
pst=con.prepareStatement(q);
pst.execute();
JOptionPane.showMessageDialog(null,"Records Updated");
st.close();
con.close();
}
catch(Exception e)
{JOptionPane.showMessageDialog(null,e);
} qn1.setText("");
qn2.setText("");
qn5.setText("");
qn6.setText("");
qn.setText("");
fcb.setSelectedIndex(0);
}
catch(Exception e)
{JOptionPane.showMessageDialog(null,e);
}
}
private void back2ActionPerformed(java.awt.event.ActionEvent evt) {
this.dispose();
}
}
st.close();
con.close();
}
catch(Exception e)
{//JOptionPane.showMessageDialog(null,e);
}
}
private void backActionPerformed(java.awt.event.ActionEvent evt) {
this.dispose();
frames02a2 sn=new frames02a2();
sn.setVisible(true);
}
import java.sql.*;
import javax.swing.JOptionPane;
public class frames10a10 extends javax.swing.JFrame {
int del;
public frames10a10() {
initComponents();
fullframe();
}
private void fullframe(){
qn6.setVisible(false);
ldc.setVisible(true);
try{
Class.forName("com.mysql.jdbc.Driver");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/ozzerve_optical_shop
","root","123456");
Statement st=con.createStatement();
PreparedStatement pst=null;
ResultSet rs;
String q="SELECT lens_code from lens_details";
pst =con.prepareStatement(q);
rs= pst.executeQuery();
while(rs.next())
{ String cnm=rs.getString("lens_code");
ldc.addItem(cnm);
}
rs.close();
}
catch(Exception e)
{JOptionPane.showMessageDialog(null,e);
}
}
private void deleteActionPerformed(java.awt.event.ActionEvent evt) {
try{
Class.forName("com.mysql.jdbc.Driver");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/ozzerve_optical_shop
","root","123456");
//JOptionPane.showMessageDialog(null,"Connected");
Statement st=con.createStatement();
PreparedStatement pst=null;
del=ldc.getSelectedIndex();
int code=Integer.parseInt(qn6.getText());
String q="Delete from lens_details where lens_code="+code+"";
pst=con.prepareStatement(q);
pst.execute();
JOptionPane.showMessageDialog(null,"record deleted");
st.close();
con.close();
}
catch(Exception e)
{JOptionPane.showMessageDialog(null,e);
}
qn1.setText("");
qn2.setText("");
qn3.setText("");
qn4.setText("");
qn5.setText("");
qn6.setText("");
qn7.setText("");
qn.setText("");
ldc.removeItemAt(del);
ldc.setSelectedIndex(0);
}