Informati CS Practices: Computer Project Report On Telebiling
Informati CS Practices: Computer Project Report On Telebiling
TELE BILLING
SUBMITTED BY :- ASHISH ANAND
INDEX
Acknowledgement Certificate Program Listing Output
Bibliography
ACKNOWLEDCEMENT
It is my duty to record my sincere thanks and Deep sense of gratitude to my respected teacher
INTRODUCTION
OBJECTIVE OF THE PROJECT
This project on Tele Billing System tries to provide some amount of automation in tele billing mangement. The objective of the project is to help system in making their business more efficient. It is also believed that automated system might be an added attraction for their potential customers. It will also show the attitude of the management that they are aware to the newly introduced technology and ready to adopt them.
PROJECT OVERVIEW
Database and database systems have become an essential component of everyday life in modern society. In the course of a day, most of us encounter several activities that involve some interaction with the database. For example, if we go to the bank to
deposit or withdraw funds or if we make a Hotel or Airline Reservation, chances are that our activities will involve someone accessing a database.
The above interactions are examples of what we may call traditional database applications, where most of the application that is stored and accessed is either textual or numeric. In our project we will concentrate on this aspect of computer application.
There are several ways to implement databases. Some of them are file handling mechanism, relational database, object-relational database or object-oriented databases. In our project we will use file-handling feature provided by JAVA Language.
This program shows you an insight into the billing process of any telephone system. The whole process of billing registration is shown with the help of this project. It provides facility to make and view the billing of telephone and provide facility to view the list of calls etc..
This system provides options to view the list of all billing details available in the system.
INSTALLATION REQUIREMENTS
Key Board
CERTIFICATE I would like to certify that project submitted by MASTER ASHISH ANAND of class XII-BOF KV SEC-8 RK PURAM ,NEW DELHI was made under my inspection and observation in the school COMPUTER LAB. During academic session 2011-2012.
COMPUTER SIGNATURE
TEACHER
SPLASH Screenshot
/* * To change this template, choose Tools | Templates * and open the template in the editor. */
package telebilling;
initComponents(); }
/** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() {
setDefaultCloseOperation(javax.swing.WindowConst ants.EXIT_ON_CLOSE);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayo ut.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swi ng.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(100, 100, 100)
.addComponent(jLabel1)) .addGroup(layout.createSequentialGroup() .addGap(159, 159, 159) .addComponent(jButton1))) .addContainerGap(151, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayo ut.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(69, 69, 69) .addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.Com ponentPlacement.RELATED, 166, Short.MAX_VALUE) .addComponent(jButton1) .addGap(20, 20, 20)) );
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: frmLogin frm=new frmLogin(); frm.show(); this.hide(); }
/** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new frmSplash().setVisible(true); } }); }
Login
/* * To change this template, choose Tools | Templates * and open the template in the editor. */
/*
package telebilling;
/** This method is called from within the constructor to * initialize the form.
* WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() {
jLabel1 = new javax.swing.JLabel(); txtUserId = new java.awt.TextField(); jLabel2 = new javax.swing.JLabel(); txtPassword = new javax.swing.JPasswordField(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); lblMsg = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConst ants.EXIT_ON_CLOSE);
jLabel1.setText("User Id");
jLabel2.setText("Password");
lblMsg.setText("-");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayo ut.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(94, 94, 94) .addComponent(lblMsg) .addContainerGap(302, Short.MAX_VALUE)) .addGroup(layout.createParallelGroup(javax.swing .GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(76, 76, 76) .addGroup(layout.createParallelGroup(javax. swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel1) .addComponent(jLabel2)) .addGap(33, 33, 33) .addGroup(layout.createParallelGroup(javax. swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutSt yle.ComponentPlacement.RELATED, 33, Short.MAX_VALUE) .addComponent(jButton1) .addGap(18, 18, 18) .addComponent(jButton2) .addGap(9, 9, 9)) .addGroup(layout.createParallelGroup(java x.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(txtPassword, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(txtUserId, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 168, Short.MAX_VALUE))) .addGap(77, 77, 77))) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayo ut.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TR AILING, layout.createSequentialGroup()
.addContainerGap(106, Short.MAX_VALUE) .addComponent(lblMsg) .addGap(21, 21, 21)) .addGroup(layout.createParallelGroup(javax.swing .GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(22, 22, 22) .addGroup(layout.createParallelGroup(javax. swing.GroupLayout.Alignment.LEADING) .addComponent(txtUserId, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING)) .addPreferredGap(javax.swing.LayoutStyle.C omponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax. swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.C omponentPlacement.RELATED, 22, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax. swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton1) .addComponent(jButton2)) .addGap(23, 23, 23))) );
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: if(txtUserId.getText().equals("T") && txtPassword.getText().equals("T")) { frmMain frm=new frmMain(); frm.show();
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: this.setVisible(false); }
/** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new frmLogin().setVisible(true);
} }); }
// Variables declaration - do not modify private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel lblMsg; private javax.swing.JPasswordField txtPassword; private java.awt.TextField txtUserId; // End of variables declaration
Main Page
/* * To change this template, choose Tools | Templates * and open the template in the editor. */
package telebilling;
/** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked")
jMenuBar1 = new javax.swing.JMenuBar(); jMenu1 = new javax.swing.JMenu(); jMenu2 = new javax.swing.JMenu(); jMenu4 = new javax.swing.JMenu(); jMenu3 = new javax.swing.JMenu();
setDefaultCloseOperation(javax.swing.WindowConst ants.EXIT_ON_CLOSE);
jMenu1.setText("Customer"); jMenu1.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jMenu1MouseClicked(evt); } }); jMenuBar1.add(jMenu1);
jMenu2.setText("Generate Bill"); jMenu2.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jMenu2MouseClicked(evt); } }); jMenuBar1.add(jMenu2);
jMenu4.setText("Search Customer"); jMenu4.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jMenu4MouseClicked(evt); } }); jMenuBar1.add(jMenu4);
jMenu3.setText("Exit");
setJMenuBar(jMenuBar1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayo ut.Alignment.LEADING) .addGap(0, 400, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayo ut.Alignment.LEADING)
private void jMenu1MouseClicked(java.awt.event.MouseEvent evt) { // TODO add your handling code here: frmCustomer frm=new frmCustomer(); frm.show(); }
private void jMenu2MouseClicked(java.awt.event.MouseEvent evt) { // TODO add your handling code here: frmBillGeneration frm=new frmBillGeneration(); frm.show(); }
private void jMenu3MouseClicked(java.awt.event.MouseEvent evt) { // TODO add your handling code here: this.hide(); }
private void jMenu4MouseClicked(java.awt.event.MouseEvent evt) { // TODO add your handling code here: frmSearchCustomer frm=new frmSearchCustomer(); frm.show(); }
/** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new frmMain().setVisible(true); }
}); }
// Variables declaration - do not modify private javax.swing.JMenu jMenu1; private javax.swing.JMenu jMenu2; private javax.swing.JMenu jMenu3; private javax.swing.JMenu jMenu4; private javax.swing.JMenuBar jMenuBar1; // End of variables declaration
Customer
/* * To change this template, choose Tools | Templates * and open the template in the editor. */
package telebilling;
/** * * @author Administrator */ import java.sql.*; public class frmCustomer extends javax.swing.JFrame {
Connection con; /** Creates new form frmCustomer */ public frmCustomer() { initComponents(); try { Class.forName("com.microsoft.sqlserver.jdbc.SQL ServerDriver");
getList();
/** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() {
jLabel1 = new javax.swing.JLabel(); txtCustName = new javax.swing.JTextField(); jLabel2 = new javax.swing.JLabel(); txtAddress = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); txtPhone = new javax.swing.JTextField(); jLabel4 = new javax.swing.JLabel(); txtPlan = new javax.swing.JTextField(); jLabel5 = new javax.swing.JLabel(); txtBillDt = new javax.swing.JTextField(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); jButton4 = new javax.swing.JButton(); lst = new java.awt.List();
setDefaultCloseOperation(javax.swing.WindowConst ants.EXIT_ON_CLOSE);
jLabel1.setText("Customer Name");
jLabel2.setText("Address");
jLabel3.setText("Phone");
jLabel4.setText("Plan");
jLabel5.setText("Bill date");
jButton2ActionPerformed(evt); } });
jButton3.setText("Update");
.addGroup(layout.createParallelGroup(javax.swi ng.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(22, 22, 22) .addGroup(layout.createParallelGroup(java x.swing.GroupLayout.Alignment.TRAILING, false) .addGroup(layout.createSequentialGrou p() .addComponent(jLabel3) .addPreferredGap(javax.swing.Layout Style.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(txtPhone, javax.swing.GroupLayout.PREFERRED_SIZE, 255, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGrou p() .addComponent(jLabel1) .addGap(18, 18, 18) .addComponent(txtCustName, javax.swing.GroupLayout.PREFERRED_SIZE, 255, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Ali gnment.LEADING, layout.createSequentialGroup() .addGroup(layout.createParallelGroup (javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel2) .addComponent(jLabel4) .addComponent(jLabel5)) .addPreferredGap(javax.swing.Layout Style.ComponentPlacement.RELATED, 55, Short.MAX_VALUE) .addGroup(layout.createParallelGroup (javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(txtAddress, javax.swing.GroupLayout.PREFERRED_SIZE, 255, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createSequential Group() .addComponent(txtPlan, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(152, 152, 152)) .addComponent(txtBillDt, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addGroup(layout.createSequentialGroup() .addGap(66, 66, 66) .addComponent(jButton1) .addGap(31, 31, 31) .addComponent(jButton2) .addGap(18, 18, 18) .addComponent(jButton3) .addGap(18, 18, 18) .addComponent(jButton4)) .addGroup(layout.createSequentialGroup() .addGap(33, 33, 33) .addComponent(lst, javax.swing.GroupLayout.DEFAULT_SIZE, 357, Short.MAX_VALUE))) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayo ut.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(43, 43, 43)
.addGroup(layout.createParallelGroup(javax.swi ng.GroupLayout.Alignment.LEADING) .addComponent(txtCustName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel1)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swi ng.GroupLayout.Alignment.BASELINE) .addComponent(txtAddress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel2)) .addPreferredGap(javax.swing.LayoutStyle.Com ponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swi ng.GroupLayout.Alignment.BASELINE) .addComponent(txtPhone, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3)) .addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swi ng.GroupLayout.Alignment.BASELINE) .addComponent(txtPlan, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel4)) .addPreferredGap(javax.swing.LayoutStyle.Com ponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swi ng.GroupLayout.Alignment.TRAILING) .addComponent(txtBillDt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel5)) .addGap(41, 41, 41) .addGroup(layout.createParallelGroup(javax.swi ng.GroupLayout.Alignment.BASELINE) .addComponent(jButton1) .addComponent(jButton2) .addComponent(jButton3) .addComponent(jButton4)) .addGap(21, 21, 21)
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: txtCustName.setText(""); txtAddress.setText(""); txtPhone.setText(""); txtPlan.setText(""); txtBillDt.setText("");
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: try { Statement st=con.createStatement(); st.execute("insert into Customer(CName,Address,Phone,PlanType,BillDt) values('" + txtCustName.getText() + "', '" + txtAddress.getText() + "', '"+txtPhone.getText() +"','"+txtPlan.getText()+"',"+txtBillDt.getText()+")" ); getList();
} }
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: if(lst.getSelectedItem()==null) { return; } try { Statement st=con.createStatement(); st.execute("delete from Customer where CName='"+lst.getSelectedItem()+"'"); getList();
} void getList(){ try{ lst.removeAll(); Statement st=con.createStatement(); ResultSet rs=st.executeQuery("select * from Customer order by CName"); while(rs.next()){ lst.add(rs.getString("CName")); } } catch(Exception ex){ System.out.println(ex.getMessage()); } } /** * @param args the command line arguments */ public static void main(String args[]) {
// Variables declaration - do not modify private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JButton jButton3; private javax.swing.JButton jButton4; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private java.awt.List lst; private javax.swing.JTextField txtAddress; private javax.swing.JTextField txtBillDt; private javax.swing.JTextField txtCustName;
Bill Generation
package telebilling;
/** * * @author Administrator */ import java.sql.*; public class frmBillGeneration extends javax.swing.JFrame {
* initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() {
jLabel1 = new javax.swing.JLabel(); lst = new java.awt.Choice(); jLabel2 = new javax.swing.JLabel(); txtAddress = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); txtPhone = new javax.swing.JTextField(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); txtAmt = new javax.swing.JTextField(); jButton1 = new javax.swing.JButton(); cmbMonth = new javax.swing.JComboBox();
setDefaultCloseOperation(javax.swing.WindowConst ants.EXIT_ON_CLOSE);
jLabel1.setText("Select Customer");
jLabel2.setText("Address");
jLabel3.setText("Phone");
jLabel4.setText("Month");
jLabel5.setText("Amount");
});
cmbMonth.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "January", "February", "March", "April", "may", "June", "July", "August", "September", "October", "November", "December", " " }));
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayo ut.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(56, 56, 56) .addGroup(layout.createParallelGroup(javax.swi ng.GroupLayout.Alignment.LEADING) .addComponent(jLabel1) .addComponent(jLabel2) .addComponent(jLabel3) .addComponent(jLabel4) .addComponent(jLabel5))
.addPreferredGap(javax.swing.LayoutStyle.Com ponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swi ng.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax. swing.GroupLayout.Alignment.LEADING, false) .addComponent(txtPhone) .addComponent(txtAddress) .addComponent(lst, javax.swing.GroupLayout.DEFAULT_SIZE, 251, Short.MAX_VALUE) .addComponent(jButton1)) .addComponent(txtAmt, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(cmbMonth, javax.swing.GroupLayout.PREFERRED_SIZE, 209, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DE FAULT_SIZE, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayo ut.Alignment.LEADING)
.addGroup(layout.createSequentialGroup() .addGap(29, 29, 29) .addGroup(layout.createParallelGroup(javax.swi ng.GroupLayout.Alignment.LEADING) .addComponent(lst, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel1)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swi ng.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(txtAddress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.Com ponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swi ng.GroupLayout.Alignment.BASELINE) .addComponent(txtPhone, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3)) .addGroup(layout.createParallelGroup(javax.swi ng.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle .ComponentPlacement.RELATED) .addComponent(jLabel4)) .addGroup(layout.createSequentialGroup() .addGap(13, 13, 13) .addComponent(cmbMonth, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addPreferredGap(javax.swing.LayoutStyle.Com ponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swi ng.GroupLayout.Alignment.BASELINE) .addComponent(jLabel5) .addComponent(txtAmt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(29, 29, 29) .addComponent(jButton1)
.addContainerGap(66, Short.MAX_VALUE)) );
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: try { Statement st=con.createStatement(); st.execute("insert into GenerateBill(CName,Address,Phone,Month,Amt) values('" + lst.getSelectedItem() + "', '" + txtAddress.getText() + "', '"+txtPhone.getText()+"','"+cmbMonth.getName() +"',"+txtAmt.getText()+")" ); frmThankYou frm=new frmThankYou(); frm.show(); this.hide();
} }
/** * @param args the command line arguments */ void getList(){ try{ lst.removeAll(); Statement st=con.createStatement(); ResultSet rs=st.executeQuery("select * from Customer order by CName"); while(rs.next()){ lst.add(rs.getString("CName")); }
public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new frmBillGeneration().setVisible(true); } }); }
// Variables declaration - do not modify private javax.swing.JComboBox cmbMonth; private javax.swing.JButton jButton1; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5; private java.awt.Choice lst; private javax.swing.JTextField txtAddress; private javax.swing.JTextField txtAmt; private javax.swing.JTextField txtPhone; // End of variables declaration
Search Customer
/* * To change this template, choose Tools | Templates * and open the template in the editor. */
package telebilling;
/** * * @author Administrator */ import java.sql.*; public class frmSearchCustomer extends javax.swing.JFrame {
/** Creates new form frmSearchCustomer */ Connection con; public frmSearchCustomer() { initComponents(); try { Class.forName("com.microsoft.sqlserver.jdbc.SQL ServerDriver");
} void getList(){ try{ lst.removeAll(); Statement st=con.createStatement(); ResultSet rs=st.executeQuery("select * from Customer order by CName"); while(rs.next()){ lst.add(rs.getString("CName")); } } catch(Exception ex){ System.out.println(ex.getMessage()); } }
/** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor.
lst = new java.awt.List(); jLabel1 = new javax.swing.JLabel(); txtSearch = new javax.swing.JTextField(); jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConst ants.EXIT_ON_CLOSE);
jLabel1.setText("Search");
} });
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayo ut.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swi ng.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(20, 20, 20) .addComponent(jLabel1) .addGap(18, 18, 18) .addComponent(txtSearch, javax.swing.GroupLayout.PREFERRED_SIZE, 195, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle .ComponentPlacement.RELATED) .addComponent(jButton1))
.addGroup(javax.swing.GroupLayout.Alignme nt.TRAILING, layout.createSequentialGroup() .addGap(28, 28, 28) .addComponent(lst, javax.swing.GroupLayout.DEFAULT_SIZE, 317, Short.MAX_VALUE))) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayo ut.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TR AILING, layout.createSequentialGroup() .addContainerGap(26, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swi ng.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) .addComponent(txtSearch, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton1)) .addPreferredGap(javax.swing.LayoutStyle.Com ponentPlacement.RELATED)
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: if(txtSearch.getText().equals("")) { System.out.println("Please Enter valid Customer Name"); return;
} lst.removeAll(); try
{ Statement st=con.createStatement(); ResultSet rs= st.executeQuery("select * from Customer where CName='"+txtSearch.getText()+"'"); while(rs.next()) { lst.add(rs.getString("CName")); } } catch(Exception ex) { System.out.println(ex.getMessage()); } }
/** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() {
// Variables declaration - do not modify private javax.swing.JButton jButton1; private javax.swing.JLabel jLabel1; private java.awt.List lst; private javax.swing.JTextField txtSearch; // End of variables declaration
Thank You
/* * To change this template, choose Tools | Templates * and open the template in the editor. */
package telebilling;
/** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">
setDefaultCloseOperation(javax.swing.WindowConst ants.EXIT_ON_CLOSE);
.addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swi ng.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(108, 108, 108) .addComponent(jLabel1)) .addGroup(layout.createSequentialGroup() .addGap(86, 86, 86) .addComponent(jLabel2))) .addContainerGap(126, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayo ut.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(53, 53, 53) .addComponent(jLabel1) .addGap(33, 33, 33) .addComponent(jLabel2) .addContainerGap(142, Short.MAX_VALUE)) );
/** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new frmThankYou().setVisible(true); } }); }
// Variables declaration - do not modify private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; // End of variables declaration