diff --git a/ST2-Project-master/README.md b/ST2-Project-master/README.md new file mode 100644 index 0000000..77610a0 --- /dev/null +++ b/ST2-Project-master/README.md @@ -0,0 +1,2 @@ +# ST2-Project +30th March is deadline and upload assignment or project with your roll number, name and section. diff --git a/ST2-Project-master/src/Client_page.form b/ST2-Project-master/src/Client_page.form new file mode 100644 index 0000000..57a75b4 --- /dev/null +++ b/ST2-Project-master/src/Client_page.form @@ -0,0 +1,547 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
+
+
+
+ diff --git a/ST2-Project-master/src/Client_page.java b/ST2-Project-master/src/Client_page.java new file mode 100644 index 0000000..c29bf5d --- /dev/null +++ b/ST2-Project-master/src/Client_page.java @@ -0,0 +1,656 @@ + + +import com.mysql.jdbc.Connection; +import com.mysql.jdbc.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.text.MessageFormat; +import java.text.SimpleDateFormat; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.swing.JOptionPane; +import javax.swing.JTable; +import javax.swing.JTextField; +import net.proteanit.sql.DbUtils; + +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +/* + * Client_page.java + * + * Created on Sep 21, 2012, 1:56:01 PM + */ + +/** + * + * @author Vish + */ +public class Client_page extends javax.swing.JFrame { + + Connection conn=null; + ResultSet rs=null; + PreparedStatement pst=null; + + public Client_page() { + initComponents(); + update_table("0"); + + //txt_name.setComponentPopupMenu(new JTextField("khsdfkshfkh")); + } + + public void printing() + { + MessageFormat header=new MessageFormat("Report Print"); + MessageFormat footer=new MessageFormat("Page{0,number,integer}"); + try{ + delivery_table.print(JTable.PrintMode.NORMAL,header,footer); + }catch(Exception e){ + + } + return ; + } + + private void update_table(String id_num) { + + PreparedStatement pst; + + DataBase_connect obj=new DataBase_connect(); + + Connection conn=obj.Open(); + + try{ + String val1=((JTextField)txt_datef.getDateEditor().getUiComponent()).getText(); + String val2=((JTextField)txt_datet.getDateEditor().getUiComponent()).getText(); + String sql="SELECT serial_no AS serial, truck_number, description, loading_place, delivery_date AS date, length, width, height, amount, rate, total_amount AS total FROM delivery_table where id ='" + id_num + +"' and delivery_date between '"+val1+"' and '" + val2+"'"; + pst=(PreparedStatement) conn.prepareStatement(sql); + rs=pst.executeQuery(); + delivery_table.setModel(DbUtils.resultSetToTableModel(rs)); + }catch(Exception e){ + JOptionPane.showMessageDialog(null, e); + }finally { + try { + conn.close(); + System.out.println("disconnected"); + } catch (SQLException ex) { + Logger.getLogger(client_info.class.getName()).log(Level.SEVERE, null, ex); + } + } + } + + + // //GEN-BEGIN:initComponents + private void initComponents() { + + jToolBar1 = new javax.swing.JToolBar(); + jButton8 = new javax.swing.JButton(); + jButton3 = new javax.swing.JButton(); + jButton7 = new javax.swing.JButton(); + jButton9 = new javax.swing.JButton(); + jButton10 = new javax.swing.JButton(); + jButton11 = new javax.swing.JButton(); + jButton12 = new javax.swing.JButton(); + jButton13 = new javax.swing.JButton(); + jButton14 = new javax.swing.JButton(); + jPanel4 = new javax.swing.JPanel(); + search1 = new javax.swing.JTextField(); + jLabel7 = new javax.swing.JLabel(); + jPanel1 = new javax.swing.JPanel(); + txt_datef = new com.toedter.calendar.JDateChooser(); + txt_datet = new com.toedter.calendar.JDateChooser(); + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + txt_name = new javax.swing.JLabel(); + txt_address = new javax.swing.JLabel(); + jButton15 = new javax.swing.JButton(); + jButton16 = new javax.swing.JButton(); + jScrollPane2 = new javax.swing.JScrollPane(); + jScrollPane1 = new javax.swing.JScrollPane(); + delivery_table = new javax.swing.JTable(); + jMenuBar1 = new javax.swing.JMenuBar(); + jMenu1 = new javax.swing.JMenu(); + jMenuItem1 = new javax.swing.JMenuItem(); + jMenuItem2 = new javax.swing.JMenuItem(); + jMenuItem3 = new javax.swing.JMenuItem(); + jMenuItem4 = new javax.swing.JMenuItem(); + jMenuItem5 = new javax.swing.JMenuItem(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); + + jToolBar1.setRollover(true); + + jButton8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/1-Normal-Home-icon.png"))); // NOI18N + jButton8.setText("Home"); + jButton8.setToolTipText("Ctrl + H"); + jButton8.setFocusable(false); + jButton8.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton8.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton8.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton8ActionPerformed(evt); + } + }); + jToolBar1.add(jButton8); + + jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/new32.png"))); // NOI18N + jButton3.setText("New Client"); + jButton3.setToolTipText("Ctrl + N"); + jButton3.setFocusable(false); + jButton3.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton3.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton3ActionPerformed(evt); + } + }); + jToolBar1.add(jButton3); + + jButton7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/money-icon.png"))); // NOI18N + jButton7.setText("Transaction"); + jButton7.setToolTipText("Ctrl + T"); + jButton7.setFocusable(false); + jButton7.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton7.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton7.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton7ActionPerformed(evt); + } + }); + jToolBar1.add(jButton7); + + jButton9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/Collection-2-icon.png"))); // NOI18N + jButton9.setText("Collection"); + jButton9.setToolTipText("Ctrl + C"); + jButton9.setFocusable(false); + jButton9.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton9.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton9.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton9ActionPerformed(evt); + } + }); + jToolBar1.add(jButton9); + + jButton10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/print32.png"))); // NOI18N + jButton10.setText("Print"); + jButton10.setFocusable(false); + jButton10.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton10.setMaximumSize(new java.awt.Dimension(57, 57)); + jButton10.setMinimumSize(new java.awt.Dimension(57, 57)); + jButton10.setPreferredSize(new java.awt.Dimension(57, 57)); + jButton10.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jToolBar1.add(jButton10); + + jButton11.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/Calendar-icon.png"))); // NOI18N + jButton11.setText("Calender"); + jButton11.setFocusable(false); + jButton11.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton11.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton11.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton11ActionPerformed(evt); + } + }); + jToolBar1.add(jButton11); + + jButton12.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/Button-Refresh-icon.png"))); // NOI18N + jButton12.setText("Refresh"); + jButton12.setFocusable(false); + jButton12.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton12.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jToolBar1.add(jButton12); + + jButton13.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/search-icon.png"))); // NOI18N + jButton13.setText("Search"); + jButton13.setFocusable(false); + jButton13.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton13.setMaximumSize(new java.awt.Dimension(57, 57)); + jButton13.setMinimumSize(new java.awt.Dimension(57, 57)); + jButton13.setPreferredSize(new java.awt.Dimension(57, 57)); + jButton13.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jToolBar1.add(jButton13); + + jButton14.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/close32.png"))); // NOI18N + jButton14.setText("Close"); + jButton14.setToolTipText("Ctrl + Alt + C"); + jButton14.setFocusable(false); + jButton14.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton14.setMaximumSize(new java.awt.Dimension(57, 57)); + jButton14.setMinimumSize(new java.awt.Dimension(57, 57)); + jButton14.setPreferredSize(new java.awt.Dimension(57, 57)); + jButton14.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton14.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton14ActionPerformed(evt); + } + }); + jToolBar1.add(jButton14); + + jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Serach Client", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 14), new java.awt.Color(0, 51, 153))); // NOI18N + + search1.setBackground(new java.awt.Color(153, 204, 255)); + search1.addKeyListener(new java.awt.event.KeyAdapter() { + public void keyReleased(java.awt.event.KeyEvent evt) { + search1KeyReleased(evt); + } + }); + + jLabel7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/search-icon.png"))); // NOI18N + + javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); + jPanel4.setLayout(jPanel4Layout); + jPanel4Layout.setHorizontalGroup( + jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel4Layout.createSequentialGroup() + .addGap(4, 4, 4) + .addComponent(jLabel7) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(search1, javax.swing.GroupLayout.PREFERRED_SIZE, 159, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(23, Short.MAX_VALUE)) + ); + jPanel4Layout.setVerticalGroup( + jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel7) + .addGroup(jPanel4Layout.createSequentialGroup() + .addComponent(search1, javax.swing.GroupLayout.DEFAULT_SIZE, 23, Short.MAX_VALUE) + .addContainerGap()) + ); + + jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Date", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 14), new java.awt.Color(0, 0, 255))); // NOI18N + + txt_datef.setDateFormatString("yyyy-MM-dd"); + + txt_datet.setDateFormatString("yyyy-MM-dd"); + + jLabel1.setText("From"); + + jLabel2.setText("To"); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addGap(21, 21, 21) + .addComponent(jLabel1) + .addGap(18, 18, 18) + .addComponent(txt_datef, javax.swing.GroupLayout.DEFAULT_SIZE, 113, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jLabel2) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(txt_datet, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap()) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel2) + .addComponent(txt_datef, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel1) + .addComponent(txt_datet, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(14, Short.MAX_VALUE)) + ); + + txt_name.setFont(new java.awt.Font("Tahoma", 1, 24)); + txt_name.setForeground(new java.awt.Color(102, 102, 102)); + txt_name.setText("Serch Client"); + + txt_address.setText("."); + + jButton15.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/print32.png"))); // NOI18N + jButton15.setText("Print"); + jButton15.setFocusable(false); + jButton15.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton15.setMaximumSize(new java.awt.Dimension(57, 57)); + jButton15.setMinimumSize(new java.awt.Dimension(57, 57)); + jButton15.setPreferredSize(new java.awt.Dimension(57, 57)); + jButton15.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton15.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton15ActionPerformed(evt); + } + }); + + jButton16.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/Search-icon (1).png"))); // NOI18N + jButton16.setText("Search"); + jButton16.setFocusable(false); + jButton16.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton16.setMaximumSize(new java.awt.Dimension(57, 57)); + jButton16.setMinimumSize(new java.awt.Dimension(57, 57)); + jButton16.setPreferredSize(new java.awt.Dimension(57, 57)); + jButton16.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton16.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton16ActionPerformed(evt); + } + }); + + delivery_table.setModel(new javax.swing.table.DefaultTableModel( + new Object [][] { + {null, null, null, null}, + {null, null, null, null}, + {null, null, null, null}, + {null, null, null, null} + }, + new String [] { + "Title 1", "Title 2", "Title 3", "Title 4" + } + )); + jScrollPane1.setViewportView(delivery_table); + + jScrollPane2.setViewportView(jScrollPane1); + + jMenu1.setText("Option"); + + jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_H, java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/house-icon.png"))); // NOI18N + jMenuItem1.setText("Home"); + jMenuItem1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem1ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem1); + + jMenuItem2.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/new1.png"))); // NOI18N + jMenuItem2.setText("New Client"); + jMenuItem2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem2ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem2); + + jMenuItem3.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/money-icon (1).png"))); // NOI18N + jMenuItem3.setText("Transection"); + jMenuItem3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem3ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem3); + + jMenuItem4.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/Collection-2-icon (1).png"))); // NOI18N + jMenuItem4.setText("Collection"); + jMenuItem4.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem4ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem4); + + jMenuItem5.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/close1.png"))); // NOI18N + jMenuItem5.setText("Close"); + jMenuItem5.addMouseListener(new java.awt.event.MouseAdapter() { + public void mouseClicked(java.awt.event.MouseEvent evt) { + jMenuItem5MouseClicked(evt); + } + }); + jMenuItem5.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem5ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem5); + + jMenuBar1.add(jMenu1); + + setJMenuBar(jMenuBar1); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 765, Short.MAX_VALUE)) + .addComponent(jToolBar1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addGap(246, 246, 246) + .addComponent(txt_address)) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addGap(318, 318, 318) + .addComponent(txt_name) + .addGap(241, 241, 241)) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addContainerGap() + .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(jButton16, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 31, Short.MAX_VALUE) + .addComponent(jButton15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jButton16, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jButton15, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(txt_name) + .addGap(5, 5, 5) + .addComponent(txt_address) + .addGap(18, 18, 18) + .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 323, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap()) + ); + + java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); + setBounds((screenSize.width-801)/2, (screenSize.height-610)/2, 801, 610); + }// //GEN-END:initComponents + + private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed + this.dispose(); + new HomePage().setVisible(true); +}//GEN-LAST:event_jMenuItem1ActionPerformed + + private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed + this.dispose(); + + new client_info().setVisible(true); +}//GEN-LAST:event_jMenuItem2ActionPerformed + + private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed + this.dispose(); + + new Delivery().setVisible(true); +}//GEN-LAST:event_jMenuItem3ActionPerformed + + private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed + this.dispose(); + + new Collection().setVisible(true); +}//GEN-LAST:event_jMenuItem4ActionPerformed + + private void jMenuItem5MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenuItem5MouseClicked + System.exit(0); +}//GEN-LAST:event_jMenuItem5MouseClicked + + private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed + System.exit(0); +}//GEN-LAST:event_jMenuItem5ActionPerformed + + private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed + this.dispose(); + new HomePage().setVisible(true); +}//GEN-LAST:event_jButton8ActionPerformed + + private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed + this.dispose(); + new client_info().setVisible(true); +}//GEN-LAST:event_jButton3ActionPerformed + + private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed + this.dispose(); + new Collection_tab().setVisible(true); +}//GEN-LAST:event_jButton9ActionPerformed + + private void jButton11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton11ActionPerformed + + this.dispose(); + + new MyCalender().setVisible(true); + }//GEN-LAST:event_jButton11ActionPerformed + + private void jButton14ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton14ActionPerformed + System.exit(0); +}//GEN-LAST:event_jButton14ActionPerformed + + private void search1KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_search1KeyReleased + + + }//GEN-LAST:event_search1KeyReleased + + private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed + + this.dispose(); + + new Delivery().setVisible(true); + }//GEN-LAST:event_jButton7ActionPerformed + + private void jButton16ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton16ActionPerformed + PreparedStatement pst; + + DataBase_connect obj=new DataBase_connect(); + + Connection conn=obj.Open(); + +// try{ +// +// String sql="select * from client_info where name=?"; +// pst=(PreparedStatement) conn.prepareStatement(sql); +// pst.setString(1, search1.getText()); +// rs=pst.executeQuery(); +// +// if(rs.next()) +// { +// String add2=rs.getString("name"); +// txt_name.setText(add2); +// String add3=rs.getString("address"); +// txt_address.setText(add3); +// String add4=rs.getString("contact"); +// txt_contact.setText(add4); +// +// } +// else { +// set_client_id(); +// txt_name.setText(""); +// txt_address.setText(""); +// txt_contact.setText(""); +// } +// }catch(Exception e){ +// +// } + + try{ + String sql="select * from client_info where id=?"; + pst=(PreparedStatement) conn.prepareStatement(sql); + pst.setString(1, search1.getText()); + rs=pst.executeQuery(); + if(rs.next()){ + String add2=rs.getString("name"); + txt_name.setText(add2); + String add3=rs.getString("address"); + String add4=rs.getString("contact"); + txt_address.setText("Address : " +add3 + " Contact: "+ add4); + update_table(search1.getText()); + + String ad=rs.getObject("datee").toString(); + java.util.Date dat = new SimpleDateFormat("yyyy-MM-dd").parse(ad); + //txt_date.setDate(dat); + + } + else { + txt_name.setText("No Client Found"); + txt_address.setText("."); + update_table("bal"); + } + + }catch(Exception e){ + + } finally { + try { + conn.close();System.out.println("disconnected"); + } catch (SQLException ex) { + Logger.getLogger(client_info.class.getName()).log(Level.SEVERE, null, ex); + } + } + }//GEN-LAST:event_jButton16ActionPerformed + + private void jButton15ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton15ActionPerformed + + printing(); + + }//GEN-LAST:event_jButton15ActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new Client_page().setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JTable delivery_table; + private javax.swing.JButton jButton10; + private javax.swing.JButton jButton11; + private javax.swing.JButton jButton12; + private javax.swing.JButton jButton13; + private javax.swing.JButton jButton14; + private javax.swing.JButton jButton15; + private javax.swing.JButton jButton16; + private javax.swing.JButton jButton3; + private javax.swing.JButton jButton7; + private javax.swing.JButton jButton8; + private javax.swing.JButton jButton9; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel7; + private javax.swing.JMenu jMenu1; + private javax.swing.JMenuBar jMenuBar1; + private javax.swing.JMenuItem jMenuItem1; + private javax.swing.JMenuItem jMenuItem2; + private javax.swing.JMenuItem jMenuItem3; + private javax.swing.JMenuItem jMenuItem4; + private javax.swing.JMenuItem jMenuItem5; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel4; + private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JScrollPane jScrollPane2; + private javax.swing.JToolBar jToolBar1; + private javax.swing.JTextField search1; + private javax.swing.JLabel txt_address; + private com.toedter.calendar.JDateChooser txt_datef; + private com.toedter.calendar.JDateChooser txt_datet; + private javax.swing.JLabel txt_name; + // End of variables declaration//GEN-END:variables + + + +} diff --git a/ST2-Project-master/src/Collection.form b/ST2-Project-master/src/Collection.form new file mode 100644 index 0000000..7baef0b --- /dev/null +++ b/ST2-Project-master/src/Collection.form @@ -0,0 +1,628 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + +
+
+
+
+
+
+ diff --git a/ST2-Project-master/src/Collection.java b/ST2-Project-master/src/Collection.java new file mode 100644 index 0000000..aaae3ae --- /dev/null +++ b/ST2-Project-master/src/Collection.java @@ -0,0 +1,989 @@ + +import com.mysql.jdbc.Connection; +import com.mysql.jdbc.PreparedStatement; +import com.mysql.jdbc.Statement; +import com.sun.java.swing.plaf.windows.WindowsTreeUI.CollapsedIcon; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.text.MessageFormat; +import java.text.SimpleDateFormat; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.swing.JOptionPane; +import javax.swing.JTable; +import javax.swing.JTextField; +import javax.swing.UIManager; +import net.proteanit.sql.DbUtils; + +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +/* + * Client_information.java + * + * Created on Sep 18, 2012, 3:20:48 AM + */ + +/** + * + * @author Vish + */ +public class Collection extends javax.swing.JFrame { + + Connection conn=null; + ResultSet rs=null; + PreparedStatement pst=null; + + private void update_table() { + + PreparedStatement pst; + + DataBase_connect obj=new DataBase_connect(); + + Connection conn=obj.Open(); + + try{ + String sql="select * from collection_table"; + pst=(PreparedStatement) conn.prepareStatement(sql); + rs=pst.executeQuery(); + collection_table1.setModel(DbUtils.resultSetToTableModel(rs)); + }catch(Exception e){ + JOptionPane.showMessageDialog(null, e); + }finally { + try { + conn.close(); + System.out.println("disconnected"); + } catch (SQLException ex) { + Logger.getLogger(client_info.class.getName()).log(Level.SEVERE, null, ex); + } + } + + } + + public Collection() { + + initComponents(); + + update_table(); + } + + /** 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") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jPanel2 = new javax.swing.JPanel(); + txt_discount1 = new javax.swing.JTextField(); + jLabel9 = new javax.swing.JLabel(); + txt_advance1 = new javax.swing.JTextField(); + jLabel10 = new javax.swing.JLabel(); + txt_due1 = new javax.swing.JTextField(); + jLabel11 = new javax.swing.JLabel(); + txt_name1 = new javax.swing.JTextField(); + jLabel12 = new javax.swing.JLabel(); + txt_paidAmmount1 = new javax.swing.JTextField(); + txt_id1 = new javax.swing.JTextField(); + jLabel13 = new javax.swing.JLabel(); + jLabel15 = new javax.swing.JLabel(); + txt_date1 = new com.toedter.calendar.JDateChooser(); + txt_remark1 = new javax.swing.JTextField(); + txt_remarks1 = new javax.swing.JLabel(); + jLabel14 = new javax.swing.JLabel(); + jToolBar1 = new javax.swing.JToolBar(); + jButton8 = new javax.swing.JButton(); + jButton2 = new javax.swing.JButton(); + jButton3 = new javax.swing.JButton(); + jButton4 = new javax.swing.JButton(); + jButton5 = new javax.swing.JButton(); + jButton6 = new javax.swing.JButton(); + jButton9 = new javax.swing.JButton(); + jButton7 = new javax.swing.JButton(); + jButton10 = new javax.swing.JButton(); + jLabel8 = new javax.swing.JLabel(); + jPanel5 = new javax.swing.JPanel(); + button_done9 = new javax.swing.JButton(); + button_done10 = new javax.swing.JButton(); + button_done11 = new javax.swing.JButton(); + jSeparator1 = new javax.swing.JSeparator(); + jScrollPane1 = new javax.swing.JScrollPane(); + jScrollPane3 = new javax.swing.JScrollPane(); + collection_table1 = new javax.swing.JTable(); + jMenuBar1 = new javax.swing.JMenuBar(); + jMenu1 = new javax.swing.JMenu(); + jMenuItem1 = new javax.swing.JMenuItem(); + jMenuItem2 = new javax.swing.JMenuItem(); + jMenuItem3 = new javax.swing.JMenuItem(); + jMenuItem4 = new javax.swing.JMenuItem(); + jMenuItem5 = new javax.swing.JMenuItem(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + + jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Collection", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 14), new java.awt.Color(51, 102, 255))); // NOI18N + jPanel2.setForeground(new java.awt.Color(0, 102, 153)); + + txt_discount1.setText("0"); + + jLabel9.setText("Advance :"); + + txt_advance1.setText("0"); + txt_advance1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + txt_advanceActionPerformed(evt); + } + }); + + jLabel10.setText("Total Due :"); + + txt_due1.setText("0"); + + jLabel11.setText("Name :"); + + jLabel12.setText("Discount :"); + + txt_paidAmmount1.setText("0"); + + txt_id1.addKeyListener(new java.awt.event.KeyAdapter() { + public void keyPressed(java.awt.event.KeyEvent evt) { + txt_idKeyPressed(evt); + } + public void keyReleased(java.awt.event.KeyEvent evt) { + txt_idKeyReleased(evt); + } + public void keyTyped(java.awt.event.KeyEvent evt) { + txt_idKeyTyped(evt); + } + }); + + jLabel13.setText("Client ID :"); + + jLabel15.setText("Date :"); + + txt_date1.setDateFormatString("yyyy-MM-dd"); + + txt_remark1.addKeyListener(new java.awt.event.KeyAdapter() { + public void keyPressed(java.awt.event.KeyEvent evt) { + txt_id1KeyPressed(evt); + } + public void keyReleased(java.awt.event.KeyEvent evt) { + txt_id1KeyReleased(evt); + } + public void keyTyped(java.awt.event.KeyEvent evt) { + txt_id1KeyTyped(evt); + } + }); + + txt_remarks1.setText("Des. :"); + + jLabel14.setText("Paid Amount :"); + + javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); + jPanel2.setLayout(jPanel2Layout); + jPanel2Layout.setHorizontalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel13) + .addComponent(jLabel11) + .addComponent(txt_remarks1) + .addComponent(jLabel15)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(txt_date1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(txt_remark1) + .addComponent(txt_name1) + .addComponent(txt_id1, javax.swing.GroupLayout.DEFAULT_SIZE, 204, Short.MAX_VALUE)) + .addGap(34, 34, 34) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel10) + .addComponent(jLabel9) + .addComponent(jLabel14) + .addComponent(jLabel12)) + .addGap(18, 18, 18) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(txt_paidAmmount1, javax.swing.GroupLayout.DEFAULT_SIZE, 197, Short.MAX_VALUE) + .addComponent(txt_discount1, javax.swing.GroupLayout.DEFAULT_SIZE, 197, Short.MAX_VALUE) + .addComponent(txt_advance1, javax.swing.GroupLayout.DEFAULT_SIZE, 197, Short.MAX_VALUE) + .addComponent(txt_due1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 197, Short.MAX_VALUE)) + .addContainerGap()) + ); + jPanel2Layout.setVerticalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(txt_due1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel13) + .addComponent(txt_id1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel10)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(txt_name1, javax.swing.GroupLayout.DEFAULT_SIZE, 20, Short.MAX_VALUE) + .addComponent(jLabel11) + .addComponent(txt_advance1) + .addComponent(jLabel9)) + .addGap(15, 15, 15) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(txt_remark1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(txt_remarks1) + .addComponent(txt_discount1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(jLabel12)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel15) + .addComponent(txt_date1, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(txt_paidAmmount1, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel14))) + .addContainerGap()) + ); + + jToolBar1.setRollover(true); + + jButton8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/1-Normal-Home-icon.png"))); // NOI18N + jButton8.setText("Home"); + jButton8.setFocusable(false); + jButton8.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton8.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton8.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton8ActionPerformed(evt); + } + }); + jToolBar1.add(jButton8); + + jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/new32.png"))); // NOI18N + jButton2.setText("New Client"); + jButton2.setFocusable(false); + jButton2.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton2.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton2ActionPerformed(evt); + } + }); + jToolBar1.add(jButton2); + + jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/money-icon.png"))); // NOI18N + jButton3.setText("Transaction"); + jButton3.setFocusable(false); + jButton3.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton3.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton3ActionPerformed(evt); + } + }); + jToolBar1.add(jButton3); + + jButton4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/Collection-2-icon.png"))); // NOI18N + jButton4.setText("Collection"); + jButton4.setFocusable(false); + jButton4.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton4.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton4.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton4ActionPerformed(evt); + } + }); + jToolBar1.add(jButton4); + + jButton5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/print32.png"))); // NOI18N + jButton5.setText("Print"); + jButton5.setFocusable(false); + jButton5.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton5.setMaximumSize(new java.awt.Dimension(57, 57)); + jButton5.setMinimumSize(new java.awt.Dimension(57, 57)); + jButton5.setPreferredSize(new java.awt.Dimension(57, 57)); + jButton5.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton5.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton5ActionPerformed(evt); + } + }); + jToolBar1.add(jButton5); + + jButton6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/Calendar-icon.png"))); // NOI18N + jButton6.setText("Calender"); + jButton6.setFocusable(false); + jButton6.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton6.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton6.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton6ActionPerformed(evt); + } + }); + jToolBar1.add(jButton6); + + jButton9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/Button-Refresh-icon.png"))); // NOI18N + jButton9.setText("Refresh"); + jButton9.setFocusable(false); + jButton9.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton9.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jToolBar1.add(jButton9); + + jButton7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/search-icon.png"))); // NOI18N + jButton7.setText("Search"); + jButton7.setFocusable(false); + jButton7.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton7.setMaximumSize(new java.awt.Dimension(57, 57)); + jButton7.setMinimumSize(new java.awt.Dimension(57, 57)); + jButton7.setPreferredSize(new java.awt.Dimension(57, 57)); + jButton7.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jToolBar1.add(jButton7); + + jButton10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/close32.png"))); // NOI18N + jButton10.setText("Close"); + jButton10.setFocusable(false); + jButton10.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton10.setMaximumSize(new java.awt.Dimension(57, 57)); + jButton10.setMinimumSize(new java.awt.Dimension(57, 57)); + jButton10.setPreferredSize(new java.awt.Dimension(57, 57)); + jButton10.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton10.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton10ActionPerformed(evt); + } + }); + jToolBar1.add(jButton10); + + jLabel8.setFont(new java.awt.Font("Rockwell Extra Bold", 1, 24)); // NOI18N + jLabel8.setForeground(new java.awt.Color(0, 51, 102)); + jLabel8.setText("Recent Collections"); + + jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Options", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 14), new java.awt.Color(0, 153, 255))); // NOI18N + + button_done9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/done1.png"))); // NOI18N + button_done9.setText("Done"); + button_done9.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + button_doneActionPerformed(evt); + } + }); + + button_done10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/clear.png"))); // NOI18N + button_done10.setText("Clear"); + button_done10.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + button_done1ActionPerformed(evt); + } + }); + + button_done11.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/print-icon.png"))); // NOI18N + button_done11.setText("Print"); + button_done11.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + button_done2ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); + jPanel5.setLayout(jPanel5Layout); + jPanel5Layout.setHorizontalGroup( + jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel5Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(button_done9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(button_done10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(button_done11, javax.swing.GroupLayout.DEFAULT_SIZE, 77, Short.MAX_VALUE)) + .addContainerGap()) + ); + jPanel5Layout.setVerticalGroup( + jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel5Layout.createSequentialGroup() + .addContainerGap() + .addComponent(button_done9) + .addGap(18, 18, 18) + .addComponent(button_done10) + .addGap(18, 18, 18) + .addComponent(button_done11) + .addContainerGap(17, Short.MAX_VALUE)) + ); + + collection_table1.setModel(new javax.swing.table.DefaultTableModel( + new Object [][] { + {null, null, null, null}, + {null, null, null, null}, + {null, null, null, null}, + {null, null, null, null} + }, + new String [] { + "Title 1", "Title 2", "Title 3", "Title 4" + } + )); + collection_table1.addMouseListener(new java.awt.event.MouseAdapter() { + public void mouseClicked(java.awt.event.MouseEvent evt) { + collection_table1MouseClicked(evt); + } + public void mouseEntered(java.awt.event.MouseEvent evt) { + collection_table1MouseEntered(evt); + } + }); + collection_table1.addKeyListener(new java.awt.event.KeyAdapter() { + public void keyPressed(java.awt.event.KeyEvent evt) { + collection_table1KeyPressed(evt); + } + }); + jScrollPane3.setViewportView(collection_table1); + + jScrollPane1.setViewportView(jScrollPane3); + + jMenu1.setText("Option"); + + jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_H, java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/house-icon.png"))); // NOI18N + jMenuItem1.setText("Home"); + jMenuItem1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem1ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem1); + + jMenuItem2.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/new1.png"))); // NOI18N + jMenuItem2.setText("New Client"); + jMenuItem2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem2ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem2); + + jMenuItem3.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/money-icon (1).png"))); // NOI18N + jMenuItem3.setText("Transection"); + jMenuItem3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem3ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem3); + + jMenuItem4.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/Collection-2-icon (1).png"))); // NOI18N + jMenuItem4.setText("Collection"); + jMenuItem4.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem4ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem4); + + jMenuItem5.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/close1.png"))); // NOI18N + jMenuItem5.setText("Close"); + jMenuItem5.addMouseListener(new java.awt.event.MouseAdapter() { + public void mouseClicked(java.awt.event.MouseEvent evt) { + jMenuItem5MouseClicked(evt); + } + }); + jMenuItem5.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem5ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem5); + + jMenuBar1.add(jMenu1); + + setJMenuBar(jMenuBar1); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jToolBar1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addGap(227, 227, 227) + .addComponent(jLabel8)) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addGap(206, 206, 206) + .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 332, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap()) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 719, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel8) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(213, 213, 213) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap()) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(111, 111, 111) + .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 192, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(185, Short.MAX_VALUE))) + ); + + java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); + setBounds((screenSize.width-755)/2, (screenSize.height-547)/2, 755, 547); + }// //GEN-END:initComponents + + private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jButton4ActionPerformed + + private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed + this.dispose(); + new Delivery().setVisible(true); + }//GEN-LAST:event_jButton3ActionPerformed + + private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton10ActionPerformed + System.exit(0); + }//GEN-LAST:event_jButton10ActionPerformed + + private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed + + this.dispose(); + + new client_info().setVisible(true); +}//GEN-LAST:event_jMenuItem2ActionPerformed + + private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed + + this.dispose(); + + new Delivery().setVisible(true); + }//GEN-LAST:event_jMenuItem3ActionPerformed + + private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed + + this.dispose(); + + new Collection().setVisible(true); + }//GEN-LAST:event_jMenuItem4ActionPerformed + + private void jMenuItem5MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenuItem5MouseClicked + System.exit(0); +}//GEN-LAST:event_jMenuItem5MouseClicked + + private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed + System.exit(0); +}//GEN-LAST:event_jMenuItem5ActionPerformed + + private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed + this.dispose(); + new HomePage().setVisible(true); + }//GEN-LAST:event_jButton8ActionPerformed + + private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed + this.dispose(); + new client_info().setVisible(true); + }//GEN-LAST:event_jButton2ActionPerformed + + private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed + this.dispose(); + new HomePage().setVisible(true); + }//GEN-LAST:event_jMenuItem1ActionPerformed + + private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed + + this.dispose(); + + new MyCalender().setVisible(true); + + }//GEN-LAST:event_jButton6ActionPerformed + + private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed + + this.dispose(); + + new Client_page().setVisible(true); + }//GEN-LAST:event_jButton5ActionPerformed + + private void due_calculation() + { + double t_tk = 0,t_delivery = 0,t_discount = 0; + PreparedStatement pst; + + DataBase_connect obj=new DataBase_connect(); + + Connection conn=obj.Open(); + + try{ + + String sql="select total_paid_amount,total_delivery,total_discount from client_info where id='"+txt_id1.getText()+"'"; + System.out.println("sd"); + Statement statement = (Statement) conn.createStatement(); + + ResultSet rs=statement.executeQuery(sql); + + if(rs.next()){ + System.out.println("df"); + t_tk=rs.getDouble(1); + t_delivery=rs.getDouble(2); + t_discount=rs.getDouble(3); + } + double due =t_tk-t_delivery-t_discount; + String du=""+due; + System.out.println("due"); + if(due>=0) + { + txt_due1.setText(du); + txt_advance1.setText("0"); + } + else { + + due=-1*due; + du=""+due; + txt_due1.setText("0"); + txt_advance1.setText(du); + + } + }catch(Exception e){ + JOptionPane.showMessageDialog(null, e+"asd"); + }finally { + try { + conn.close();System.out.println("disconnected"); + } catch (SQLException ex) { + Logger.getLogger(client_info.class.getName()).log(Level.SEVERE, null, ex); + } + } + + return; + } + + public void takin_input_from_table() + { + + PreparedStatement pst; + + DataBase_connect obj=new DataBase_connect(); + + Connection conn=obj.Open(); + + try{ + int row=collection_table1.getSelectedRow(); + rowf=row; + String table_click=collection_table1.getModel().getValueAt(row, 0).toString(); + String sql="select * from collection_table where serial_no ='"+table_click+"'"; + pst=(PreparedStatement) conn.prepareStatement(sql); + rs=pst.executeQuery(); + if(rs.next()) { + String add1=rs.getString("id"); + txt_id1.setText(add1); + String add2=rs.getString("name"); + txt_name1.setText(add2); + String add3=rs.getString("description"); + txt_remark1.setText(add3); + + String add6=rs.getObject("collection_date").toString(); + java.util.Date dat = new SimpleDateFormat("yyyy-MM-dd").parse(add6); + txt_date1.setDate(dat); + + String add7=rs.getString("discount"); + txt_discount1.setText(add7); + + String add8=rs.getString("taka"); + txt_paidAmmount1.setText(add8); + + due_calculation(); + + } + }catch(Exception e){ + JOptionPane.showMessageDialog(null, e+" fd"); + }finally { + try { + conn.close();System.out.println("disconnected"); + } catch (SQLException ex) { + Logger.getLogger(client_info.class.getName()).log(Level.SEVERE, null, ex); + } + } + + update_table(); + } + + private void txt_id1KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_id1KeyTyped + // TODO add your handling code here: +}//GEN-LAST:event_txt_id1KeyTyped + + private void txt_id1KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_id1KeyReleased + // TODO add your handling code here: +}//GEN-LAST:event_txt_id1KeyReleased + + private void txt_id1KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_id1KeyPressed + // TODO add your handling code here: +}//GEN-LAST:event_txt_id1KeyPressed + + private void txt_idKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_idKeyTyped + +}//GEN-LAST:event_txt_idKeyTyped + + private void txt_idKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_idKeyReleased + + PreparedStatement pst; + + DataBase_connect obj=new DataBase_connect(); + + Connection conn=obj.Open(); + try{ + String id=txt_id1.getText(); + + String sql="select name,total_paid_amount,total_discount,total_delivery from client_info where id='"+id+"'"; + + Statement statement = (Statement) conn.createStatement(); + ResultSet rs=statement.executeQuery(sql); + System.out.println("gffg"); + String nme; + double t_paid_amount,t_discount,t_delivery,cal; + if(rs.next()){ + + nme=rs.getString(1); + t_paid_amount=rs.getDouble(2); + t_discount=rs.getDouble(3); + t_delivery=rs.getDouble(4); + txt_name1.setText(nme); + cal=t_delivery-t_paid_amount-t_discount; + + if(cal>=0) { + String s=""+cal; + txt_due1.setText(s); + } else { + cal=cal*(-1); + String s=""+cal; + txt_advance1.setText(s); + } + + }else{ + txt_name1.setText(""); + txt_due1.setText("0"); + txt_advance1.setText("0"); + } + }catch(Exception e){ + JOptionPane.showMessageDialog(null, e); + } + }//GEN-LAST:event_txt_idKeyReleased + + private void txt_idKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_idKeyPressed + +}//GEN-LAST:event_txt_idKeyPressed + + private void txt_advanceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txt_advanceActionPerformed + // TODO add your handling code here: +}//GEN-LAST:event_txt_advanceActionPerformed + + private void button_done2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button_done2ActionPerformed + + MessageFormat header=new MessageFormat("Report Print"); + MessageFormat footer=new MessageFormat("Page{0,number,integer}"); + try{ + collection_table1.print(JTable.PrintMode.NORMAL,header,footer); + }catch(Exception e){ + + } + }//GEN-LAST:event_button_done2ActionPerformed + + private void button_done1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button_done1ActionPerformed + + txt_name1.setText(""); + txt_id1.setText(""); + txt_remark1.setText(""); + txt_date1.setDate(null); + + txt_discount1.setText("0"); + txt_advance1.setText("0"); + txt_due1.setText("0"); + txt_paidAmmount1.setText("0"); + + }//GEN-LAST:event_button_done1ActionPerformed + + private void button_doneActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button_doneActionPerformed + + PreparedStatement pst; + + DataBase_connect obj=new DataBase_connect(); + + Connection conn=obj.Open(); + double total_taka=0,tot1=0;String id = null; + try{ + double dub=Double.parseDouble(txt_paidAmmount1.getText()); + + String sql="select total_paid_amount from client_info where id='"+txt_id1.getText()+"'"; + + Statement statement = (Statement) conn.createStatement(); + + ResultSet rs=statement.executeQuery(sql); + + while(rs.next()){ + total_taka=rs.getDouble(1); + } + total_taka+=dub; + + dub=Double.parseDouble(txt_discount1.getText()); + + sql="select total_discount from client_info where id='"+txt_id1.getText()+"'"; + + rs=statement.executeQuery(sql); + + while(rs.next()){ + tot1=rs.getDouble(1); + } + tot1+=dub; + + id=txt_id1.getText(); + + String total_tk="" +total_taka; + + String val=((JTextField)txt_date1.getDateEditor().getUiComponent()).getText(); + + sql="insert into collection_table(id,name,taka,total_taka,discount,collection_date, description) values ('" + txt_id1.getText() + "','" + txt_name1.getText() + "','" + txt_paidAmmount1.getText() + "','"+ total_tk+ "','" + txt_discount1.getText() +"','" + val +"','" + txt_remark1.getText() + "')"; + pst=(PreparedStatement) conn.prepareStatement(sql); + pst.execute(); + + // JOptionPane.showMessageDialog(null, "Updated"); + }catch(Exception e){ + JOptionPane.showMessageDialog(null, e); + } + + try{ + String sql="update client_info set total_paid_amount='" + total_taka +"',total_discount='"+tot1+"' where id='"+id+"'"; + pst=(PreparedStatement) conn.prepareStatement(sql); + pst.execute(); + JOptionPane.showMessageDialog(null, "Done"); + }catch(Exception e){ + JOptionPane.showMessageDialog(null, e); + } + + update_table(); + + txt_id1.setText(""); + txt_name1.setText(""); + txt_remark1.setText(""); + txt_discount1.setText("0"); + txt_paidAmmount1.setText("0"); + txt_advance1.setText("0"); + txt_due1.setText("0"); + txt_date1.setDate(null); + }//GEN-LAST:event_button_doneActionPerformed + + private void collection_table1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_collection_table1MouseClicked + + takin_input_from_table(); +}//GEN-LAST:event_collection_table1MouseClicked + + private void collection_table1MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_collection_table1MouseEntered + // TODO add your handling code here: +}//GEN-LAST:event_collection_table1MouseEntered + + private void collection_table1KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_collection_table1KeyPressed + +}//GEN-LAST:event_collection_table1KeyPressed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + + try { + + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + //UIManager.setLookAndFeel("com.jtattoo.plaf.smart.SmartLookAndFeel"); + //UIManager.setLookAndFeel("com.jtattoo.plaf.acryl.AcrylLookAndFeel"); + UIManager.setLookAndFeel("com.jtattoo.plaf.aero.AeroLookAndFeel"); + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(StockEntry.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(StockEntry.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(StockEntry.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(StockEntry.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + + new Collection().setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton button_done; + private javax.swing.JButton button_done1; + private javax.swing.JButton button_done10; + private javax.swing.JButton button_done11; + private javax.swing.JButton button_done2; + private javax.swing.JButton button_done3; + private javax.swing.JButton button_done4; + private javax.swing.JButton button_done5; + private javax.swing.JButton button_done6; + private javax.swing.JButton button_done7; + private javax.swing.JButton button_done8; + private javax.swing.JButton button_done9; + private javax.swing.JTable collection_table1; + private javax.swing.JButton jButton10; + private javax.swing.JButton jButton2; + private javax.swing.JButton jButton3; + private javax.swing.JButton jButton4; + private javax.swing.JButton jButton5; + private javax.swing.JButton jButton6; + private javax.swing.JButton jButton7; + private javax.swing.JButton jButton8; + private javax.swing.JButton jButton9; + private javax.swing.JLabel jLabel10; + private javax.swing.JLabel jLabel11; + private javax.swing.JLabel jLabel12; + private javax.swing.JLabel jLabel13; + private javax.swing.JLabel jLabel14; + private javax.swing.JLabel jLabel15; + private javax.swing.JLabel jLabel8; + private javax.swing.JLabel jLabel9; + private javax.swing.JMenu jMenu1; + private javax.swing.JMenuBar jMenuBar1; + private javax.swing.JMenuItem jMenuItem1; + private javax.swing.JMenuItem jMenuItem2; + private javax.swing.JMenuItem jMenuItem3; + private javax.swing.JMenuItem jMenuItem4; + private javax.swing.JMenuItem jMenuItem5; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel2; + private javax.swing.JPanel jPanel3; + private javax.swing.JPanel jPanel4; + private javax.swing.JPanel jPanel5; + private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JScrollPane jScrollPane2; + private javax.swing.JScrollPane jScrollPane3; + private javax.swing.JSeparator jSeparator1; + private javax.swing.JToolBar jToolBar1; + private javax.swing.JTextField txt_advance1; + private com.toedter.calendar.JDateChooser txt_date1; + private javax.swing.JTextField txt_discount1; + private javax.swing.JTextField txt_due1; + private javax.swing.JTextField txt_id1; + private javax.swing.JTextField txt_name1; + private javax.swing.JTextField txt_paidAmmount1; + private javax.swing.JTextField txt_remark1; + private javax.swing.JLabel txt_remarks1; + // End of variables declaration//GEN-END:variables + int rowf; +} diff --git a/ST2-Project-master/src/Collection_tab.form b/ST2-Project-master/src/Collection_tab.form new file mode 100644 index 0000000..97228de --- /dev/null +++ b/ST2-Project-master/src/Collection_tab.form @@ -0,0 +1,688 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + +
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + +
+
+
+
+
+
+
+
+
+
+ diff --git a/ST2-Project-master/src/Collection_tab.java b/ST2-Project-master/src/Collection_tab.java new file mode 100644 index 0000000..094c3cd --- /dev/null +++ b/ST2-Project-master/src/Collection_tab.java @@ -0,0 +1,1062 @@ + +import com.mysql.jdbc.Connection; +import com.mysql.jdbc.PreparedStatement; +import com.mysql.jdbc.Statement; +import com.sun.java.swing.plaf.windows.WindowsTreeUI.CollapsedIcon; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.text.MessageFormat; +import java.text.SimpleDateFormat; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.swing.JOptionPane; +import javax.swing.JTable; +import javax.swing.JTextField; +import javax.swing.UIManager; +import net.proteanit.sql.DbUtils; + +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +/* + * Client_information.java + * + * Created on Sep 18, 2012, 3:20:48 AM + */ + +/** + * + * @author Vish + */ +public class Collection_tab extends javax.swing.JFrame { + + Connection conn=null; + ResultSet rs=null; + PreparedStatement pst=null; + + private void update_table(JTable jtable, int client_id) { + + PreparedStatement pst; + + DataBase_connect obj=new DataBase_connect(); + + Connection conn=obj.Open(); + + try{ + String sql; + + if(client_id==0) sql="select * from collection_table"; + + else sql="select * from collection_table where id='" + client_id + "'"; + + pst=(PreparedStatement) conn.prepareStatement(sql); + rs=pst.executeQuery(); + jtable.setModel(DbUtils.resultSetToTableModel(rs)); + }catch(Exception e){ + JOptionPane.showMessageDialog(null, e); + }finally { + try { + conn.close(); + System.out.println("disconnected"); + } catch (SQLException ex) { + Logger.getLogger(client_info.class.getName()).log(Level.SEVERE, null, ex); + } + } + + } + + public Collection_tab() { + + initComponents(); + + update_table(collection_table,0); + + update_table(collection_table_client,-1); + } + + /** 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") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jPanel2 = new javax.swing.JPanel(); + txt_discount1 = new javax.swing.JTextField(); + jLabel9 = new javax.swing.JLabel(); + txt_advance1 = new javax.swing.JTextField(); + jLabel10 = new javax.swing.JLabel(); + txt_due1 = new javax.swing.JTextField(); + jLabel11 = new javax.swing.JLabel(); + txt_name1 = new javax.swing.JTextField(); + jLabel12 = new javax.swing.JLabel(); + txt_paidAmmount1 = new javax.swing.JTextField(); + txt_id1 = new javax.swing.JTextField(); + jLabel13 = new javax.swing.JLabel(); + jLabel14 = new javax.swing.JLabel(); + jLabel15 = new javax.swing.JLabel(); + txt_date1 = new com.toedter.calendar.JDateChooser(); + txt_remark1 = new javax.swing.JTextField(); + txt_remarks1 = new javax.swing.JLabel(); + jToolBar1 = new javax.swing.JToolBar(); + jButton8 = new javax.swing.JButton(); + jButton2 = new javax.swing.JButton(); + jButton3 = new javax.swing.JButton(); + jButton4 = new javax.swing.JButton(); + jButton5 = new javax.swing.JButton(); + jButton6 = new javax.swing.JButton(); + jButton9 = new javax.swing.JButton(); + jButton7 = new javax.swing.JButton(); + jButton10 = new javax.swing.JButton(); + jPanel1 = new javax.swing.JPanel(); + button_done = new javax.swing.JButton(); + button_done1 = new javax.swing.JButton(); + button_done2 = new javax.swing.JButton(); + jTabbedPane1 = new javax.swing.JTabbedPane(); + jPanel3 = new javax.swing.JPanel(); + jScrollPane1 = new javax.swing.JScrollPane(); + jScrollPane3 = new javax.swing.JScrollPane(); + collection_table = new javax.swing.JTable(); + jPanel4 = new javax.swing.JPanel(); + jScrollPane2 = new javax.swing.JScrollPane(); + jScrollPane4 = new javax.swing.JScrollPane(); + collection_table_client = new javax.swing.JTable(); + jMenuBar1 = new javax.swing.JMenuBar(); + jMenu1 = new javax.swing.JMenu(); + jMenuItem1 = new javax.swing.JMenuItem(); + jMenuItem2 = new javax.swing.JMenuItem(); + jMenuItem3 = new javax.swing.JMenuItem(); + jMenuItem4 = new javax.swing.JMenuItem(); + jMenuItem5 = new javax.swing.JMenuItem(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + + jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Collection", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 14), new java.awt.Color(51, 102, 255))); // NOI18N + jPanel2.setForeground(new java.awt.Color(0, 102, 153)); + + txt_discount1.setText("0"); + + jLabel9.setText("Advance :"); + + txt_advance1.setText("0"); + txt_advance1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + txt_advanceActionPerformed(evt); + } + }); + + jLabel10.setText("Total Due :"); + + txt_due1.setText("0"); + + jLabel11.setText("Name :"); + + jLabel12.setText("Discount :"); + + txt_paidAmmount1.setText("0"); + + txt_id1.addKeyListener(new java.awt.event.KeyAdapter() { + public void keyPressed(java.awt.event.KeyEvent evt) { + txt_idKeyPressed(evt); + } + public void keyReleased(java.awt.event.KeyEvent evt) { + txt_idKeyReleased(evt); + } + public void keyTyped(java.awt.event.KeyEvent evt) { + txt_idKeyTyped(evt); + } + }); + + jLabel13.setText("Client ID :"); + + jLabel14.setText("Paid Amount :"); + + jLabel15.setText("Date :"); + + txt_date1.setDateFormatString("yyyy-MM-dd"); + + txt_remark1.addKeyListener(new java.awt.event.KeyAdapter() { + public void keyPressed(java.awt.event.KeyEvent evt) { + txt_id1KeyPressed(evt); + } + public void keyReleased(java.awt.event.KeyEvent evt) { + txt_id1KeyReleased(evt); + } + public void keyTyped(java.awt.event.KeyEvent evt) { + txt_id1KeyTyped(evt); + } + }); + + txt_remarks1.setText("Des. :"); + + javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); + jPanel2.setLayout(jPanel2Layout); + jPanel2Layout.setHorizontalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel13) + .addComponent(jLabel11) + .addComponent(txt_remarks1) + .addComponent(jLabel15)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(txt_date1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(txt_remark1) + .addComponent(txt_name1) + .addComponent(txt_id1, javax.swing.GroupLayout.DEFAULT_SIZE, 204, Short.MAX_VALUE)) + .addGap(20, 20, 20) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel10) + .addComponent(jLabel9) + .addComponent(jLabel12) + .addComponent(jLabel14)) + .addGap(18, 18, 18) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(txt_paidAmmount1, javax.swing.GroupLayout.DEFAULT_SIZE, 186, Short.MAX_VALUE) + .addComponent(txt_discount1, javax.swing.GroupLayout.DEFAULT_SIZE, 186, Short.MAX_VALUE) + .addComponent(txt_advance1, javax.swing.GroupLayout.DEFAULT_SIZE, 186, Short.MAX_VALUE) + .addComponent(txt_due1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 186, Short.MAX_VALUE)) + .addContainerGap()) + ); + jPanel2Layout.setVerticalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(txt_due1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel13) + .addComponent(txt_id1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel10)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(txt_name1, javax.swing.GroupLayout.DEFAULT_SIZE, 20, Short.MAX_VALUE) + .addComponent(jLabel11) + .addComponent(txt_advance1) + .addComponent(jLabel9)) + .addGap(15, 15, 15) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(txt_remark1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(txt_remarks1) + .addComponent(txt_discount1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel12)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel15) + .addComponent(txt_date1, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(txt_paidAmmount1, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel14))) + .addContainerGap()) + ); + + jToolBar1.setRollover(true); + + jButton8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/1-Normal-Home-icon.png"))); // NOI18N + jButton8.setText("Home"); + jButton8.setFocusable(false); + jButton8.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton8.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton8.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton8ActionPerformed(evt); + } + }); + jToolBar1.add(jButton8); + + jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/new32.png"))); // NOI18N + jButton2.setText("New Client"); + jButton2.setFocusable(false); + jButton2.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton2.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton2ActionPerformed(evt); + } + }); + jToolBar1.add(jButton2); + + jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/money-icon.png"))); // NOI18N + jButton3.setText("Transaction"); + jButton3.setFocusable(false); + jButton3.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton3.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton3ActionPerformed(evt); + } + }); + jToolBar1.add(jButton3); + + jButton4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/Collection-2-icon.png"))); // NOI18N + jButton4.setText("Collection"); + jButton4.setFocusable(false); + jButton4.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton4.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton4.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton4ActionPerformed(evt); + } + }); + jToolBar1.add(jButton4); + + jButton5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/print32.png"))); // NOI18N + jButton5.setText("Print"); + jButton5.setFocusable(false); + jButton5.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton5.setMaximumSize(new java.awt.Dimension(57, 57)); + jButton5.setMinimumSize(new java.awt.Dimension(57, 57)); + jButton5.setPreferredSize(new java.awt.Dimension(57, 57)); + jButton5.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton5.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton5ActionPerformed(evt); + } + }); + jToolBar1.add(jButton5); + + jButton6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/Calendar-icon.png"))); // NOI18N + jButton6.setText("Calender"); + jButton6.setFocusable(false); + jButton6.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton6.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton6.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton6ActionPerformed(evt); + } + }); + jToolBar1.add(jButton6); + + jButton9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/Button-Refresh-icon.png"))); // NOI18N + jButton9.setText("Refresh"); + jButton9.setFocusable(false); + jButton9.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton9.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jToolBar1.add(jButton9); + + jButton7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/search-icon.png"))); // NOI18N + jButton7.setText("Search"); + jButton7.setFocusable(false); + jButton7.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton7.setMaximumSize(new java.awt.Dimension(57, 57)); + jButton7.setMinimumSize(new java.awt.Dimension(57, 57)); + jButton7.setPreferredSize(new java.awt.Dimension(57, 57)); + jButton7.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jToolBar1.add(jButton7); + + jButton10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/close32.png"))); // NOI18N + jButton10.setText("Close"); + jButton10.setFocusable(false); + jButton10.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton10.setMaximumSize(new java.awt.Dimension(57, 57)); + jButton10.setMinimumSize(new java.awt.Dimension(57, 57)); + jButton10.setPreferredSize(new java.awt.Dimension(57, 57)); + jButton10.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton10.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton10ActionPerformed(evt); + } + }); + jToolBar1.add(jButton10); + + jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Options", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 14), new java.awt.Color(0, 153, 255))); // NOI18N + + button_done.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/done1.png"))); // NOI18N + button_done.setText("Done"); + button_done.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + button_doneActionPerformed(evt); + } + }); + + button_done1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/clear.png"))); // NOI18N + button_done1.setText("Clear"); + button_done1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + button_done1ActionPerformed(evt); + } + }); + + button_done2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/print-icon.png"))); // NOI18N + button_done2.setText("Print"); + button_done2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + button_done2ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(button_done, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(button_done1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(button_done2, javax.swing.GroupLayout.DEFAULT_SIZE, 77, Short.MAX_VALUE)) + .addContainerGap()) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addComponent(button_done) + .addGap(18, 18, 18) + .addComponent(button_done1) + .addGap(18, 18, 18) + .addComponent(button_done2) + .addContainerGap(17, Short.MAX_VALUE)) + ); + + collection_table.setModel(new javax.swing.table.DefaultTableModel( + new Object [][] { + {null, null, null, null}, + {null, null, null, null}, + {null, null, null, null}, + {null, null, null, null} + }, + new String [] { + "Title 1", "Title 2", "Title 3", "Title 4" + } + )); + collection_table.addMouseListener(new java.awt.event.MouseAdapter() { + public void mouseClicked(java.awt.event.MouseEvent evt) { + collection_tableMouseClicked(evt); + } + public void mouseEntered(java.awt.event.MouseEvent evt) { + collection_tableMouseEntered(evt); + } + }); + collection_table.addKeyListener(new java.awt.event.KeyAdapter() { + public void keyPressed(java.awt.event.KeyEvent evt) { + collection_tableKeyPressed(evt); + } + }); + jScrollPane3.setViewportView(collection_table); + + jScrollPane1.setViewportView(jScrollPane3); + + javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); + jPanel3.setLayout(jPanel3Layout); + jPanel3Layout.setHorizontalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 724, Short.MAX_VALUE) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 724, Short.MAX_VALUE)) + ); + jPanel3Layout.setVerticalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 193, Short.MAX_VALUE) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 193, Short.MAX_VALUE)) + ); + + jTabbedPane1.addTab("Recent Collections ", jPanel3); + + collection_table_client.setModel(new javax.swing.table.DefaultTableModel( + new Object [][] { + {null, null, null, null}, + {null, null, null, null}, + {null, null, null, null}, + {null, null, null, null} + }, + new String [] { + "Title 1", "Title 2", "Title 3", "Title 4" + } + )); + collection_table_client.addMouseListener(new java.awt.event.MouseAdapter() { + public void mouseClicked(java.awt.event.MouseEvent evt) { + collection_table_clientMouseClicked(evt); + } + public void mouseEntered(java.awt.event.MouseEvent evt) { + collection_table_clientMouseEntered(evt); + } + }); + collection_table_client.addKeyListener(new java.awt.event.KeyAdapter() { + public void keyPressed(java.awt.event.KeyEvent evt) { + collection_table_clientKeyPressed(evt); + } + }); + jScrollPane4.setViewportView(collection_table_client); + + jScrollPane2.setViewportView(jScrollPane4); + + javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); + jPanel4.setLayout(jPanel4Layout); + jPanel4Layout.setHorizontalGroup( + jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 724, Short.MAX_VALUE) + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 724, Short.MAX_VALUE)) + ); + jPanel4Layout.setVerticalGroup( + jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 193, Short.MAX_VALUE) + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 193, Short.MAX_VALUE)) + ); + + jTabbedPane1.addTab("Client Collections ", jPanel4); + + jMenu1.setText("Option"); + + jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_H, java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/house-icon.png"))); // NOI18N + jMenuItem1.setText("Home"); + jMenuItem1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem1ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem1); + + jMenuItem2.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/new1.png"))); // NOI18N + jMenuItem2.setText("New Client"); + jMenuItem2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem2ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem2); + + jMenuItem3.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/money-icon (1).png"))); // NOI18N + jMenuItem3.setText("Transection"); + jMenuItem3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem3ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem3); + + jMenuItem4.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/Collection-2-icon (1).png"))); // NOI18N + jMenuItem4.setText("Collection"); + jMenuItem4.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem4ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem4); + + jMenuItem5.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/close1.png"))); // NOI18N + jMenuItem5.setText("Close"); + jMenuItem5.addMouseListener(new java.awt.event.MouseAdapter() { + public void mouseClicked(java.awt.event.MouseEvent evt) { + jMenuItem5MouseClicked(evt); + } + }); + jMenuItem5.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem5ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem5); + + jMenuBar1.add(jMenu1); + + setJMenuBar(jMenuBar1); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(27, 27, 27) + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(24, 24, 24)) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 729, Short.MAX_VALUE) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 221, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(12, 12, 12) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap()) + ); + + java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); + setBounds((screenSize.width-765)/2, (screenSize.height-528)/2, 765, 528); + }// //GEN-END:initComponents + + private void button_doneActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button_doneActionPerformed + + PreparedStatement pst; + + DataBase_connect obj=new DataBase_connect(); + + Connection conn=obj.Open(); + + double total_taka=0,tot1=0;String id = null; + + int client_id=0; + + try{ + double dub=Double.parseDouble(txt_paidAmmount1.getText()); + + String sql="select total_paid_amount from client_info where id='"+txt_id1.getText()+"'"; + + client_id=Integer.parseInt(txt_id1.getText()); + + Statement statement = (Statement) conn.createStatement(); + + ResultSet rs=statement.executeQuery(sql); + + while(rs.next()){ + total_taka=rs.getDouble(1); + } + total_taka+=dub; + + dub=Double.parseDouble(txt_discount1.getText()); + + sql="select total_discount from client_info where id='"+txt_id1.getText()+"'"; + + rs=statement.executeQuery(sql); + + while(rs.next()){ + tot1=rs.getDouble(1); + } + tot1+=dub; + + id=txt_id1.getText(); + + String total_tk="" +total_taka; + + String val=((JTextField)txt_date1.getDateEditor().getUiComponent()).getText(); + + sql="insert into collection_table(id,name,taka,total_taka,discount,collection_date, description) values ('" + txt_id1.getText() + "','" + txt_name1.getText() + "','" + txt_paidAmmount1.getText() + "','"+ total_tk+ "','" + txt_discount1.getText() +"','" + val +"','" + txt_remark1.getText() + "')"; + pst=(PreparedStatement) conn.prepareStatement(sql); + pst.execute(); + + // JOptionPane.showMessageDialog(null, "Updated"); + }catch(Exception e){ + JOptionPane.showMessageDialog(null, e); + } + + try{ + String sql="update client_info set total_paid_amount='" + total_taka +"',total_discount='"+tot1+"' where id='"+id+"'"; + pst=(PreparedStatement) conn.prepareStatement(sql); + pst.execute(); + JOptionPane.showMessageDialog(null, "Done"); + }catch(Exception e){ + JOptionPane.showMessageDialog(null, e); + } + + update_table(collection_table,0); + + update_table(collection_table_client,client_id); + + txt_id1.setText(""); + txt_name1.setText(""); + txt_remark1.setText(""); + txt_discount1.setText("0"); + txt_paidAmmount1.setText("0"); + txt_advance1.setText("0"); + txt_due1.setText("0"); + txt_date1.setDate(null); + + }//GEN-LAST:event_button_doneActionPerformed + + private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jButton4ActionPerformed + + private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed + this.dispose(); + new Delivery().setVisible(true); + }//GEN-LAST:event_jButton3ActionPerformed + + private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton10ActionPerformed + System.exit(0); + }//GEN-LAST:event_jButton10ActionPerformed + + private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed + + this.dispose(); + + new client_info().setVisible(true); +}//GEN-LAST:event_jMenuItem2ActionPerformed + + private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed + + this.dispose(); + + new Delivery().setVisible(true); + }//GEN-LAST:event_jMenuItem3ActionPerformed + + private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed + + this.dispose(); + + new Collection().setVisible(true); + }//GEN-LAST:event_jMenuItem4ActionPerformed + + private void jMenuItem5MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenuItem5MouseClicked + System.exit(0); +}//GEN-LAST:event_jMenuItem5MouseClicked + + private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed + System.exit(0); +}//GEN-LAST:event_jMenuItem5ActionPerformed + + private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed + this.dispose(); + new HomePage().setVisible(true); + }//GEN-LAST:event_jButton8ActionPerformed + + private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed + this.dispose(); + new client_info().setVisible(true); + }//GEN-LAST:event_jButton2ActionPerformed + + private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed + this.dispose(); + new HomePage().setVisible(true); + }//GEN-LAST:event_jMenuItem1ActionPerformed + + private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed + + this.dispose(); + + new MyCalender().setVisible(true); + + }//GEN-LAST:event_jButton6ActionPerformed + + private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed + + this.dispose(); + + new Client_page().setVisible(true); + }//GEN-LAST:event_jButton5ActionPerformed + + + public void takin_input_from_table() + { + + PreparedStatement pst; + + DataBase_connect obj=new DataBase_connect(); + + Connection conn=obj.Open(); + + int client_id=0; + + try{ + int row=collection_table.getSelectedRow(); + rowf=row; + String table_click=collection_table.getModel().getValueAt(row, 0).toString(); + String sql="select * from collection_table where serial_no ='"+table_click+"'"; + pst=(PreparedStatement) conn.prepareStatement(sql); + rs=pst.executeQuery(); + if(rs.next()) { + String add1=rs.getString("id"); + client_id=Integer.parseInt(add1); + txt_id1.setText(add1); + String add2=rs.getString("name"); + txt_name1.setText(add2); + String add3=rs.getString("description"); + txt_remark1.setText(add3); + + String add6=rs.getObject("collection_date").toString(); + java.util.Date dat = new SimpleDateFormat("yyyy-MM-dd").parse(add6); + txt_date1.setDate(dat); + + String add7=rs.getString("discount"); + txt_discount1.setText(add7); + + String add8=rs.getString("taka"); + txt_paidAmmount1.setText(add8); + + due_calculation(); + + } + }catch(Exception e){ + JOptionPane.showMessageDialog(null, e+" fd"); + }finally { + try { + conn.close();System.out.println("disconnected"); + } catch (SQLException ex) { + Logger.getLogger(client_info.class.getName()).log(Level.SEVERE, null, ex); + } + } + + update_table(collection_table_client,client_id); + + update_table(collection_table,0); + } + + private void due_calculation() + { + double t_tk = 0,t_delivery = 0,t_discount = 0; + PreparedStatement pst; + + DataBase_connect obj=new DataBase_connect(); + + Connection conn=obj.Open(); + + try{ + + String sql="select total_paid_amount,total_delivery,total_discount from client_info where id='"+txt_id1.getText()+"'"; + System.out.println("sd"); + Statement statement = (Statement) conn.createStatement(); + + ResultSet rs=statement.executeQuery(sql); + + if(rs.next()){ + System.out.println("df"); + t_tk=rs.getDouble(1); + t_delivery=rs.getDouble(2); + t_discount=rs.getDouble(3); + } + double due =t_tk-t_delivery-t_discount; + String du=""+due; + System.out.println("due"); + if(due>=0) + { + txt_due1.setText(du); + txt_advance1.setText("0"); + } + else { + + due=-1*due; + du=""+due; + txt_due1.setText("0"); + txt_advance1.setText(du); + + } + }catch(Exception e){ + JOptionPane.showMessageDialog(null, e+"asd"); + }finally { + try { + conn.close();System.out.println("disconnected"); + } catch (SQLException ex) { + Logger.getLogger(client_info.class.getName()).log(Level.SEVERE, null, ex); + } + } + + return; + } + + private void txt_id1KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_id1KeyTyped + // TODO add your handling code here: +}//GEN-LAST:event_txt_id1KeyTyped + + private void txt_id1KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_id1KeyReleased + // TODO add your handling code here: +}//GEN-LAST:event_txt_id1KeyReleased + + private void txt_id1KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_id1KeyPressed + // TODO add your handling code here: +}//GEN-LAST:event_txt_id1KeyPressed + + private void txt_idKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_idKeyTyped + +}//GEN-LAST:event_txt_idKeyTyped + + private void txt_idKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_idKeyReleased + + PreparedStatement pst; + + DataBase_connect obj=new DataBase_connect(); + + Connection conn=obj.Open(); + try{ + String id=txt_id1.getText(); + + String sql="select name,total_paid_amount,total_discount,total_delivery from client_info where id='"+id+"'"; + + Statement statement = (Statement) conn.createStatement(); + ResultSet rs=statement.executeQuery(sql); + System.out.println("gffg"); + String nme; + double t_paid_amount,t_discount,t_delivery,cal; + if(rs.next()){ + + nme=rs.getString(1); + t_paid_amount=rs.getDouble(2); + t_discount=rs.getDouble(3); + t_delivery=rs.getDouble(4); + txt_name1.setText(nme); + cal=t_delivery-t_paid_amount-t_discount; + + if(cal>=0) { + String s=""+cal; + txt_due1.setText(s); + } else { + cal=cal*(-1); + String s=""+cal; + txt_advance1.setText(s); + } + + }else{ + txt_name1.setText(""); + txt_due1.setText("0"); + txt_advance1.setText("0"); + } + }catch(Exception e){ + JOptionPane.showMessageDialog(null, e); + } + }//GEN-LAST:event_txt_idKeyReleased + + private void txt_idKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_idKeyPressed + +}//GEN-LAST:event_txt_idKeyPressed + + private void txt_advanceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txt_advanceActionPerformed + // TODO add your handling code here: +}//GEN-LAST:event_txt_advanceActionPerformed + + private void button_done1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button_done1ActionPerformed + + txt_name1.setText(""); + txt_id1.setText(""); + txt_remark1.setText(""); + txt_date1.setDate(null); + + txt_discount1.setText("0"); + txt_advance1.setText("0"); + txt_due1.setText("0"); + txt_paidAmmount1.setText("0"); + + }//GEN-LAST:event_button_done1ActionPerformed + + private void button_done2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button_done2ActionPerformed + + MessageFormat header=new MessageFormat("Report Print"); + MessageFormat footer=new MessageFormat("Page{0,number,integer}"); + try{ + collection_table.print(JTable.PrintMode.NORMAL,header,footer); + }catch(Exception e){ + + } + + }//GEN-LAST:event_button_done2ActionPerformed + + private void collection_tableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_collection_tableMouseClicked + + takin_input_from_table(); +}//GEN-LAST:event_collection_tableMouseClicked + + private void collection_tableMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_collection_tableMouseEntered + // TODO add your handling code here: +}//GEN-LAST:event_collection_tableMouseEntered + + private void collection_tableKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_collection_tableKeyPressed + +}//GEN-LAST:event_collection_tableKeyPressed + + private void collection_table_clientMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_collection_table_clientMouseClicked + + //takin_input_from_table(); + +}//GEN-LAST:event_collection_table_clientMouseClicked + + private void collection_table_clientMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_collection_table_clientMouseEntered + // TODO add your handling code here: +}//GEN-LAST:event_collection_table_clientMouseEntered + + private void collection_table_clientKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_collection_table_clientKeyPressed + +}//GEN-LAST:event_collection_table_clientKeyPressed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + + try { + + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + //UIManager.setLookAndFeel("com.jtattoo.plaf.smart.SmartLookAndFeel"); + //UIManager.setLookAndFeel("com.jtattoo.plaf.acryl.AcrylLookAndFeel"); + UIManager.setLookAndFeel("com.jtattoo.plaf.aero.AeroLookAndFeel"); + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(StockEntry.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(StockEntry.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(StockEntry.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(StockEntry.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + + new Collection_tab().setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton button_done; + private javax.swing.JButton button_done1; + private javax.swing.JButton button_done2; + private javax.swing.JTable collection_table; + private javax.swing.JTable collection_table_client; + private javax.swing.JButton jButton10; + private javax.swing.JButton jButton2; + private javax.swing.JButton jButton3; + private javax.swing.JButton jButton4; + private javax.swing.JButton jButton5; + private javax.swing.JButton jButton6; + private javax.swing.JButton jButton7; + private javax.swing.JButton jButton8; + private javax.swing.JButton jButton9; + private javax.swing.JLabel jLabel10; + private javax.swing.JLabel jLabel11; + private javax.swing.JLabel jLabel12; + private javax.swing.JLabel jLabel13; + private javax.swing.JLabel jLabel14; + private javax.swing.JLabel jLabel15; + private javax.swing.JLabel jLabel9; + private javax.swing.JMenu jMenu1; + private javax.swing.JMenuBar jMenuBar1; + private javax.swing.JMenuItem jMenuItem1; + private javax.swing.JMenuItem jMenuItem2; + private javax.swing.JMenuItem jMenuItem3; + private javax.swing.JMenuItem jMenuItem4; + private javax.swing.JMenuItem jMenuItem5; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel2; + private javax.swing.JPanel jPanel3; + private javax.swing.JPanel jPanel4; + private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JScrollPane jScrollPane2; + private javax.swing.JScrollPane jScrollPane3; + private javax.swing.JScrollPane jScrollPane4; + private javax.swing.JTabbedPane jTabbedPane1; + private javax.swing.JToolBar jToolBar1; + private javax.swing.JTextField txt_advance1; + private com.toedter.calendar.JDateChooser txt_date1; + private javax.swing.JTextField txt_discount1; + private javax.swing.JTextField txt_due1; + private javax.swing.JTextField txt_id1; + private javax.swing.JTextField txt_name1; + private javax.swing.JTextField txt_paidAmmount1; + private javax.swing.JTextField txt_remark1; + private javax.swing.JLabel txt_remarks1; + // End of variables declaration//GEN-END:variables + int rowf; +} diff --git a/ST2-Project-master/src/Data/1-Normal-Home-icon.png b/ST2-Project-master/src/Data/1-Normal-Home-icon.png new file mode 100644 index 0000000..90f39c9 Binary files /dev/null and b/ST2-Project-master/src/Data/1-Normal-Home-icon.png differ diff --git a/ST2-Project-master/src/Data/Actions-edit-find-icon.png b/ST2-Project-master/src/Data/Actions-edit-find-icon.png new file mode 100644 index 0000000..79733de Binary files /dev/null and b/ST2-Project-master/src/Data/Actions-edit-find-icon.png differ diff --git a/ST2-Project-master/src/Data/Actions-go-jump-today-icon.png b/ST2-Project-master/src/Data/Actions-go-jump-today-icon.png new file mode 100644 index 0000000..4a894be Binary files /dev/null and b/ST2-Project-master/src/Data/Actions-go-jump-today-icon.png differ diff --git a/ST2-Project-master/src/Data/Button-Refresh-icon.png b/ST2-Project-master/src/Data/Button-Refresh-icon.png new file mode 100644 index 0000000..e1163e0 Binary files /dev/null and b/ST2-Project-master/src/Data/Button-Refresh-icon.png differ diff --git a/ST2-Project-master/src/Data/Calendar-icon.png b/ST2-Project-master/src/Data/Calendar-icon.png new file mode 100644 index 0000000..788fc24 Binary files /dev/null and b/ST2-Project-master/src/Data/Calendar-icon.png differ diff --git a/ST2-Project-master/src/Data/Collection-2-icon (1).png b/ST2-Project-master/src/Data/Collection-2-icon (1).png new file mode 100644 index 0000000..d453fb9 Binary files /dev/null and b/ST2-Project-master/src/Data/Collection-2-icon (1).png differ diff --git a/ST2-Project-master/src/Data/Collection-2-icon.png b/ST2-Project-master/src/Data/Collection-2-icon.png new file mode 100644 index 0000000..8229642 Binary files /dev/null and b/ST2-Project-master/src/Data/Collection-2-icon.png differ diff --git a/ST2-Project-master/src/Data/Done-icon.png b/ST2-Project-master/src/Data/Done-icon.png new file mode 100644 index 0000000..f16df40 Binary files /dev/null and b/ST2-Project-master/src/Data/Done-icon.png differ diff --git a/ST2-Project-master/src/Data/Search-icon (1).png b/ST2-Project-master/src/Data/Search-icon (1).png new file mode 100644 index 0000000..ed2e0db Binary files /dev/null and b/ST2-Project-master/src/Data/Search-icon (1).png differ diff --git a/ST2-Project-master/src/Data/Thumbs.db b/ST2-Project-master/src/Data/Thumbs.db new file mode 100644 index 0000000..a436d73 Binary files /dev/null and b/ST2-Project-master/src/Data/Thumbs.db differ diff --git a/ST2-Project-master/src/Data/US-dollar-icon.png b/ST2-Project-master/src/Data/US-dollar-icon.png new file mode 100644 index 0000000..cd557ee Binary files /dev/null and b/ST2-Project-master/src/Data/US-dollar-icon.png differ diff --git a/ST2-Project-master/src/Data/add.png b/ST2-Project-master/src/Data/add.png new file mode 100644 index 0000000..23d5bed Binary files /dev/null and b/ST2-Project-master/src/Data/add.png differ diff --git a/ST2-Project-master/src/Data/bang.jpg b/ST2-Project-master/src/Data/bang.jpg new file mode 100644 index 0000000..678de88 Binary files /dev/null and b/ST2-Project-master/src/Data/bang.jpg differ diff --git a/ST2-Project-master/src/Data/clear.png b/ST2-Project-master/src/Data/clear.png new file mode 100644 index 0000000..4715d03 Binary files /dev/null and b/ST2-Project-master/src/Data/clear.png differ diff --git a/ST2-Project-master/src/Data/close.png b/ST2-Project-master/src/Data/close.png new file mode 100644 index 0000000..7173b4e Binary files /dev/null and b/ST2-Project-master/src/Data/close.png differ diff --git a/ST2-Project-master/src/Data/close1.png b/ST2-Project-master/src/Data/close1.png new file mode 100644 index 0000000..a227c58 Binary files /dev/null and b/ST2-Project-master/src/Data/close1.png differ diff --git a/ST2-Project-master/src/Data/close32.png b/ST2-Project-master/src/Data/close32.png new file mode 100644 index 0000000..50961ec Binary files /dev/null and b/ST2-Project-master/src/Data/close32.png differ diff --git a/ST2-Project-master/src/Data/db.png b/ST2-Project-master/src/Data/db.png new file mode 100644 index 0000000..d412f45 Binary files /dev/null and b/ST2-Project-master/src/Data/db.png differ diff --git a/ST2-Project-master/src/Data/done.png b/ST2-Project-master/src/Data/done.png new file mode 100644 index 0000000..069a1e1 Binary files /dev/null and b/ST2-Project-master/src/Data/done.png differ diff --git a/ST2-Project-master/src/Data/done1.png b/ST2-Project-master/src/Data/done1.png new file mode 100644 index 0000000..c4d5504 Binary files /dev/null and b/ST2-Project-master/src/Data/done1.png differ diff --git a/ST2-Project-master/src/Data/fp.gif b/ST2-Project-master/src/Data/fp.gif new file mode 100644 index 0000000..39316de Binary files /dev/null and b/ST2-Project-master/src/Data/fp.gif differ diff --git a/ST2-Project-master/src/Data/fp2.png b/ST2-Project-master/src/Data/fp2.png new file mode 100644 index 0000000..342af01 Binary files /dev/null and b/ST2-Project-master/src/Data/fp2.png differ diff --git a/ST2-Project-master/src/Data/home-icon.png b/ST2-Project-master/src/Data/home-icon.png new file mode 100644 index 0000000..ae2db76 Binary files /dev/null and b/ST2-Project-master/src/Data/home-icon.png differ diff --git a/ST2-Project-master/src/Data/house-icon.png b/ST2-Project-master/src/Data/house-icon.png new file mode 100644 index 0000000..b7ed6cc Binary files /dev/null and b/ST2-Project-master/src/Data/house-icon.png differ diff --git a/ST2-Project-master/src/Data/loading.gif b/ST2-Project-master/src/Data/loading.gif new file mode 100644 index 0000000..0a32442 Binary files /dev/null and b/ST2-Project-master/src/Data/loading.gif differ diff --git a/ST2-Project-master/src/Data/login.png b/ST2-Project-master/src/Data/login.png new file mode 100644 index 0000000..9015de1 Binary files /dev/null and b/ST2-Project-master/src/Data/login.png differ diff --git a/ST2-Project-master/src/Data/money-icon (1).png b/ST2-Project-master/src/Data/money-icon (1).png new file mode 100644 index 0000000..6cd570a Binary files /dev/null and b/ST2-Project-master/src/Data/money-icon (1).png differ diff --git a/ST2-Project-master/src/Data/money-icon.png b/ST2-Project-master/src/Data/money-icon.png new file mode 100644 index 0000000..8aa2750 Binary files /dev/null and b/ST2-Project-master/src/Data/money-icon.png differ diff --git a/ST2-Project-master/src/Data/new1.png b/ST2-Project-master/src/Data/new1.png new file mode 100644 index 0000000..9dd94d2 Binary files /dev/null and b/ST2-Project-master/src/Data/new1.png differ diff --git a/ST2-Project-master/src/Data/new32.png b/ST2-Project-master/src/Data/new32.png new file mode 100644 index 0000000..4ae327e Binary files /dev/null and b/ST2-Project-master/src/Data/new32.png differ diff --git a/ST2-Project-master/src/Data/preloader.png b/ST2-Project-master/src/Data/preloader.png new file mode 100644 index 0000000..8333262 Binary files /dev/null and b/ST2-Project-master/src/Data/preloader.png differ diff --git a/ST2-Project-master/src/Data/preloader2.png b/ST2-Project-master/src/Data/preloader2.png new file mode 100644 index 0000000..0b30b0b Binary files /dev/null and b/ST2-Project-master/src/Data/preloader2.png differ diff --git a/ST2-Project-master/src/Data/print-icon.png b/ST2-Project-master/src/Data/print-icon.png new file mode 100644 index 0000000..04a186f Binary files /dev/null and b/ST2-Project-master/src/Data/print-icon.png differ diff --git a/ST2-Project-master/src/Data/print32.png b/ST2-Project-master/src/Data/print32.png new file mode 100644 index 0000000..dd5fd43 Binary files /dev/null and b/ST2-Project-master/src/Data/print32.png differ diff --git a/ST2-Project-master/src/Data/search-icon (2).png b/ST2-Project-master/src/Data/search-icon (2).png new file mode 100644 index 0000000..c4cccb0 Binary files /dev/null and b/ST2-Project-master/src/Data/search-icon (2).png differ diff --git a/ST2-Project-master/src/Data/search-icon.png b/ST2-Project-master/src/Data/search-icon.png new file mode 100644 index 0000000..b6f49f6 Binary files /dev/null and b/ST2-Project-master/src/Data/search-icon.png differ diff --git a/ST2-Project-master/src/Data/silver-database-icon.jpg b/ST2-Project-master/src/Data/silver-database-icon.jpg new file mode 100644 index 0000000..36fb8d3 Binary files /dev/null and b/ST2-Project-master/src/Data/silver-database-icon.jpg differ diff --git a/ST2-Project-master/src/Data/update-icon.gif b/ST2-Project-master/src/Data/update-icon.gif new file mode 100644 index 0000000..a142495 Binary files /dev/null and b/ST2-Project-master/src/Data/update-icon.gif differ diff --git a/ST2-Project-master/src/Data/update.png b/ST2-Project-master/src/Data/update.png new file mode 100644 index 0000000..a882f1b Binary files /dev/null and b/ST2-Project-master/src/Data/update.png differ diff --git a/ST2-Project-master/src/Data/welcome.jpg b/ST2-Project-master/src/Data/welcome.jpg new file mode 100644 index 0000000..f6315db Binary files /dev/null and b/ST2-Project-master/src/Data/welcome.jpg differ diff --git a/ST2-Project-master/src/DataBase_connect.java b/ST2-Project-master/src/DataBase_connect.java new file mode 100644 index 0000000..abd0aea --- /dev/null +++ b/ST2-Project-master/src/DataBase_connect.java @@ -0,0 +1,42 @@ + +import com.mysql.jdbc.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; + + +public class DataBase_connect { + + private static String url; + + //public static Connection main(String args[ ]) + public Connection Open() + { + String host = "jdbc:mysql://localhost:3306/"; + String dbName = "projectDatabase"; + String username = "root"; + String password = ""; + url =host +dbName +"?user="+username+"&password="+ password; + + try{ + Class.forName("com.mysql.jdbc.Driver"); + Connection conn =(Connection) DriverManager.getConnection(url); + System.out.println("Succeed!"); + return conn; + } + catch(ClassNotFoundException ex){ + System.out.println("Class not found!"); + } + catch(SQLException ex){ + System.out.println("SQL exception!"); + } + + return null; + } + + public void db_Cloase(Connection con) throws SQLException + { + con.close(); + return ; + } + +} diff --git a/ST2-Project-master/src/Delivery.form b/ST2-Project-master/src/Delivery.form new file mode 100644 index 0000000..9524310 --- /dev/null +++ b/ST2-Project-master/src/Delivery.form @@ -0,0 +1,764 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ diff --git a/ST2-Project-master/src/Delivery.java b/ST2-Project-master/src/Delivery.java new file mode 100644 index 0000000..9da915c --- /dev/null +++ b/ST2-Project-master/src/Delivery.java @@ -0,0 +1,1101 @@ + +import com.mysql.jdbc.Connection; +import com.mysql.jdbc.PreparedStatement; +import com.mysql.jdbc.Statement; +import com.sun.java.swing.plaf.windows.WindowsTreeUI.CollapsedIcon; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.text.MessageFormat; +import java.text.SimpleDateFormat; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.swing.JOptionPane; +import javax.swing.JTable; +import javax.swing.JTextField; +import javax.swing.UIManager; +import net.proteanit.sql.DbUtils; + +public class Delivery extends javax.swing.JFrame { + Connection conn=null; + ResultSet rs=null; + PreparedStatement pst=null; + /** Creates new form StockEntry */ + public Delivery() { + initComponents(); + update_table(); + } + + private void update_table() { + + PreparedStatement pst; + + DataBase_connect obj=new DataBase_connect(); + + Connection conn=obj.Open(); + + try{ + String sql="select * from delivery_table"; + pst=(PreparedStatement) conn.prepareStatement(sql); + rs=pst.executeQuery(); + delivery_table.setModel(DbUtils.resultSetToTableModel(rs)); + }catch(Exception e){ + JOptionPane.showMessageDialog(null, e); + }finally { + try { + conn.close(); + System.out.println("disconnected"); + } catch (SQLException ex) { + Logger.getLogger(client_info.class.getName()).log(Level.SEVERE, null, ex); + } + } + + } + + /** 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. + */ + + // //GEN-BEGIN:initComponents + private void initComponents() { + + jScrollPane1 = new javax.swing.JScrollPane(); + jScrollPane2 = new javax.swing.JScrollPane(); + delivery_table = new javax.swing.JTable(); + jPanel3 = new javax.swing.JPanel(); + jPanel1 = new javax.swing.JPanel(); + jLabel5 = new javax.swing.JLabel(); + jLabel6 = new javax.swing.JLabel(); + jLabel7 = new javax.swing.JLabel(); + jLabel8 = new javax.swing.JLabel(); + jLabel9 = new javax.swing.JLabel(); + txt_length = new javax.swing.JTextField(); + txt_width = new javax.swing.JTextField(); + txt_height = new javax.swing.JTextField(); + txt_rate = new javax.swing.JTextField(); + txt_amount = new javax.swing.JTextField(); + txt_remark = new javax.swing.JTextField(); + jLabel16 = new javax.swing.JLabel(); + jPanel2 = new javax.swing.JPanel(); + jLabel10 = new javax.swing.JLabel(); + jLabel11 = new javax.swing.JLabel(); + jLabel12 = new javax.swing.JLabel(); + jLabel13 = new javax.swing.JLabel(); + jLabel14 = new javax.swing.JLabel(); + txt_name = new javax.swing.JTextField(); + txt_truck = new javax.swing.JTextField(); + txt_description = new javax.swing.JTextField(); + txt_place = new javax.swing.JTextField(); + txt_id = new javax.swing.JTextField(); + jLabel15 = new javax.swing.JLabel(); + txt_date = new com.toedter.calendar.JDateChooser(); + jLabel1 = new javax.swing.JLabel(); + jSeparator1 = new javax.swing.JSeparator(); + jPanel4 = new javax.swing.JPanel(); + jButton4 = new javax.swing.JButton(); + jButton5 = new javax.swing.JButton(); + jButton6 = new javax.swing.JButton(); + jButton1 = new javax.swing.JButton(); + jButton2 = new javax.swing.JButton(); + jToolBar1 = new javax.swing.JToolBar(); + jButton8 = new javax.swing.JButton(); + jButton3 = new javax.swing.JButton(); + jButton7 = new javax.swing.JButton(); + jButton9 = new javax.swing.JButton(); + jButton10 = new javax.swing.JButton(); + jButton11 = new javax.swing.JButton(); + jButton12 = new javax.swing.JButton(); + jButton13 = new javax.swing.JButton(); + jButton14 = new javax.swing.JButton(); + jMenuBar1 = new javax.swing.JMenuBar(); + jMenu1 = new javax.swing.JMenu(); + jMenuItem1 = new javax.swing.JMenuItem(); + jMenuItem2 = new javax.swing.JMenuItem(); + jMenuItem3 = new javax.swing.JMenuItem(); + jMenuItem4 = new javax.swing.JMenuItem(); + jMenuItem5 = new javax.swing.JMenuItem(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); + + delivery_table.setModel(new javax.swing.table.DefaultTableModel( + new Object [][] { + {null, null, null, null}, + {null, null, null, null}, + {null, null, null, null}, + {null, null, null, null} + }, + new String [] { + "Title 1", "Title 2", "Title 3", "Title 4" + } + )); + delivery_table.addMouseListener(new java.awt.event.MouseAdapter() { + public void mouseClicked(java.awt.event.MouseEvent evt) { + delivery_tableMouseClicked(evt); + } + public void mouseEntered(java.awt.event.MouseEvent evt) { + delivery_tableMouseEntered(evt); + } + }); + delivery_table.addKeyListener(new java.awt.event.KeyAdapter() { + public void keyPressed(java.awt.event.KeyEvent evt) { + delivery_tableKeyPressed(evt); + } + }); + jScrollPane2.setViewportView(delivery_table); + + jScrollPane1.setViewportView(jScrollPane2); + + jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Delivery Information", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 14), new java.awt.Color(51, 153, 255))); // NOI18N + + jPanel1.setToolTipText("Insert All the Information About The truck"); + jPanel1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); + jPanel1.setDebugGraphicsOptions(javax.swing.DebugGraphics.NONE_OPTION); + + jLabel5.setText("Rate :"); + + jLabel6.setText("Length :"); + + jLabel7.setText("Height :"); + + jLabel8.setText("Width :"); + + jLabel9.setText("Ammount :"); + + jLabel16.setText("Remarks :"); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel9) + .addComponent(jLabel5)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(txt_length, javax.swing.GroupLayout.PREFERRED_SIZE, 159, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(txt_width, javax.swing.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE) + .addComponent(txt_height, javax.swing.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE) + .addComponent(txt_amount, javax.swing.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE) + .addComponent(txt_rate, javax.swing.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE))) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(14, 14, 14) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel6) + .addComponent(jLabel8) + .addComponent(jLabel7) + .addComponent(jLabel16)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(txt_remark, javax.swing.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE))) + .addContainerGap()) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(txt_length, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel6)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel8) + .addComponent(txt_width, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(txt_height, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel7)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(txt_amount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(txt_rate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel5)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(txt_remark, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel16)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + jPanel2.setToolTipText("Insert All the Information About The truck"); + jPanel2.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); + jPanel2.setDebugGraphicsOptions(javax.swing.DebugGraphics.NONE_OPTION); + + jLabel10.setText("Client ID :"); + + jLabel11.setText("Client Name :"); + + jLabel12.setText("Description :"); + + jLabel13.setText("Truck Number :"); + + jLabel14.setText("Loading Place :"); + + txt_name.setEditable(false); + + txt_id.addKeyListener(new java.awt.event.KeyAdapter() { + public void keyReleased(java.awt.event.KeyEvent evt) { + txt_idKeyReleased(evt); + } + }); + + jLabel15.setText("Delivery Date :"); + + txt_date.setDateFormatString("yyyy-MM-dd"); + + javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); + jPanel2.setLayout(jPanel2Layout); + jPanel2Layout.setHorizontalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel13) + .addComponent(jLabel12) + .addComponent(jLabel10) + .addComponent(jLabel11) + .addComponent(jLabel14) + .addComponent(jLabel15)) + .addGap(15, 15, 15) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(txt_date, javax.swing.GroupLayout.DEFAULT_SIZE, 180, Short.MAX_VALUE) + .addComponent(txt_place, javax.swing.GroupLayout.DEFAULT_SIZE, 180, Short.MAX_VALUE) + .addComponent(txt_name, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 180, Short.MAX_VALUE) + .addComponent(txt_id, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 180, Short.MAX_VALUE) + .addComponent(txt_truck, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 180, Short.MAX_VALUE) + .addComponent(txt_description, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 180, Short.MAX_VALUE)) + .addContainerGap()) + ); + jPanel2Layout.setVerticalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel10) + .addComponent(txt_id, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel11) + .addComponent(txt_name, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel13) + .addComponent(txt_truck, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel12) + .addComponent(txt_description, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(txt_place, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(txt_date, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(3, Short.MAX_VALUE)) + ); + + javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); + jPanel3.setLayout(jPanel3Layout); + jPanel3Layout.setHorizontalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.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, 31, Short.MAX_VALUE) + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + ); + jPanel3Layout.setVerticalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, 192, Short.MAX_VALUE) + .addContainerGap()) + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + ); + + jLabel1.setFont(new java.awt.Font("Rockwell Extra Bold", 1, 24)); + jLabel1.setForeground(new java.awt.Color(0, 51, 102)); + jLabel1.setText("Delivery Report"); + + jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Options", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 14), new java.awt.Color(0, 153, 255))); // NOI18N + jPanel4.setFont(new java.awt.Font("Tahoma", 1, 14)); + + jButton4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/update.png"))); // NOI18N + jButton4.setText("Update"); + jButton4.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton4ActionPerformed(evt); + } + }); + + jButton5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/clear.png"))); // NOI18N + jButton5.setText("Clear"); + jButton5.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton5ActionPerformed(evt); + } + }); + + jButton6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/close.png"))); // NOI18N + jButton6.setText("Delete"); + jButton6.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton6ActionPerformed(evt); + } + }); + + jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/add.png"))); // NOI18N + jButton1.setText("Save"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/print-icon.png"))); // NOI18N + jButton2.setText("Print"); + jButton2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton2ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); + jPanel4.setLayout(jPanel4Layout); + jPanel4Layout.setHorizontalGroup( + jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel4Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, 91, Short.MAX_VALUE) + .addComponent(jButton2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 91, Short.MAX_VALUE) + .addComponent(jButton6, javax.swing.GroupLayout.DEFAULT_SIZE, 91, Short.MAX_VALUE) + .addComponent(jButton4, javax.swing.GroupLayout.DEFAULT_SIZE, 91, Short.MAX_VALUE) + .addComponent(jButton5, javax.swing.GroupLayout.DEFAULT_SIZE, 91, Short.MAX_VALUE)) + .addContainerGap()) + ); + jPanel4Layout.setVerticalGroup( + jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel4Layout.createSequentialGroup() + .addComponent(jButton1) + .addGap(18, 18, 18) + .addComponent(jButton4) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 13, Short.MAX_VALUE) + .addComponent(jButton5) + .addGap(18, 18, 18) + .addComponent(jButton6) + .addGap(18, 18, 18) + .addComponent(jButton2) + .addContainerGap()) + ); + + jToolBar1.setRollover(true); + + jButton8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/1-Normal-Home-icon.png"))); // NOI18N + jButton8.setText("Home"); + jButton8.setToolTipText("Ctrl + H"); + jButton8.setFocusable(false); + jButton8.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton8.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton8.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton8ActionPerformed(evt); + } + }); + jToolBar1.add(jButton8); + + jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/new32.png"))); // NOI18N + jButton3.setText("New Client"); + jButton3.setToolTipText("Ctrl + N"); + jButton3.setFocusable(false); + jButton3.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton3.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton3ActionPerformed(evt); + } + }); + jToolBar1.add(jButton3); + + jButton7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/money-icon.png"))); // NOI18N + jButton7.setText("Transaction"); + jButton7.setToolTipText("Ctrl + T"); + jButton7.setFocusable(false); + jButton7.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton7.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jToolBar1.add(jButton7); + + jButton9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/Collection-2-icon.png"))); // NOI18N + jButton9.setText("Collection"); + jButton9.setToolTipText("Ctrl + C"); + jButton9.setFocusable(false); + jButton9.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton9.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton9.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton9ActionPerformed(evt); + } + }); + jToolBar1.add(jButton9); + + jButton10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/print32.png"))); // NOI18N + jButton10.setText("Print"); + jButton10.setFocusable(false); + jButton10.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton10.setMaximumSize(new java.awt.Dimension(57, 57)); + jButton10.setMinimumSize(new java.awt.Dimension(57, 57)); + jButton10.setPreferredSize(new java.awt.Dimension(57, 57)); + jButton10.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton10.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton10ActionPerformed(evt); + } + }); + jToolBar1.add(jButton10); + + jButton11.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/Calendar-icon.png"))); // NOI18N + jButton11.setText("Calender"); + jButton11.setFocusable(false); + jButton11.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton11.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton11.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton11ActionPerformed(evt); + } + }); + jToolBar1.add(jButton11); + + jButton12.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/Button-Refresh-icon.png"))); // NOI18N + jButton12.setText("Refresh"); + jButton12.setFocusable(false); + jButton12.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton12.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jToolBar1.add(jButton12); + + jButton13.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/search-icon.png"))); // NOI18N + jButton13.setText("Search"); + jButton13.setFocusable(false); + jButton13.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton13.setMaximumSize(new java.awt.Dimension(57, 57)); + jButton13.setMinimumSize(new java.awt.Dimension(57, 57)); + jButton13.setPreferredSize(new java.awt.Dimension(57, 57)); + jButton13.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jToolBar1.add(jButton13); + + jButton14.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/close32.png"))); // NOI18N + jButton14.setText("Close"); + jButton14.setToolTipText("Ctrl + Alt + C"); + jButton14.setFocusable(false); + jButton14.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton14.setMaximumSize(new java.awt.Dimension(57, 57)); + jButton14.setMinimumSize(new java.awt.Dimension(57, 57)); + jButton14.setPreferredSize(new java.awt.Dimension(57, 57)); + jButton14.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton14.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton14ActionPerformed(evt); + } + }); + jToolBar1.add(jButton14); + + jMenu1.setText("Option"); + + jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_H, java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/house-icon.png"))); // NOI18N + jMenuItem1.setText("Home"); + jMenuItem1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem1ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem1); + + jMenuItem2.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/new1.png"))); // NOI18N + jMenuItem2.setText("New Client"); + jMenuItem2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem2ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem2); + + jMenuItem3.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/money-icon (1).png"))); // NOI18N + jMenuItem3.setText("Transection"); + jMenuItem3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem3ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem3); + + jMenuItem4.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/Collection-2-icon (1).png"))); // NOI18N + jMenuItem4.setText("Collection"); + jMenuItem4.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem4ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem4); + + jMenuItem5.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/close1.png"))); // NOI18N + jMenuItem5.setText("Close"); + jMenuItem5.addMouseListener(new java.awt.event.MouseAdapter() { + public void mouseClicked(java.awt.event.MouseEvent evt) { + jMenuItem5MouseClicked(evt); + } + }); + jMenuItem5.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem5ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem5); + + jMenuBar1.add(jMenu1); + + setJMenuBar(jMenuBar1); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createSequentialGroup() + .addGap(264, 264, 264) + .addComponent(jLabel1)) + .addGroup(layout.createSequentialGroup() + .addGap(228, 228, 228) + .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 295, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))) + .addContainerGap(36, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel1) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(22, 22, 22) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + ); + + java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); + setBounds((screenSize.width-779)/2, (screenSize.height-592)/2, 779, 592); + }// //GEN-END:initComponents + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + + + + DataBase_connect obj=new DataBase_connect(); + + Connection conn=obj.Open(); + double amount=Double.parseDouble(txt_amount.getText()); + double rate=Double.parseDouble(txt_rate.getText()); + double delivery=amount*rate; + PreparedStatement pst; + double tot=0,tot1=0; + try{ + + String sql="select total_delivery from client_info where id='"+txt_id.getText()+"'"; + + Statement statement = (Statement) conn.createStatement(); + ResultSet rs=statement.executeQuery(sql); + + while(rs.next()){ + tot=rs.getDouble(1); + } + tot+=delivery; + sql="update client_info set total_delivery='" + tot +"' where id='"+txt_id.getText()+"'"; + pst=(PreparedStatement) conn.prepareStatement(sql); + pst.execute(); + //sql="insert into client_info(id,name,address,contact,datee) values (NULL,'" + txt_name.getText() + "','" + txt_address.getText() + "','" + txt_contact.getText() + "','"+val+ "')"; + + + + // JOptionPane.showMessageDialog(null, "Updated"); + }catch(Exception e){ + JOptionPane.showMessageDialog(null, e); + } + + try{ + //String sql="insert into client_info values(?,?,?,?)"; + String val=((JTextField)txt_date.getDateEditor().getUiComponent()).getText(); + + amount=Double.parseDouble(txt_amount.getText()); + rate=Double.parseDouble(txt_rate.getText()); + double mul=amount*rate; + String s=""+mul; + + String sql="select total_paid_amount from client_info where id='"+txt_id.getText()+"'"; + + Statement statement = (Statement) conn.createStatement(); + ResultSet rs=statement.executeQuery(sql); + + while(rs.next()){ + tot1=rs.getDouble(1); + } + double due =tot-tot1; + String du=""+due; + String tot_delivery=""+tot; + String ad="0"; + //String sql="insert into client_info(id,name,address,contact,datee) values (NULL,'" + txt_name.getText() + "','" + txt_address.getText() + "','" + txt_contact.getText() + "','"+val+ "')"; + if(due>=0) + sql="insert into delivery_table values(null,'"+txt_id.getText()+"','"+txt_name.getText()+"','"+txt_truck.getText()+"','"+txt_description.getText()+"','"+txt_place.getText()+"','"+val+"','"+txt_length.getText()+"','"+txt_width.getText()+"','"+txt_height.getText()+"','"+txt_amount.getText()+"','"+txt_rate.getText()+"','"+s+"','"+tot_delivery+"','"+du+"','"+ad+"','"+txt_remark.getText()+"')"; + else { + due*=(-1); + ad=""+due; + sql="insert into delivery_table values(null,'"+txt_id.getText()+"','"+txt_name.getText()+"','"+txt_truck.getText()+"','"+txt_description.getText()+"','"+txt_place.getText()+"','"+val+"','"+txt_length.getText()+"','"+txt_width.getText()+"','"+txt_height.getText()+"','"+txt_amount.getText()+"','"+txt_rate.getText()+"','"+s+"','"+tot_delivery+"','"+du+"','"+ad+"','"+txt_remark.getText()+"')"; + } + pst=(PreparedStatement) conn.prepareStatement(sql); + pst.execute(); + JOptionPane.showMessageDialog(null, "Saved"); + }catch(Exception e){ + JOptionPane.showMessageDialog(null, e); + }finally { + try { + conn.close();System.out.println("disconnected"); + } catch (SQLException ex) { + Logger.getLogger(client_info.class.getName()).log(Level.SEVERE, null, ex); + } + } + + update_table(); + + }//GEN-LAST:event_jButton1ActionPerformed + + private void txt_idKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_idKeyReleased + System.out.println("sfdfsd"); + PreparedStatement pst; + + DataBase_connect obj=new DataBase_connect(); + + Connection conn=obj.Open(); + try{ + String id=txt_id.getText(); + System.out.println("fds : "+id); + String sql="select name from client_info where id='"+id+"'"; + + Statement statement = (Statement) conn.createStatement(); + + ResultSet rs=statement.executeQuery(sql); + //System.out.println("gffg"); + String nme; + double t_paid_amount,t_discount,t_delivery,cal; + // System.out.println(""+rs.next()); + if(rs.next()==false){ + System.out.println("sfd"); + txt_name.setText(""); + } + else{ + + nme=rs.getString(1); + txt_name.setText(nme); + } + + + + }catch(Exception e){ + JOptionPane.showMessageDialog(null, e); + } + + }//GEN-LAST:event_txt_idKeyReleased + + private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed + txt_id.setText(""); + txt_name.setText(""); + txt_amount.setText(""); + txt_description.setText(""); + txt_date.setDate(null); + txt_height.setText(""); + txt_length.setText(""); + txt_truck.setText(""); + txt_remark.setText(""); + txt_place.setText(""); + txt_width.setText(""); + txt_rate.setText(""); + + + }//GEN-LAST:event_jButton5ActionPerformed + + private void delivery_tableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_delivery_tableMouseClicked + + PreparedStatement pst; + + DataBase_connect obj=new DataBase_connect(); + + Connection conn=obj.Open(); + + try{ + int row=delivery_table.getSelectedRow();rowf=row; + String table_click=delivery_table.getModel().getValueAt(row, 0).toString(); + String sql="select * from delivery_table where serial_no ='"+table_click+"'"; + pst=(PreparedStatement) conn.prepareStatement(sql); + rs=pst.executeQuery(); + if(rs.next()) + { + String add1=rs.getString("id"); + txt_id.setText(add1); + String add2=rs.getString("name"); + txt_name.setText(add2); + String add3=rs.getString("truck_number"); + txt_truck.setText(add3); + String add4=rs.getString("description"); + txt_description.setText(add4); + + String add5=rs.getString("loading_place"); + txt_place.setText(add5); + + String add6=rs.getObject("delivery_date").toString(); + java.util.Date dat = new SimpleDateFormat("yyyy-MM-dd").parse(add6); + txt_date.setDate(dat); + + String add7=rs.getString("length"); + txt_length.setText(add7); + + String add8=rs.getString("width"); + txt_width.setText(add8); + + String add9=rs.getString("height"); + txt_height.setText(add9); + + String add10=rs.getString("amount"); + txt_amount.setText(add10); + + String add11=rs.getString("rate"); + txt_rate.setText(add11); + + String add12=rs.getString("remarks"); + txt_remark.setText(add12); + + + } + }catch(Exception e){ + JOptionPane.showMessageDialog(null, e); + }finally { + try { + conn.close();System.out.println("disconnected"); + } catch (SQLException ex) { + Logger.getLogger(client_info.class.getName()).log(Level.SEVERE, null, ex); + } + } + + update_table(); + }//GEN-LAST:event_delivery_tableMouseClicked + + private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed + PreparedStatement pst; + + DataBase_connect obj=new DataBase_connect(); + + Connection conn=obj.Open(); + + try{ + String table_click=delivery_table.getModel().getValueAt(rowf, 0).toString(); + + String val1=txt_id.getText(); + String val10=txt_amount.getText(); + String val11=txt_rate.getText(); + double v1=Double.parseDouble(val10); + double v2=Double.parseDouble(val11); + double v=v1*v2; + + //trunsaction + String sql="select total_amount from delivery_table where serial_no='"+table_click+"'"; + pst=(PreparedStatement) conn.prepareStatement(sql); + rs=pst.executeQuery(); + double dub1=0,dub2=0,dub; + if(rs.next()) + { + dub1=rs.getDouble(1); + } + + sql="select total_delivery from client_info where id='"+val1+"'"; + pst=(PreparedStatement) conn.prepareStatement(sql); + rs=pst.executeQuery(); + + if(rs.next()) + { + dub2=rs.getDouble(1); + } + dub=dub2-dub1+v; + sql="update client_info set total_delivery='"+dub+"' where id='"+val1+"'"; + pst=(PreparedStatement) conn.prepareStatement(sql); + pst.execute(); + + String val2=txt_name.getText(); + String val3=txt_truck.getText(); + String val4=txt_description.getText(); + + String val5=txt_place.getText(); + String val6=((JTextField)txt_date.getDateEditor().getUiComponent()).getText(); + String val7=txt_length.getText(); + String val8=txt_width.getText(); + String val9=txt_height.getText(); + + String val12=""+v; + String val13=txt_remark.getText(); + + sql="update delivery_table set id ='"+val1+"',name='"+val2+"',truck_number='"+val3+"',description='"+val4+"',loading_place='"+val5+"',delivery_date='"+val6+"',length='"+val7+"',width='"+val8+"',height='"+val9+"',amount='"+val10+"',rate='"+val11+"',total_amount='"+val12+"',remarks='"+val13+"' "+"where serial_no ='"+table_click+"'"; + pst=(PreparedStatement) conn.prepareStatement(sql); + pst.execute(); + JOptionPane.showMessageDialog(null, "updated"); + update_table(); + }catch(Exception e){ + JOptionPane.showMessageDialog(null, e); + }finally { + try { + conn.close();System.out.println("disconnected"); + } catch (SQLException ex) { + Logger.getLogger(client_info.class.getName()).log(Level.SEVERE, null, ex); + } + } + + update_table(); + + }//GEN-LAST:event_jButton4ActionPerformed + + private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed + int p=JOptionPane.showConfirmDialog(null, "Do you really want to delete","delete",JOptionPane.YES_NO_OPTION); + if(p==0){ + PreparedStatement pst; + + DataBase_connect obj=new DataBase_connect(); + + Connection conn=obj.Open(); + String sql="delete from delivery_table where serial_no=?"; + try{ + int row=rowf; + System.out.println("row "+row); + String table_click=delivery_table.getModel().getValueAt(row, 0).toString(); + pst=(PreparedStatement) conn.prepareStatement(sql); + pst.setString(1, table_click); + pst.execute(); + JOptionPane.showMessageDialog(null, "deleted"); + + }catch(Exception e){ + JOptionPane.showMessageDialog(null, e); + }finally { + try { + conn.close();System.out.println("disconnected"); + } catch (SQLException ex) { + Logger.getLogger(client_info.class.getName()).log(Level.SEVERE, null, ex); + } + + update_table(); + + } + } + }//GEN-LAST:event_jButton6ActionPerformed + + private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed + + MessageFormat header=new MessageFormat("Report Print"); + MessageFormat footer=new MessageFormat("Page{0,number,integer}"); + try{ + delivery_table.print(JTable.PrintMode.NORMAL,header,footer); + }catch(Exception e){ + + } + + }//GEN-LAST:event_jButton2ActionPerformed + + private void delivery_tableKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_delivery_tableKeyPressed + + }//GEN-LAST:event_delivery_tableKeyPressed + + private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed + + this.dispose(); + + new client_info().setVisible(true); +}//GEN-LAST:event_jMenuItem2ActionPerformed + + private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed + + this.dispose(); + + new Delivery().setVisible(true); +}//GEN-LAST:event_jMenuItem3ActionPerformed + + private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed + + this.dispose(); + + new Collection().setVisible(true); +}//GEN-LAST:event_jMenuItem4ActionPerformed + + private void jMenuItem5MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenuItem5MouseClicked + System.exit(0); +}//GEN-LAST:event_jMenuItem5MouseClicked + + private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed + System.exit(0); +}//GEN-LAST:event_jMenuItem5ActionPerformed + + private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed + this.dispose(); + new HomePage().setVisible(true); + }//GEN-LAST:event_jButton8ActionPerformed + + private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed + this.dispose(); + new client_info().setVisible(true); + }//GEN-LAST:event_jButton3ActionPerformed + + private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed + + new Collection_tab().setVisible(true); + this.dispose(); + }//GEN-LAST:event_jButton9ActionPerformed + + private void jButton14ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton14ActionPerformed + System.exit(0); + }//GEN-LAST:event_jButton14ActionPerformed + + private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed + this.dispose(); + new HomePage().setVisible(true); + }//GEN-LAST:event_jMenuItem1ActionPerformed + + private void jButton11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton11ActionPerformed + + this.dispose(); + + new MyCalender().setVisible(true); + + }//GEN-LAST:event_jButton11ActionPerformed + + private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton10ActionPerformed + + this.dispose(); + + new Client_page().setVisible(true); + }//GEN-LAST:event_jButton10ActionPerformed + + private void delivery_tableMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_delivery_tableMouseEntered + // TODO add your handling code here: + }//GEN-LAST:event_delivery_tableMouseEntered + + public static void main(String args[]) { + + /* Set the Nimbus look and feel */ + // + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + /*if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + }*/ + UIManager.setLookAndFeel("com.jtattoo.plaf.smart.SmartLookAndFeel"); + //UIManager.setLookAndFeel("com.jtattoo.plaf.acryl.AcrylLookAndFeel"); + UIManager.setLookAndFeel("com.jtattoo.plaf.aero.AeroLookAndFeel"); + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(Delivery.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(Delivery.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(Delivery.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(Delivery.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + Delivery frm=new Delivery(); + frm.setVisible(true); + //frm.setSize(1020, 680); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JTable delivery_table; + private javax.swing.JButton jButton1; + private javax.swing.JButton jButton10; + private javax.swing.JButton jButton11; + private javax.swing.JButton jButton12; + private javax.swing.JButton jButton13; + private javax.swing.JButton jButton14; + private javax.swing.JButton jButton2; + private javax.swing.JButton jButton3; + private javax.swing.JButton jButton4; + private javax.swing.JButton jButton5; + private javax.swing.JButton jButton6; + private javax.swing.JButton jButton7; + private javax.swing.JButton jButton8; + private javax.swing.JButton jButton9; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel10; + private javax.swing.JLabel jLabel11; + private javax.swing.JLabel jLabel12; + private javax.swing.JLabel jLabel13; + private javax.swing.JLabel jLabel14; + private javax.swing.JLabel jLabel15; + private javax.swing.JLabel jLabel16; + private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel6; + private javax.swing.JLabel jLabel7; + private javax.swing.JLabel jLabel8; + private javax.swing.JLabel jLabel9; + private javax.swing.JMenu jMenu1; + private javax.swing.JMenuBar jMenuBar1; + private javax.swing.JMenuItem jMenuItem1; + private javax.swing.JMenuItem jMenuItem2; + private javax.swing.JMenuItem jMenuItem3; + private javax.swing.JMenuItem jMenuItem4; + private javax.swing.JMenuItem jMenuItem5; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel2; + private javax.swing.JPanel jPanel3; + private javax.swing.JPanel jPanel4; + private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JScrollPane jScrollPane2; + private javax.swing.JSeparator jSeparator1; + private javax.swing.JToolBar jToolBar1; + private javax.swing.JTextField txt_amount; + private com.toedter.calendar.JDateChooser txt_date; + private javax.swing.JTextField txt_description; + private javax.swing.JTextField txt_height; + private javax.swing.JTextField txt_id; + private javax.swing.JTextField txt_length; + private javax.swing.JTextField txt_name; + private javax.swing.JTextField txt_place; + private javax.swing.JTextField txt_rate; + private javax.swing.JTextField txt_remark; + private javax.swing.JTextField txt_truck; + private javax.swing.JTextField txt_width; + // End of variables declaration//GEN-END:variables + int rowf; +} diff --git a/ST2-Project-master/src/HomePage.form b/ST2-Project-master/src/HomePage.form new file mode 100644 index 0000000..eb2f9fd --- /dev/null +++ b/ST2-Project-master/src/HomePage.form @@ -0,0 +1,299 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/ST2-Project-master/src/HomePage.java b/ST2-Project-master/src/HomePage.java new file mode 100644 index 0000000..69ef8ea --- /dev/null +++ b/ST2-Project-master/src/HomePage.java @@ -0,0 +1,383 @@ + + +import java.awt.Graphics; +import java.awt.Image; +import java.awt.Toolkit; +import javax.swing.JFrame; + + +public class HomePage extends javax.swing.JFrame { + + JFrame obj=new JFrame(); + /** Creates new form MainPage */ + public HomePage() { + initComponents(); + repaint(); + } + + @Override + public void paint(Graphics g) + { + Image b=Toolkit.getDefaultToolkit().getImage("images/bc.jpg"); + g.drawImage(b,0,0,820,700,this); + + Image a=Toolkit.getDefaultToolkit().getImage("images/login.png"); + g.drawImage(a,0,0,570+75,390+50,this); + super.paint(g); + } + + /** 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") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jToolBar1 = new javax.swing.JToolBar(); + jButton8 = new javax.swing.JButton(); + jButton1 = new javax.swing.JButton(); + jButton2 = new javax.swing.JButton(); + jButton3 = new javax.swing.JButton(); + jButton5 = new javax.swing.JButton(); + jButton6 = new javax.swing.JButton(); + jButton9 = new javax.swing.JButton(); + jButton4 = new javax.swing.JButton(); + jButton7 = new javax.swing.JButton(); + jLabel1 = new javax.swing.JLabel(); + jMenuBar1 = new javax.swing.JMenuBar(); + jMenu1 = new javax.swing.JMenu(); + jMenuItem1 = new javax.swing.JMenuItem(); + jMenuItem2 = new javax.swing.JMenuItem(); + jMenuItem3 = new javax.swing.JMenuItem(); + jMenuItem4 = new javax.swing.JMenuItem(); + jMenuItem5 = new javax.swing.JMenuItem(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); + + jToolBar1.setRollover(true); + + jButton8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/1-Normal-Home-icon.png"))); // NOI18N + jButton8.setText("Home"); + jButton8.setFocusable(false); + jButton8.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton8.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton8.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton8ActionPerformed(evt); + } + }); + jToolBar1.add(jButton8); + + jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/new32.png"))); // NOI18N + jButton1.setText("New Client"); + jButton1.setFocusable(false); + jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + jToolBar1.add(jButton1); + + jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/money-icon.png"))); // NOI18N + jButton2.setText("Transaction"); + jButton2.setFocusable(false); + jButton2.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton2.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton2ActionPerformed(evt); + } + }); + jToolBar1.add(jButton2); + + jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/Collection-2-icon.png"))); // NOI18N + jButton3.setText("Collection"); + jButton3.setFocusable(false); + jButton3.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton3.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton3ActionPerformed(evt); + } + }); + jToolBar1.add(jButton3); + + jButton5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/print32.png"))); // NOI18N + jButton5.setText("Print"); + jButton5.setFocusable(false); + jButton5.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton5.setMaximumSize(new java.awt.Dimension(57, 57)); + jButton5.setMinimumSize(new java.awt.Dimension(57, 57)); + jButton5.setPreferredSize(new java.awt.Dimension(57, 57)); + jButton5.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton5.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton5ActionPerformed(evt); + } + }); + jToolBar1.add(jButton5); + + jButton6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/Calendar-icon.png"))); // NOI18N + jButton6.setText("Calender"); + jButton6.setFocusable(false); + jButton6.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton6.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton6.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton6ActionPerformed(evt); + } + }); + jToolBar1.add(jButton6); + + jButton9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/Button-Refresh-icon.png"))); // NOI18N + jButton9.setText("Refresh"); + jButton9.setFocusable(false); + jButton9.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton9.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton9.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton9ActionPerformed(evt); + } + }); + jToolBar1.add(jButton9); + + jButton4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/search-icon.png"))); // NOI18N + jButton4.setText("Search"); + jButton4.setFocusable(false); + jButton4.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton4.setMaximumSize(new java.awt.Dimension(57, 57)); + jButton4.setMinimumSize(new java.awt.Dimension(57, 57)); + jButton4.setPreferredSize(new java.awt.Dimension(57, 57)); + jButton4.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jToolBar1.add(jButton4); + + jButton7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/close32.png"))); // NOI18N + jButton7.setText("Close"); + jButton7.setFocusable(false); + jButton7.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton7.setMaximumSize(new java.awt.Dimension(57, 57)); + jButton7.setMinimumSize(new java.awt.Dimension(57, 57)); + jButton7.setPreferredSize(new java.awt.Dimension(57, 57)); + jButton7.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton7.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton7ActionPerformed(evt); + } + }); + jToolBar1.add(jButton7); + + jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/db.png"))); // NOI18N + + jMenu1.setText("Option"); + + jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_H, java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/house-icon.png"))); // NOI18N + jMenuItem1.setText("Home"); + jMenu1.add(jMenuItem1); + + jMenuItem2.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/new1.png"))); // NOI18N + jMenuItem2.setText("New Client"); + jMenuItem2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem2ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem2); + + jMenuItem3.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/money-icon (1).png"))); // NOI18N + jMenuItem3.setText("Transection"); + jMenuItem3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem3ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem3); + + jMenuItem4.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/Collection-2-icon (1).png"))); // NOI18N + jMenuItem4.setText("Collection"); + jMenuItem4.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem4ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem4); + + jMenuItem5.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/close1.png"))); // NOI18N + jMenuItem5.setText("Close"); + jMenuItem5.addMouseListener(new java.awt.event.MouseAdapter() { + public void mouseClicked(java.awt.event.MouseEvent evt) { + jMenuItem5MouseClicked(evt); + } + }); + jMenuItem5.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem5ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem5); + + jMenuBar1.add(jMenu1); + + setJMenuBar(jMenuBar1); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, 810, Short.MAX_VALUE) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGap(10, 10, 10)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 591, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); + setBounds((screenSize.width-811)/2, (screenSize.height-583)/2, 811, 583); + }// //GEN-END:initComponents + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + + this.dispose(); + + new client_info().setVisible(true); + + }//GEN-LAST:event_jButton1ActionPerformed + + private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed + + System.exit(0); + + }//GEN-LAST:event_jButton7ActionPerformed + + private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed + + this.dispose(); + + new Client_page().setVisible(true); + }//GEN-LAST:event_jButton5ActionPerformed + + private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed + this.dispose(); + new HomePage().setVisible(true); + }//GEN-LAST:event_jButton8ActionPerformed + + private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jButton9ActionPerformed + + private void jMenuItem5MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenuItem5MouseClicked + System.exit(0); + }//GEN-LAST:event_jMenuItem5MouseClicked + + private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed + System.exit(0); + }//GEN-LAST:event_jMenuItem5ActionPerformed + + private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed + + this.dispose(); + + new client_info().setVisible(true); + }//GEN-LAST:event_jMenuItem2ActionPerformed + + private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed + + this.dispose(); + + new Delivery().setVisible(true); + + }//GEN-LAST:event_jMenuItem3ActionPerformed + + private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed + + this.dispose(); + + new Collection().setVisible(true); + + }//GEN-LAST:event_jMenuItem4ActionPerformed + + private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed + this.dispose(); + new Delivery().setVisible(true); + }//GEN-LAST:event_jButton2ActionPerformed + + private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed + this.dispose(); + new Collection_tab().setVisible(true); + }//GEN-LAST:event_jButton3ActionPerformed + + private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed + + this.dispose(); + + new MyCalender().setVisible(true); + + }//GEN-LAST:event_jButton6ActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(HomePage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(HomePage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(HomePage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(HomePage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new HomePage().setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JButton jButton2; + private javax.swing.JButton jButton3; + private javax.swing.JButton jButton4; + private javax.swing.JButton jButton5; + private javax.swing.JButton jButton6; + private javax.swing.JButton jButton7; + private javax.swing.JButton jButton8; + private javax.swing.JButton jButton9; + private javax.swing.JLabel jLabel1; + private javax.swing.JMenu jMenu1; + private javax.swing.JMenuBar jMenuBar1; + private javax.swing.JMenuItem jMenuItem1; + private javax.swing.JMenuItem jMenuItem2; + private javax.swing.JMenuItem jMenuItem3; + private javax.swing.JMenuItem jMenuItem4; + private javax.swing.JMenuItem jMenuItem5; + private javax.swing.JToolBar jToolBar1; + // End of variables declaration//GEN-END:variables + +} diff --git a/ST2-Project-master/src/Login_Frame.form b/ST2-Project-master/src/Login_Frame.form new file mode 100644 index 0000000..2869110 --- /dev/null +++ b/ST2-Project-master/src/Login_Frame.form @@ -0,0 +1,153 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ST2-Project-master/src/Login_Frame.java b/ST2-Project-master/src/Login_Frame.java new file mode 100644 index 0000000..84fcefe --- /dev/null +++ b/ST2-Project-master/src/Login_Frame.java @@ -0,0 +1,243 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + + +import java.awt.*; +import java.awt.event.KeyEvent; +import java.awt.event.WindowEvent; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.swing.*; + +public class Login_Frame extends javax.swing.JFrame { + + Connection conn=null; + ResultSet rs=null; + PreparedStatement pst=null; + + public Login_Frame() { + + super("Login"); + System.out.println(this.getMaximumSize().getHeight()); + System.out.println(this.getMaximumSize().getWidth()); + initComponents(); + } + public void close(){ + WindowEvent winclosingevent=new WindowEvent(this,WindowEvent.WINDOW_CLOSING); + Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(winclosingevent); + } + + /** + * 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") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jPanel1 = new javax.swing.JPanel(); + txt_password = new javax.swing.JPasswordField(); + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + txt_username = new javax.swing.JTextField(); + cmd_login = new javax.swing.JButton(); + jLabel3 = new javax.swing.JLabel(); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + + jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Login", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 18), new java.awt.Color(0, 153, 255))); // NOI18N + + txt_password.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + txt_passwordActionPerformed(evt); + } + }); + txt_password.addKeyListener(new java.awt.event.KeyAdapter() { + public void keyPressed(java.awt.event.KeyEvent evt) { + txt_passwordKeyPressed(evt); + } + }); + + jLabel1.setFont(new java.awt.Font("Tahoma", 0, 14)); + jLabel1.setText("Username"); + + jLabel2.setFont(new java.awt.Font("Tahoma", 0, 14)); + jLabel2.setText("Password"); + + cmd_login.setFont(new java.awt.Font("Tahoma", 0, 14)); + cmd_login.setText("Login"); + cmd_login.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + cmd_loginActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(33, 33, 33) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel1) + .addComponent(jLabel2)) + .addGap(28, 28, 28) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(txt_username) + .addComponent(txt_password, javax.swing.GroupLayout.DEFAULT_SIZE, 156, Short.MAX_VALUE)) + .addContainerGap(11, Short.MAX_VALUE)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addContainerGap(205, Short.MAX_VALUE) + .addComponent(cmd_login) + .addGap(19, 19, 19)) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(39, 39, 39) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(txt_username, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel1)) + .addGap(23, 23, 23) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(txt_password, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel2)) + .addGap(18, 18, 18) + .addComponent(cmd_login) + .addContainerGap(37, Short.MAX_VALUE)) + ); + + jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/fp2.png"))); // NOI18N + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel3) + .addGap(28, 28, 28) + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(44, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(119, 119, 119) + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(jLabel3)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); + setBounds((screenSize.width-789)/2, (screenSize.height-555)/2, 789, 555); + }// //GEN-END:initComponents + + private void cmd_loginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmd_loginActionPerformed + + DataBase_connect obj=new DataBase_connect(); + + Connection conn=obj.Open(); + + String sql="select * from login_table where username=? and password=?"; + try{ + pst=conn.prepareStatement(sql); + pst.setString(1, txt_username.getText()); + pst.setString(2, txt_password.getText()); + rs=pst.executeQuery(); + if(rs.next()){ + + rs.close(); + pst.close(); + + // + + close(); + HomePage pg=new HomePage(); + pg.setVisible(true); + } + else{ + JOptionPane.showMessageDialog(null, "Username and Password is incorrect"); + } + + }catch(Exception e){ + JOptionPane.showMessageDialog(null, e); + } + +}//GEN-LAST:event_cmd_loginActionPerformed + + private void txt_passwordKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_passwordKeyPressed + + if(evt.getKeyCode()==KeyEvent.VK_ENTER){ + + DataBase_connect obj=new DataBase_connect(); + + Connection conn=obj.Open(); + + String sql="select * from login_table where username=? and password=?"; + + try{ + pst=conn.prepareStatement(sql); + pst.setString(1, txt_username.getText()); + pst.setString(2, txt_password.getText()); + rs=pst.executeQuery(); + if(rs.next()){ + // JOptionPane.showMessageDialog(null, "Username and Password is correct"); + rs.close(); + pst.close(); + close(); + new HomePage().setVisible(true); + } + else{ + JOptionPane.showMessageDialog(null, "Username and Password is incorrect"); + } + + }catch(Exception e){ + JOptionPane.showMessageDialog(null, e); + } + finally { + try { + conn.close(); + } catch (SQLException ex) { + Logger.getLogger(Login_Frame.class.getName()).log(Level.SEVERE, null, ex); + } + } + } + +}//GEN-LAST:event_txt_passwordKeyPressed + + private void txt_passwordActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txt_passwordActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_txt_passwordActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new Login_Frame().setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton cmd_login; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JPanel jPanel1; + private javax.swing.JPasswordField txt_password; + private javax.swing.JTextField txt_username; + // End of variables declaration//GEN-END:variables +} diff --git a/ST2-Project-master/src/Login_Frame1.form b/ST2-Project-master/src/Login_Frame1.form new file mode 100644 index 0000000..3b1449b --- /dev/null +++ b/ST2-Project-master/src/Login_Frame1.form @@ -0,0 +1,103 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ST2-Project-master/src/Login_Frame1.java b/ST2-Project-master/src/Login_Frame1.java new file mode 100644 index 0000000..51966dd --- /dev/null +++ b/ST2-Project-master/src/Login_Frame1.java @@ -0,0 +1,219 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + + +import java.awt.*; +import java.awt.event.KeyEvent; +import java.awt.event.WindowEvent; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.swing.*; + +public class Login_Frame1 extends javax.swing.JFrame { + + Connection conn=null; + ResultSet rs=null; + PreparedStatement pst=null; + + public Login_Frame1() { + + super("Login"); + System.out.println(this.getMaximumSize().getHeight()); + System.out.println(this.getMaximumSize().getWidth()); + initComponents(); + } + public void close(){ + WindowEvent winclosingevent=new WindowEvent(this,WindowEvent.WINDOW_CLOSING); + Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(winclosingevent); + } + + /** + * 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") + // //GEN-BEGIN:initComponents + private void initComponents() { + + txt_username = new javax.swing.JTextField(); + cmd_login = new javax.swing.JButton(); + txt_password = new javax.swing.JPasswordField(); + jLabel1 = new javax.swing.JLabel(); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + setBackground(new java.awt.Color(0, 0, 0)); + + txt_username.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + txt_usernameActionPerformed(evt); + } + }); + + cmd_login.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N + cmd_login.setText("Login"); + cmd_login.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + cmd_loginActionPerformed(evt); + } + }); + + txt_password.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + txt_passwordActionPerformed(evt); + } + }); + txt_password.addKeyListener(new java.awt.event.KeyAdapter() { + public void keyPressed(java.awt.event.KeyEvent evt) { + txt_passwordKeyPressed(evt); + } + }); + + jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/login.png"))); // NOI18N + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(308, 308, 308) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(txt_username) + .addComponent(txt_password, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 83, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(cmd_login) + .addGap(8, 8, 8)))) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jLabel1))) + .addContainerGap(20, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jLabel1) + .addGap(180, 180, 180) + .addComponent(txt_username, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(23, 23, 23) + .addComponent(txt_password, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(cmd_login) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); + setBounds((screenSize.width-617)/2, (screenSize.height-454)/2, 617, 454); + }// //GEN-END:initComponents + + private void cmd_loginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmd_loginActionPerformed + + DataBase_connect obj=new DataBase_connect(); + + Connection conn=obj.Open(); + + String sql="select * from login_table where username=? and password=?"; + try{ + pst=conn.prepareStatement(sql); + pst.setString(1, txt_username.getText()); + pst.setString(2, txt_password.getText()); + rs=pst.executeQuery(); + if(rs.next()){ + + rs.close(); + pst.close(); + + // + + close(); + HomePage pg=new HomePage(); + pg.setVisible(true); + } + else{ + JOptionPane.showMessageDialog(null, "Username and Password is incorrect"); + } + + }catch(Exception e){ + JOptionPane.showMessageDialog(null, e); + } + +}//GEN-LAST:event_cmd_loginActionPerformed + + private void txt_passwordKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_passwordKeyPressed + + if(evt.getKeyCode()==KeyEvent.VK_ENTER){ + + DataBase_connect obj=new DataBase_connect(); + + Connection conn=obj.Open(); + + String sql="select * from login_table where username=? and password=?"; + + try{ + pst=conn.prepareStatement(sql); + pst.setString(1, txt_username.getText()); + pst.setString(2, txt_password.getText()); + rs=pst.executeQuery(); + if(rs.next()){ + // JOptionPane.showMessageDialog(null, "Username and Password is correct"); + rs.close(); + pst.close(); + close(); + new HomePage().setVisible(true); + } + else{ + JOptionPane.showMessageDialog(null, "Username and Password is incorrect"); + } + + }catch(Exception e){ + JOptionPane.showMessageDialog(null, e); + } + finally { + try { + conn.close(); + } catch (SQLException ex) { + Logger.getLogger(Login_Frame.class.getName()).log(Level.SEVERE, null, ex); + } + } + } + +}//GEN-LAST:event_txt_passwordKeyPressed + + private void txt_passwordActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txt_passwordActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_txt_passwordActionPerformed + + private void txt_usernameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txt_usernameActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_txt_usernameActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new Login_Frame1().setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton cmd_login; + private javax.swing.JLabel jLabel1; + private javax.swing.JPasswordField txt_password; + private javax.swing.JTextField txt_username; + // End of variables declaration//GEN-END:variables +} diff --git a/ST2-Project-master/src/Login_Image.java b/ST2-Project-master/src/Login_Image.java new file mode 100644 index 0000000..9ac6c71 --- /dev/null +++ b/ST2-Project-master/src/Login_Image.java @@ -0,0 +1,133 @@ +import com.mysql.jdbc.Connection; +import com.mysql.jdbc.PreparedStatement; +import java.awt.event.MouseEvent; +import javax.swing.JFrame; +import javax.swing.JPanel; +import java.awt.Graphics; +import java.awt.Image; +import java.awt.Toolkit; +import java.awt.event.MouseListener; +import java.sql.ResultSet; +import javax.swing.JOptionPane; +import javax.swing.JTextField; + + +public class Login_Image extends JPanel implements MouseListener +{ + static JTextField name,pass; + static JPanel panel; + static JFrame myFrame; + + public Login_Image() + { + setOpaque(false); + + setLayout(null); + + this.addMouseListener(this); + } + + + public static void main(String[]args) + { + myFrame=new JFrame("OS Lab"); + + Login_Image c=new Login_Image(); + + name=new JTextField(); + name.setBounds(280,190, 110, 15); + name.setHighlighter(null); + c.add(name); + + pass=new JTextField(); + pass.setBounds(280,223, 110, 15); + c.add(pass); + + myFrame.add(c); + myFrame.setResizable(false); + // myFrame.setLocationRelativeTo(null); + myFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + myFrame.setSize(645,440); + myFrame.setVisible(true); + myFrame.repaint(); + } + + @Override + public void paint(Graphics g) + { + Image b=Toolkit.getDefaultToolkit().getImage("images/bc.jpg"); + g.drawImage(b,0,0,820,700,this); + + Image a=Toolkit.getDefaultToolkit().getImage("images/login.png"); + g.drawImage(a,0,0,570+75,390+50,this); + super.paint(g); + } + + + @Override + public void mouseClicked(MouseEvent e) { + + int x=e.getX(),y=e.getY(); + + System.out.println(x+" "+y); + + if ( (x-432)*(x-432) + (y-211)*(y-211) < 17*17) + { + + DataBase_connect obj=new DataBase_connect(); + + ResultSet rs=null; + + PreparedStatement pst=null; + + Connection conn=obj.Open(); + + String sql="select * from login_table where username=? and password=?"; + try{ + pst=(PreparedStatement) conn.prepareStatement(sql); + pst.setString(1, name.getText()); + pst.setString(2, pass.getText()); + rs=pst.executeQuery(); + if(rs.next()){ + + rs.close(); + pst.close(); + + myFrame.dispose(); + + HomePage pg=new HomePage(); + pg.setVisible(true); + } + else{ + JOptionPane.showMessageDialog(null, "Username and Password is incorrect"); + } + + }catch(Exception ex){ + JOptionPane.showMessageDialog(null, e); + } + + + } + } + + @Override + public void mousePressed(MouseEvent e) { + + } + + @Override + public void mouseReleased(MouseEvent e) { + + } + + @Override + public void mouseEntered(MouseEvent e) { + + } + + @Override + public void mouseExited(MouseEvent e) { + + } + +} diff --git a/ST2-Project-master/src/MyCalender.form b/ST2-Project-master/src/MyCalender.form new file mode 100644 index 0000000..1ae0fd4 --- /dev/null +++ b/ST2-Project-master/src/MyCalender.form @@ -0,0 +1,324 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ST2-Project-master/src/MyCalender.java b/ST2-Project-master/src/MyCalender.java new file mode 100644 index 0000000..cbebd0f --- /dev/null +++ b/ST2-Project-master/src/MyCalender.java @@ -0,0 +1,364 @@ + + +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +/* + * MyCalender.java + * + * Created on Sep 20, 2012, 5:23:31 AM + */ + +/** + * + * @author Vish + */ +public class MyCalender extends javax.swing.JFrame { + + /** Creates new form MyCalender */ + public MyCalender() { + 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") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jToolBar1 = new javax.swing.JToolBar(); + jButton8 = new javax.swing.JButton(); + jButton1 = new javax.swing.JButton(); + jButton2 = new javax.swing.JButton(); + jButton3 = new javax.swing.JButton(); + jButton5 = new javax.swing.JButton(); + jButton6 = new javax.swing.JButton(); + jButton9 = new javax.swing.JButton(); + jButton4 = new javax.swing.JButton(); + jButton7 = new javax.swing.JButton(); + jPanel1 = new javax.swing.JPanel(); + jCalendar1 = new com.toedter.calendar.JCalendar(); + jMenuBar1 = new javax.swing.JMenuBar(); + jMenu1 = new javax.swing.JMenu(); + jMenuItem1 = new javax.swing.JMenuItem(); + jMenuItem2 = new javax.swing.JMenuItem(); + jMenuItem3 = new javax.swing.JMenuItem(); + jMenuItem4 = new javax.swing.JMenuItem(); + jMenuItem5 = new javax.swing.JMenuItem(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + + jToolBar1.setRollover(true); + + jButton8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/1-Normal-Home-icon.png"))); // NOI18N + jButton8.setText("Home"); + jButton8.setFocusable(false); + jButton8.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton8.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton8.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton8ActionPerformed(evt); + } + }); + jToolBar1.add(jButton8); + + jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/new32.png"))); // NOI18N + jButton1.setText("New Client"); + jButton1.setFocusable(false); + jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + jToolBar1.add(jButton1); + + jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/money-icon.png"))); // NOI18N + jButton2.setText("Transaction"); + jButton2.setFocusable(false); + jButton2.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton2.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton2ActionPerformed(evt); + } + }); + jToolBar1.add(jButton2); + + jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/Collection-2-icon.png"))); // NOI18N + jButton3.setText("Collection"); + jButton3.setFocusable(false); + jButton3.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton3.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton3ActionPerformed(evt); + } + }); + jToolBar1.add(jButton3); + + jButton5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/print32.png"))); // NOI18N + jButton5.setText("Print"); + jButton5.setFocusable(false); + jButton5.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton5.setMaximumSize(new java.awt.Dimension(57, 57)); + jButton5.setMinimumSize(new java.awt.Dimension(57, 57)); + jButton5.setPreferredSize(new java.awt.Dimension(57, 57)); + jButton5.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton5.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton5ActionPerformed(evt); + } + }); + jToolBar1.add(jButton5); + + jButton6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/Calendar-icon.png"))); // NOI18N + jButton6.setText("Calender"); + jButton6.setFocusable(false); + jButton6.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton6.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jToolBar1.add(jButton6); + + jButton9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/Button-Refresh-icon.png"))); // NOI18N + jButton9.setText("Refresh"); + jButton9.setFocusable(false); + jButton9.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton9.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton9.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton9ActionPerformed(evt); + } + }); + jToolBar1.add(jButton9); + + jButton4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/search-icon.png"))); // NOI18N + jButton4.setText("Search"); + jButton4.setFocusable(false); + jButton4.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton4.setMaximumSize(new java.awt.Dimension(57, 57)); + jButton4.setMinimumSize(new java.awt.Dimension(57, 57)); + jButton4.setPreferredSize(new java.awt.Dimension(57, 57)); + jButton4.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jToolBar1.add(jButton4); + + jButton7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/close32.png"))); // NOI18N + jButton7.setText("Close"); + jButton7.setFocusable(false); + jButton7.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton7.setMaximumSize(new java.awt.Dimension(57, 57)); + jButton7.setMinimumSize(new java.awt.Dimension(57, 57)); + jButton7.setPreferredSize(new java.awt.Dimension(57, 57)); + jButton7.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton7.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton7ActionPerformed(evt); + } + }); + jToolBar1.add(jButton7); + + jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Current Month", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 18), new java.awt.Color(51, 153, 255))); // NOI18N + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jCalendar1, javax.swing.GroupLayout.PREFERRED_SIZE, 289, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap()) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jCalendar1, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap()) + ); + + jMenu1.setText("Option"); + + jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_H, java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/house-icon.png"))); // NOI18N + jMenuItem1.setText("Home"); + jMenu1.add(jMenuItem1); + + jMenuItem2.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/new1.png"))); // NOI18N + jMenuItem2.setText("New Client"); + jMenuItem2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem2ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem2); + + jMenuItem3.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/money-icon (1).png"))); // NOI18N + jMenuItem3.setText("Transection"); + jMenuItem3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem3ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem3); + + jMenuItem4.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/Collection-2-icon (1).png"))); // NOI18N + jMenuItem4.setText("Collection"); + jMenuItem4.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem4ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem4); + + jMenuItem5.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/close1.png"))); // NOI18N + jMenuItem5.setText("Close"); + jMenuItem5.addMouseListener(new java.awt.event.MouseAdapter() { + public void mouseClicked(java.awt.event.MouseEvent evt) { + jMenuItem5MouseClicked(evt); + } + }); + jMenuItem5.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem5ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem5); + + jMenuBar1.add(jMenu1); + + setJMenuBar(jMenuBar1); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, 815, Short.MAX_VALUE) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap(251, Short.MAX_VALUE) + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(243, 243, 243)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(45, 45, 45) + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(105, Short.MAX_VALUE)) + ); + + java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); + setBounds((screenSize.width-831)/2, (screenSize.height-554)/2, 831, 554); + }// //GEN-END:initComponents + + private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed + + this.dispose(); + + new client_info().setVisible(true); +}//GEN-LAST:event_jMenuItem2ActionPerformed + + private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed + + this.dispose(); + + new Delivery().setVisible(true); + }//GEN-LAST:event_jMenuItem3ActionPerformed + + private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed + + this.dispose(); + + new Collection().setVisible(true); + }//GEN-LAST:event_jMenuItem4ActionPerformed + + private void jMenuItem5MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenuItem5MouseClicked + System.exit(0); +}//GEN-LAST:event_jMenuItem5MouseClicked + + private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed + System.exit(0); +}//GEN-LAST:event_jMenuItem5ActionPerformed + + private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed + this.dispose(); + new HomePage().setVisible(true); +}//GEN-LAST:event_jButton8ActionPerformed + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + + this.dispose(); + + new client_info().setVisible(true); + }//GEN-LAST:event_jButton1ActionPerformed + + private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed + this.dispose(); + new Delivery().setVisible(true); +}//GEN-LAST:event_jButton2ActionPerformed + + private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed + this.dispose(); + new Collection_tab().setVisible(true); + }//GEN-LAST:event_jButton3ActionPerformed + + private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed + + this.dispose(); + + new Client_page().setVisible(true); + +}//GEN-LAST:event_jButton5ActionPerformed + + private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed + // TODO add your handling code here: +}//GEN-LAST:event_jButton9ActionPerformed + + private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed + + System.exit(0); + }//GEN-LAST:event_jButton7ActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new MyCalender().setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JButton jButton2; + private javax.swing.JButton jButton3; + private javax.swing.JButton jButton4; + private javax.swing.JButton jButton5; + private javax.swing.JButton jButton6; + private javax.swing.JButton jButton7; + private javax.swing.JButton jButton8; + private javax.swing.JButton jButton9; + private com.toedter.calendar.JCalendar jCalendar1; + private javax.swing.JMenu jMenu1; + private javax.swing.JMenuBar jMenuBar1; + private javax.swing.JMenuItem jMenuItem1; + private javax.swing.JMenuItem jMenuItem2; + private javax.swing.JMenuItem jMenuItem3; + private javax.swing.JMenuItem jMenuItem4; + private javax.swing.JMenuItem jMenuItem5; + private javax.swing.JPanel jPanel1; + private javax.swing.JToolBar jToolBar1; + // End of variables declaration//GEN-END:variables + +} diff --git a/ST2-Project-master/src/StockEntry.form b/ST2-Project-master/src/StockEntry.form new file mode 100644 index 0000000..c93e6b6 --- /dev/null +++ b/ST2-Project-master/src/StockEntry.form @@ -0,0 +1,427 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ diff --git a/ST2-Project-master/src/StockEntry.java b/ST2-Project-master/src/StockEntry.java new file mode 100644 index 0000000..f034659 --- /dev/null +++ b/ST2-Project-master/src/StockEntry.java @@ -0,0 +1,368 @@ + +import javax.swing.UIManager; + +public class StockEntry extends javax.swing.JFrame { + + /** Creates new form StockEntry */ + public StockEntry() { + 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. + */ + + // //GEN-BEGIN:initComponents + private void initComponents() { + + jPanel1 = new javax.swing.JPanel(); + jLabel5 = new javax.swing.JLabel(); + jLabel6 = new javax.swing.JLabel(); + jLabel7 = new javax.swing.JLabel(); + jLabel8 = new javax.swing.JLabel(); + jLabel9 = new javax.swing.JLabel(); + jTextField6 = new javax.swing.JTextField(); + jTextField7 = new javax.swing.JTextField(); + jTextField8 = new javax.swing.JTextField(); + jTextField9 = new javax.swing.JTextField(); + jTextField10 = new javax.swing.JTextField(); + jPanel2 = new javax.swing.JPanel(); + jLabel10 = new javax.swing.JLabel(); + jLabel11 = new javax.swing.JLabel(); + jLabel12 = new javax.swing.JLabel(); + jLabel13 = new javax.swing.JLabel(); + jLabel14 = new javax.swing.JLabel(); + jTextField11 = new javax.swing.JTextField(); + jTextField12 = new javax.swing.JTextField(); + jTextField13 = new javax.swing.JTextField(); + jTextField14 = new javax.swing.JTextField(); + jTextField15 = new javax.swing.JTextField(); + jTextField16 = new javax.swing.JTextField(); + jLabel15 = new javax.swing.JLabel(); + jScrollPane1 = new javax.swing.JScrollPane(); + jScrollPane2 = new javax.swing.JScrollPane(); + jTable1 = new javax.swing.JTable(); + jLabel1 = new javax.swing.JLabel(); + jSeparator1 = new javax.swing.JSeparator(); + jPanel4 = new javax.swing.JPanel(); + jButton4 = new javax.swing.JButton(); + jButton5 = new javax.swing.JButton(); + jButton6 = new javax.swing.JButton(); + jButton1 = new javax.swing.JButton(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); + + jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED), "Truck Info", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Trebuchet MS", 1, 14), new java.awt.Color(0, 0, 102))); // NOI18N + jPanel1.setToolTipText("Insert All the Information About The truck"); + jPanel1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); + jPanel1.setDebugGraphicsOptions(javax.swing.DebugGraphics.NONE_OPTION); + + jLabel5.setText("Truck Number :"); + + jLabel6.setText("Length :"); + + jLabel7.setText("Height :"); + + jLabel8.setText("Width :"); + + jLabel9.setText("Ammount(ton) : "); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel6) + .addComponent(jLabel5) + .addComponent(jLabel8) + .addComponent(jLabel7) + .addComponent(jLabel9)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jTextField10, javax.swing.GroupLayout.DEFAULT_SIZE, 167, Short.MAX_VALUE) + .addComponent(jTextField6, javax.swing.GroupLayout.DEFAULT_SIZE, 167, Short.MAX_VALUE) + .addComponent(jTextField9, javax.swing.GroupLayout.DEFAULT_SIZE, 167, Short.MAX_VALUE) + .addComponent(jTextField8, javax.swing.GroupLayout.DEFAULT_SIZE, 167, Short.MAX_VALUE) + .addComponent(jTextField7, javax.swing.GroupLayout.DEFAULT_SIZE, 167, Short.MAX_VALUE)) + .addContainerGap()) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jTextField10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel5)) + .addGap(18, 18, 18) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel6)) + .addGap(18, 18, 18) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel8)) + .addGap(18, 18, 18) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jTextField8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel7)) + .addGap(18, 18, 18) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jTextField9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(19, Short.MAX_VALUE)) + ); + + jPanel2.setToolTipText("Insert All the Information About The truck"); + jPanel2.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); + jPanel2.setDebugGraphicsOptions(javax.swing.DebugGraphics.NONE_OPTION); + + jLabel10.setText("L.C. Number :"); + + jLabel11.setText("L.C. Date :"); + + jLabel12.setText("Supplier Id :"); + + jLabel13.setText("Rate :"); + + jLabel14.setText("Received Invoice :"); + + jLabel15.setText("Received Date :"); + + javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); + jPanel2.setLayout(jPanel2Layout); + jPanel2Layout.setHorizontalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel10) + .addComponent(jLabel11) + .addComponent(jLabel13) + .addComponent(jLabel12) + .addComponent(jLabel15) + .addComponent(jLabel14)) + .addGap(15, 15, 15) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jTextField16, javax.swing.GroupLayout.DEFAULT_SIZE, 211, Short.MAX_VALUE) + .addComponent(jTextField14, javax.swing.GroupLayout.DEFAULT_SIZE, 211, Short.MAX_VALUE) + .addComponent(jTextField11, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 211, Short.MAX_VALUE) + .addComponent(jTextField15, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 211, Short.MAX_VALUE) + .addComponent(jTextField12, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 211, Short.MAX_VALUE) + .addComponent(jTextField13, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 211, Short.MAX_VALUE)) + .addContainerGap()) + ); + jPanel2Layout.setVerticalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel10) + .addComponent(jTextField15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel11) + .addComponent(jTextField11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel13) + .addComponent(jTextField12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel12) + .addComponent(jTextField13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField16, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + jTable1.setModel(new javax.swing.table.DefaultTableModel( + new Object [][] { + {null, null, null, null}, + {null, null, null, null}, + {null, null, null, null}, + {null, null, null, null} + }, + new String [] { + "Title 1", "Title 2", "Title 3", "Title 4" + } + )); + jScrollPane2.setViewportView(jTable1); + + jScrollPane1.setViewportView(jScrollPane2); + + jLabel1.setFont(new java.awt.Font("Rockwell Extra Bold", 1, 24)); + jLabel1.setForeground(new java.awt.Color(0, 51, 102)); + jLabel1.setText("Stock Entry"); + + jPanel4.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED)); + + jButton4.setText("Update"); + + jButton5.setText("Clear"); + + jButton6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/close.png"))); // NOI18N + jButton6.setText("Delete"); + + jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/add.png"))); // NOI18N + jButton1.setText("Save"); + + javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); + jPanel4.setLayout(jPanel4Layout); + jPanel4Layout.setHorizontalGroup( + jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel4Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jButton6, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jButton5, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 83, Short.MAX_VALUE) + .addComponent(jButton4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 83, Short.MAX_VALUE) + .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, 83, Short.MAX_VALUE)) + .addContainerGap()) + ); + jPanel4Layout.setVerticalGroup( + jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel4Layout.createSequentialGroup() + .addContainerGap() + .addComponent(jButton1) + .addGap(18, 18, 18) + .addComponent(jButton4) + .addGap(18, 18, 18) + .addComponent(jButton5) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 10, Short.MAX_VALUE) + .addComponent(jButton6) + .addContainerGap()) + ); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 125, Short.MAX_VALUE) + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 624, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(7, 7, 7))) + .addGap(8, 8, 8)) + .addGroup(layout.createSequentialGroup() + .addGap(218, 218, 218) + .addComponent(jLabel1)) + .addGroup(layout.createSequentialGroup() + .addGap(201, 201, 201) + .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 207, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(jLabel1) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 4, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(28, 28, 28) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(24, Short.MAX_VALUE)) + ); + + pack(); + }// //GEN-END:initComponents + + public static void main(String args[]) { + + /* Set the Nimbus look and feel */ + // + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + /*if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + }*/ + UIManager.setLookAndFeel("com.jtattoo.plaf.smart.SmartLookAndFeel"); + //UIManager.setLookAndFeel("com.jtattoo.plaf.acryl.AcrylLookAndFeel"); + UIManager.setLookAndFeel("com.jtattoo.plaf.aero.AeroLookAndFeel"); + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(StockEntry.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(StockEntry.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(StockEntry.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(StockEntry.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + StockEntry frm=new StockEntry(); + frm.setVisible(true); + //frm.setSize(1020, 680); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JButton jButton4; + private javax.swing.JButton jButton5; + private javax.swing.JButton jButton6; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel10; + private javax.swing.JLabel jLabel11; + private javax.swing.JLabel jLabel12; + private javax.swing.JLabel jLabel13; + private javax.swing.JLabel jLabel14; + private javax.swing.JLabel jLabel15; + private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel6; + private javax.swing.JLabel jLabel7; + private javax.swing.JLabel jLabel8; + private javax.swing.JLabel jLabel9; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel2; + private javax.swing.JPanel jPanel4; + private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JScrollPane jScrollPane2; + private javax.swing.JSeparator jSeparator1; + private javax.swing.JTable jTable1; + private javax.swing.JTextField jTextField10; + private javax.swing.JTextField jTextField11; + private javax.swing.JTextField jTextField12; + private javax.swing.JTextField jTextField13; + private javax.swing.JTextField jTextField14; + private javax.swing.JTextField jTextField15; + private javax.swing.JTextField jTextField16; + private javax.swing.JTextField jTextField6; + private javax.swing.JTextField jTextField7; + private javax.swing.JTextField jTextField8; + private javax.swing.JTextField jTextField9; + // End of variables declaration//GEN-END:variables + +} diff --git a/ST2-Project-master/src/Supplier_info.form b/ST2-Project-master/src/Supplier_info.form new file mode 100644 index 0000000..ba9b7e5 --- /dev/null +++ b/ST2-Project-master/src/Supplier_info.form @@ -0,0 +1,451 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ diff --git a/ST2-Project-master/src/Supplier_info.java b/ST2-Project-master/src/Supplier_info.java new file mode 100644 index 0000000..1f5e0a7 --- /dev/null +++ b/ST2-Project-master/src/Supplier_info.java @@ -0,0 +1,680 @@ + + + +import java.awt.*; +import java.awt.event.KeyEvent; +import java.awt.event.WindowEvent; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.text.MessageFormat; +import java.text.SimpleDateFormat; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.swing.*; +import net.proteanit.sql.DbUtils; +import java.util.Calendar; +import java.util.GregorianCalendar; + + +public class Supplier_info extends javax.swing.JFrame { + + Connection conn=null; + ResultSet rs=null; + PreparedStatement pst=null; + + public Supplier_info() + { + initComponents(); + update_table(); + } + + public void close() + { + WindowEvent winclosingevent=new WindowEvent(this,WindowEvent.WINDOW_CLOSING); + Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(winclosingevent); + } + + public void currentdate() + { + Calendar cal=new GregorianCalendar(); + int month=cal.get(Calendar.MONTH); + int year=cal.get(Calendar.YEAR); + int day=cal.get(Calendar.DAY_OF_MONTH); + date.setText("Date-"+day+"/"+(month+1)+"/"+year); + int second=cal.get(Calendar.SECOND); + int mn=cal.get(Calendar.MINUTE); + int hr=cal.get(Calendar.HOUR); + + } + + private void update_table() { + + PreparedStatement pst; + + DataBase_connect obj=new DataBase_connect(); + + Connection conn=obj.Open(); + + try{ + String sql="select id,name,address,contact,datee from client_info"; + pst=conn.prepareStatement(sql); + rs=pst.executeQuery(); + client_table.setModel(DbUtils.resultSetToTableModel(rs)); + }catch(Exception e){ + JOptionPane.showMessageDialog(null, e); + }finally { + try { + conn.close(); + System.out.println("disconnected"); + } catch (SQLException ex) { + Logger.getLogger(client_info.class.getName()).log(Level.SEVERE, null, ex); + } + } + + } + + + + + /** + * 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") + // //GEN-BEGIN:initComponents + private void initComponents() { + + menuBar1 = new java.awt.MenuBar(); + menu1 = new java.awt.Menu(); + menu2 = new java.awt.Menu(); + menuBar2 = new java.awt.MenuBar(); + menu3 = new java.awt.Menu(); + menu4 = new java.awt.Menu(); + jMenuBar1 = new javax.swing.JMenuBar(); + jMenu1 = new javax.swing.JMenu(); + jMenu2 = new javax.swing.JMenu(); + jPanel1 = new javax.swing.JPanel(); + update = new javax.swing.JButton(); + save = new javax.swing.JButton(); + clear = new javax.swing.JButton(); + delete = new javax.swing.JButton(); + jPanel2 = new javax.swing.JPanel(); + jLabel1 = new javax.swing.JLabel(); + txt_address = new javax.swing.JTextField(); + jLabel2 = new javax.swing.JLabel(); + txt_id = new javax.swing.JTextField(); + jLabel4 = new javax.swing.JLabel(); + txt_name = new javax.swing.JTextField(); + jLabel3 = new javax.swing.JLabel(); + txt_contact = new javax.swing.JTextField(); + jLabel5 = new javax.swing.JLabel(); + txt_date = new com.toedter.calendar.JDateChooser(); + txt_pro_name = new javax.swing.JTextField(); + jLabel6 = new javax.swing.JLabel(); + jScrollPane2 = new javax.swing.JScrollPane(); + jScrollPane1 = new javax.swing.JScrollPane(); + client_table = new javax.swing.JTable(); + jPanel3 = new javax.swing.JPanel(); + search = new javax.swing.JTextField(); + jMenuBar2 = new javax.swing.JMenuBar(); + jMenu3 = new javax.swing.JMenu(); + jMenuItem1 = new javax.swing.JMenuItem(); + jSeparator1 = new javax.swing.JPopupMenu.Separator(); + jMenuItem2 = new javax.swing.JMenuItem(); + jMenuItem4 = new javax.swing.JMenuItem(); + jMenu4 = new javax.swing.JMenu(); + date = new javax.swing.JMenu(); + + menu1.setLabel("File"); + menuBar1.add(menu1); + + menu2.setLabel("Edit"); + menuBar1.add(menu2); + + menu3.setLabel("File"); + menuBar2.add(menu3); + + menu4.setLabel("Edit"); + menuBar2.add(menu4); + + jMenu1.setText("File"); + jMenuBar1.add(jMenu1); + + jMenu2.setText("Edit"); + jMenuBar1.add(jMenu2); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + + jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Options", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 14), new java.awt.Color(0, 51, 153))); // NOI18N + + update.setText("Update"); + update.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + updateActionPerformed(evt); + } + }); + + save.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/add.png"))); // NOI18N + save.setText("Save"); + save.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + saveActionPerformed(evt); + } + }); + + clear.setText("Clear"); + clear.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + clearActionPerformed(evt); + } + }); + + delete.setText("Delete"); + delete.setToolTipText("delete the selected row"); + delete.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + deleteActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(save, javax.swing.GroupLayout.DEFAULT_SIZE, 77, Short.MAX_VALUE) + .addComponent(update, javax.swing.GroupLayout.DEFAULT_SIZE, 77, Short.MAX_VALUE) + .addComponent(clear, javax.swing.GroupLayout.DEFAULT_SIZE, 77, Short.MAX_VALUE) + .addComponent(delete, javax.swing.GroupLayout.DEFAULT_SIZE, 77, Short.MAX_VALUE)) + .addContainerGap()) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addComponent(save) + .addGap(18, 18, 18) + .addComponent(delete) + .addGap(18, 18, 18) + .addComponent(update) + .addGap(18, 18, 18) + .addComponent(clear) + .addContainerGap(73, Short.MAX_VALUE)) + ); + + jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Supplier Information", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 1, 14), new java.awt.Color(0, 102, 153))); // NOI18N + + jLabel1.setText("Supplier ID"); + + jLabel2.setText("Name"); + + jLabel4.setText("Contact"); + + jLabel3.setText("Address"); + + jLabel5.setText("Date "); + + txt_date.setDateFormatString("yyyy-MM-dd"); + + jLabel6.setText("Pro. Name"); + + javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); + jPanel2.setLayout(jPanel2Layout); + jPanel2Layout.setHorizontalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel5) + .addComponent(jLabel4) + .addComponent(jLabel6) + .addComponent(jLabel1) + .addComponent(jLabel2) + .addComponent(jLabel3)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(txt_id, javax.swing.GroupLayout.DEFAULT_SIZE, 196, Short.MAX_VALUE) + .addComponent(txt_address, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 196, Short.MAX_VALUE) + .addComponent(txt_pro_name, javax.swing.GroupLayout.DEFAULT_SIZE, 196, Short.MAX_VALUE) + .addComponent(txt_date, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 196, Short.MAX_VALUE) + .addComponent(txt_contact, javax.swing.GroupLayout.DEFAULT_SIZE, 196, Short.MAX_VALUE) + .addComponent(txt_name, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 196, Short.MAX_VALUE)) + .addContainerGap()) + ); + jPanel2Layout.setVerticalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel1) + .addComponent(txt_id, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2) + .addComponent(txt_name, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addComponent(txt_address, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(txt_pro_name, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel6))) + .addComponent(jLabel3)) + .addGap(18, 18, 18) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(txt_contact, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel4)) + .addGap(18, 18, 18) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel5) + .addComponent(txt_date, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + client_table.setModel(new javax.swing.table.DefaultTableModel( + new Object [][] { + {null, null, null, null}, + {null, null, null, null}, + {null, null, null, null}, + {null, null, null, null} + }, + new String [] { + "Title 1", "Title 2", "Title 3", "Title 4" + } + )); + client_table.addMouseListener(new java.awt.event.MouseAdapter() { + public void mouseClicked(java.awt.event.MouseEvent evt) { + client_tableMouseClicked(evt); + } + }); + jScrollPane1.setViewportView(client_table); + + jScrollPane2.setViewportView(jScrollPane1); + + jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Serach Supplier", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 12), new java.awt.Color(0, 51, 153))); // NOI18N + + search.setBackground(new java.awt.Color(153, 204, 255)); + search.addKeyListener(new java.awt.event.KeyAdapter() { + public void keyReleased(java.awt.event.KeyEvent evt) { + searchKeyReleased(evt); + } + }); + + javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); + jPanel3.setLayout(jPanel3Layout); + jPanel3Layout.setHorizontalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addGap(35, 35, 35) + .addComponent(search, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(37, Short.MAX_VALUE)) + ); + jPanel3Layout.setVerticalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addComponent(search, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + jMenu3.setText("File"); + jMenu3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenu3ActionPerformed(evt); + } + }); + + jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem1.setText("New"); + jMenu3.add(jMenuItem1); + jMenu3.add(jSeparator1); + + jMenuItem2.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/close.png"))); // NOI18N + jMenuItem2.setText("Close"); + jMenuItem2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem2ActionPerformed(evt); + } + }); + jMenu3.add(jMenuItem2); + + jMenuItem4.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_E, java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem4.setText("Exit"); + jMenuItem4.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem4ActionPerformed(evt); + } + }); + jMenu3.add(jMenuItem4); + + jMenuBar2.add(jMenu3); + + jMenu4.setText("Edit"); + jMenuBar2.add(jMenu4); + + date.setText("Date"); + jMenuBar2.add(date); + + setJMenuBar(jMenuBar2); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(19, 19, 19) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(30, 30, 30) + .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 409, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(20, 20, 20) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.LEADING, 0, 0, Short.MAX_VALUE) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(54, 54, 54) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + pack(); + }// //GEN-END:initComponents + + private void saveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveActionPerformed + + PreparedStatement pst; + + DataBase_connect obj=new DataBase_connect(); + + Connection conn=obj.Open(); + + try{ + //String sql="insert into client_info values(?,?,?,?)"; + String val=((JTextField)txt_date.getDateEditor().getUiComponent()).getText(); + String sql="insert into client_info(id,name,address,contact,datee) values (NULL,'" + txt_name.getText() + "','" + txt_address.getText() + "','" + txt_contact.getText() + "','"+val+ "')"; + pst=(PreparedStatement) conn.prepareStatement(sql); + pst.execute(); + JOptionPane.showMessageDialog(null, "Saved"); + }catch(Exception e){ + JOptionPane.showMessageDialog(null, e); + }finally { + try { + conn.close();System.out.println("disconnected"); + } catch (SQLException ex) { + Logger.getLogger(client_info.class.getName()).log(Level.SEVERE, null, ex); + } + } + + update_table(); + + }//GEN-LAST:event_saveActionPerformed + + private void deleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteActionPerformed + int p=JOptionPane.showConfirmDialog(null, "Do you really want to delete","delete",JOptionPane.YES_NO_OPTION); + if(p==0){ + PreparedStatement pst; + + DataBase_connect obj=new DataBase_connect(); + + Connection conn=obj.Open(); + String sql="delete from client_info where id=?"; + try{ + pst=conn.prepareStatement(sql); + pst.setString(1, txt_id.getText()); + pst.execute(); + JOptionPane.showMessageDialog(null, "deleted"); + + }catch(Exception e){ + JOptionPane.showMessageDialog(null, e); + }finally { + try { + conn.close();System.out.println("disconnected"); + } catch (SQLException ex) { + Logger.getLogger(client_info.class.getName()).log(Level.SEVERE, null, ex); + } + + update_table(); + + } + } + }//GEN-LAST:event_deleteActionPerformed + + private void updateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_updateActionPerformed + + PreparedStatement pst; + + DataBase_connect obj=new DataBase_connect(); + + Connection conn=obj.Open(); + + try{ + String val=((JTextField)txt_date.getDateEditor().getUiComponent()).getText(); + String sql="update client_info set name='" + txt_name.getText() + "',address='" + txt_address.getText() + "',contact='" + txt_contact.getText() +"',datee='" +val+ "' where id='" + txt_id.getText() + "'"; + pst=(PreparedStatement) conn.prepareStatement(sql); + pst.execute(); + JOptionPane.showMessageDialog(null, "Updated"); + }catch(Exception e){ + JOptionPane.showMessageDialog(null, e); + }finally { + try { + conn.close();System.out.println("disconnected"); + } catch (SQLException ex) { + Logger.getLogger(client_info.class.getName()).log(Level.SEVERE, null, ex); + } + } + + update_table(); + + }//GEN-LAST:event_updateActionPerformed + + private void clearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clearActionPerformed + txt_id.setText(""); + txt_name.setText(""); + txt_address.setText(""); + txt_contact.setText(""); + txt_date.setDate(null); + + }//GEN-LAST:event_clearActionPerformed + + private void searchKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_searchKeyReleased + + PreparedStatement pst; + + DataBase_connect obj=new DataBase_connect(); + + Connection conn=obj.Open(); + + try{ + + String sql="select * from client_info where name=?"; + pst=conn.prepareStatement(sql); + pst.setString(1, search.getText()); + rs=pst.executeQuery(); + if(rs.next()){ + String add1=rs.getString("id"); + txt_id.setText(add1); + String add2=rs.getString("name"); + txt_name.setText(add2); + String add3=rs.getString("address"); + txt_address.setText(add3); + String add4=rs.getString("contact"); + txt_contact.setText(add4); + + } + }catch(Exception e){ + + } + + try{ + String sql="select * from client_info where id=?"; + pst=conn.prepareStatement(sql); + pst.setString(1, search.getText()); + rs=pst.executeQuery(); + if(rs.next()){ + String add1=rs.getString("id"); + txt_id.setText(add1); + String add2=rs.getString("name"); + txt_name.setText(add2); + String add3=rs.getString("address"); + txt_address.setText(add3); + String add4=rs.getString("contact"); + txt_contact.setText(add4); + + } + }catch(Exception e){ + + } finally { + try { + conn.close();System.out.println("disconnected"); + } catch (SQLException ex) { + Logger.getLogger(client_info.class.getName()).log(Level.SEVERE, null, ex); + } + } + + }//GEN-LAST:event_searchKeyReleased + + private void jMenu3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu3ActionPerformed + +}//GEN-LAST:event_jMenu3ActionPerformed + + private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed + System.exit(0); +}//GEN-LAST:event_jMenuItem4ActionPerformed + + private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed + close(); +}//GEN-LAST:event_jMenuItem2ActionPerformed + + private void client_tableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_client_tableMouseClicked + + PreparedStatement pst; + + DataBase_connect obj=new DataBase_connect(); + + Connection conn=obj.Open(); + + try{ + int row=client_table.getSelectedRow(); + String table_click=client_table.getModel().getValueAt(row, 0).toString(); + String sql="select * from client_info where id ='"+table_click+"'"; + pst=conn.prepareStatement(sql); + rs=pst.executeQuery(); + if(rs.next()) + { + String add1=rs.getString("id"); + txt_id.setText(add1); + String add2=rs.getString("name"); + txt_name.setText(add2); + String add3=rs.getString("address"); + txt_address.setText(add3); + String add4=rs.getString("contact"); + txt_contact.setText(add4); + + String ad=rs.getObject("datee").toString(); + java.util.Date dat = new SimpleDateFormat("yyyy-MM-dd").parse(ad); + txt_date.setDate(dat); + } + }catch(Exception e){ + JOptionPane.showMessageDialog(null, e); + }finally { + try { + conn.close();System.out.println("disconnected"); + } catch (SQLException ex) { + Logger.getLogger(client_info.class.getName()).log(Level.SEVERE, null, ex); + } + } + + update_table(); + + }//GEN-LAST:event_client_tableMouseClicked + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + /*if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + }*/ + UIManager.setLookAndFeel("com.jtattoo.plaf.smart.SmartLookAndFeel"); + // UIManager.setLookAndFeel("com.jtattoo.plaf.acryl.AcrylLookAndFeel"); + //UIManager.setLookAndFeel("com.jtattoo.plaf.aero.AeroLookAndFeel"); + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(StockEntry.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(StockEntry.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(StockEntry.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(StockEntry.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new Supplier_info().setVisible(true); + } + }); + } + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton clear; + private javax.swing.JTable client_table; + private javax.swing.JMenu date; + private javax.swing.JButton delete; + 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 javax.swing.JLabel jLabel6; + 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; + private javax.swing.JMenuBar jMenuBar2; + private javax.swing.JMenuItem jMenuItem1; + private javax.swing.JMenuItem jMenuItem2; + private javax.swing.JMenuItem jMenuItem4; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel2; + private javax.swing.JPanel jPanel3; + private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JScrollPane jScrollPane2; + private javax.swing.JPopupMenu.Separator jSeparator1; + private java.awt.Menu menu1; + private java.awt.Menu menu2; + private java.awt.Menu menu3; + private java.awt.Menu menu4; + private java.awt.MenuBar menuBar1; + private java.awt.MenuBar menuBar2; + private javax.swing.JButton save; + private javax.swing.JTextField search; + private javax.swing.JTextField txt_address; + private javax.swing.JTextField txt_contact; + private com.toedter.calendar.JDateChooser txt_date; + private javax.swing.JTextField txt_id; + private javax.swing.JTextField txt_name; + private javax.swing.JTextField txt_pro_name; + private javax.swing.JButton update; + // End of variables declaration//GEN-END:variables +} diff --git a/ST2-Project-master/src/client_info.form b/ST2-Project-master/src/client_info.form new file mode 100644 index 0000000..42e3ed0 --- /dev/null +++ b/ST2-Project-master/src/client_info.form @@ -0,0 +1,642 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ diff --git a/ST2-Project-master/src/client_info.java b/ST2-Project-master/src/client_info.java new file mode 100644 index 0000000..78883dc --- /dev/null +++ b/ST2-Project-master/src/client_info.java @@ -0,0 +1,994 @@ + + + +import com.sun.java.swing.plaf.windows.WindowsTreeUI.CollapsedIcon; +import java.awt.*; +import java.awt.event.KeyEvent; +import java.awt.event.WindowEvent; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.text.MessageFormat; +import java.text.SimpleDateFormat; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.swing.*; +import net.proteanit.sql.DbUtils; +import java.util.Calendar; +import java.util.GregorianCalendar; + + +public class client_info extends javax.swing.JFrame { + + Connection conn=null; + ResultSet rs=null; + PreparedStatement pst=null; + public client_info() + { + initComponents(); + + set_client_id(); + + update_table(); + + + } + public void close(){ + WindowEvent winclosingevent=new WindowEvent(this,WindowEvent.WINDOW_CLOSING); + Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(winclosingevent); + } + + private void set_client_id() + { + + PreparedStatement pst; + + DataBase_connect obj=new DataBase_connect(); + + Connection conn=obj.Open(); + + try { + + String sql="select max_id from variable_table"; + pst=(PreparedStatement) conn.prepareStatement(sql); + System.out.println("aaaaaaa"); + rs=pst.executeQuery(sql); + System.out.println("cfjl"); + if(rs.next()) + { + int num=rs.getInt(1) + 1; + txt_id.setText(""+num); + } + }catch(Exception e) { + System.out.println("max id te exception "+e); + } + + try { + conn.close(); + } catch (SQLException ex) { + Logger.getLogger(client_info.class.getName()).log(Level.SEVERE, null, ex); + } + + } + + private void update_table() { + + PreparedStatement pst; + + DataBase_connect obj=new DataBase_connect(); + + Connection conn=obj.Open(); + + try{ + String sql="select id,name,address,contact,datee from client_info"; + pst=conn.prepareStatement(sql); + rs=pst.executeQuery(); + client_table.setModel(DbUtils.resultSetToTableModel(rs)); + }catch(Exception e){ + JOptionPane.showMessageDialog(null, e); + }finally { + try { + conn.close(); + System.out.println("disconnected"); + } catch (SQLException ex) { + Logger.getLogger(client_info.class.getName()).log(Level.SEVERE, null, ex); + } + } + + } + + public void Searching(){ + + int flg=0; + + PreparedStatement pst; + + DataBase_connect obj=new DataBase_connect(); + + Connection conn=obj.Open(); + + try{ + + String sql="select * from client_info where name=?"; + pst=conn.prepareStatement(sql); + pst.setString(1, search.getText()); + rs=pst.executeQuery(); + if(rs.next() ){ + flg=1; + String add1=rs.getString("id"); + txt_id.setText(add1); + String add2=rs.getString("name"); + txt_name.setText(add2); + String add3=rs.getString("address"); + txt_address.setText(add3); + String add4=rs.getString("contact"); + txt_contact.setText(add4); + + String ad=rs.getObject("datee").toString(); + java.util.Date dat = new SimpleDateFormat("yyyy-MM-dd").parse(ad); + txt_date.setDate(dat); + + } + else { + set_client_id(); + + txt_name.setText(""); + txt_address.setText(""); + txt_contact.setText(""); + txt_date.setDate(null); + } + }catch(Exception e){ + + } + + try{ + String sql="select * from client_info where id=?"; + pst=conn.prepareStatement(sql); + pst.setString(1, search.getText()); + rs=pst.executeQuery(); + if(rs.next() && flg==0){ + String add1=rs.getString("id"); + txt_id.setText(add1); + String add2=rs.getString("name"); + txt_name.setText(add2); + String add3=rs.getString("address"); + txt_address.setText(add3); + String add4=rs.getString("contact"); + txt_contact.setText(add4); + + String ad=rs.getObject("datee").toString(); + java.util.Date dat = new SimpleDateFormat("yyyy-MM-dd").parse(ad); + txt_date.setDate(dat); + + } + else if(flg==0){ + flg=1; + set_client_id(); + + txt_name.setText(""); + txt_address.setText(""); + txt_contact.setText(""); + txt_date.setDate(null); + } + + }catch(Exception e){ + + } finally { + try { + conn.close();System.out.println("disconnected"); + } catch (SQLException ex) { + Logger.getLogger(client_info.class.getName()).log(Level.SEVERE, null, ex); + } + } + + + } + + + + + /** + * 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") + // //GEN-BEGIN:initComponents + private void initComponents() { + + menuBar1 = new java.awt.MenuBar(); + menu1 = new java.awt.Menu(); + menu2 = new java.awt.Menu(); + menuBar2 = new java.awt.MenuBar(); + menu3 = new java.awt.Menu(); + menu4 = new java.awt.Menu(); + jPanel1 = new javax.swing.JPanel(); + update = new javax.swing.JButton(); + save = new javax.swing.JButton(); + clear = new javax.swing.JButton(); + delete = new javax.swing.JButton(); + jButton1 = new javax.swing.JButton(); + jPanel2 = new javax.swing.JPanel(); + jLabel1 = new javax.swing.JLabel(); + txt_address = new javax.swing.JTextField(); + jLabel2 = new javax.swing.JLabel(); + txt_id = new javax.swing.JTextField(); + jLabel4 = new javax.swing.JLabel(); + txt_name = new javax.swing.JTextField(); + jLabel3 = new javax.swing.JLabel(); + txt_contact = new javax.swing.JTextField(); + jLabel5 = new javax.swing.JLabel(); + txt_date = new com.toedter.calendar.JDateChooser(); + jScrollPane2 = new javax.swing.JScrollPane(); + jScrollPane1 = new javax.swing.JScrollPane(); + client_table = new javax.swing.JTable(); + jPanel3 = new javax.swing.JPanel(); + search = new javax.swing.JTextField(); + jLabel6 = new javax.swing.JLabel(); + jToolBar2 = new javax.swing.JToolBar(); + jButton8 = new javax.swing.JButton(); + jButton2 = new javax.swing.JButton(); + jButton3 = new javax.swing.JButton(); + jButton4 = new javax.swing.JButton(); + jButton5 = new javax.swing.JButton(); + jButton6 = new javax.swing.JButton(); + jButton9 = new javax.swing.JButton(); + jButton7 = new javax.swing.JButton(); + jButton10 = new javax.swing.JButton(); + jMenuBar1 = new javax.swing.JMenuBar(); + jMenu1 = new javax.swing.JMenu(); + jMenuItem1 = new javax.swing.JMenuItem(); + jMenuItem2 = new javax.swing.JMenuItem(); + jMenuItem3 = new javax.swing.JMenuItem(); + jMenuItem4 = new javax.swing.JMenuItem(); + jMenuItem5 = new javax.swing.JMenuItem(); + + menu1.setLabel("File"); + menuBar1.add(menu1); + + menu2.setLabel("Edit"); + menuBar1.add(menu2); + + menu3.setLabel("File"); + menuBar2.add(menu3); + + menu4.setLabel("Edit"); + menuBar2.add(menu4); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + + jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Options", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 14), new java.awt.Color(0, 51, 153))); // NOI18N + + update.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/update.png"))); // NOI18N + update.setText("Update"); + update.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + updateActionPerformed(evt); + } + }); + + save.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/add.png"))); // NOI18N + save.setText("Save"); + save.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + saveActionPerformed(evt); + } + }); + + clear.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/clear.png"))); // NOI18N + clear.setText("Clear"); + clear.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + clearActionPerformed(evt); + } + }); + + delete.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/close.png"))); // NOI18N + delete.setText("Delete"); + delete.setToolTipText("delete the selected row"); + delete.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + deleteActionPerformed(evt); + } + }); + + jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/print-icon.png"))); // NOI18N + jButton1.setText("Print"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(save, javax.swing.GroupLayout.DEFAULT_SIZE, 87, Short.MAX_VALUE) + .addComponent(update, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(clear, javax.swing.GroupLayout.DEFAULT_SIZE, 87, Short.MAX_VALUE) + .addComponent(delete, javax.swing.GroupLayout.DEFAULT_SIZE, 87, Short.MAX_VALUE) + .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, 87, Short.MAX_VALUE)) + .addContainerGap()) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addComponent(save) + .addGap(18, 18, 18) + .addComponent(delete) + .addGap(18, 18, 18) + .addComponent(update) + .addGap(18, 18, 18) + .addComponent(clear) + .addGap(18, 18, 18) + .addComponent(jButton1) + .addGap(32, 32, 32)) + ); + + jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Client Information", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 1, 14), new java.awt.Color(0, 102, 153))); // NOI18N + + jLabel1.setText("Client ID"); + + jLabel2.setText("Name"); + + txt_id.setEditable(false); + + jLabel4.setText("Contact"); + + jLabel3.setText("Address"); + + jLabel5.setText("Date "); + + txt_date.setDateFormatString("yyyy-MM-dd"); + + javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); + jPanel2.setLayout(jPanel2Layout); + jPanel2Layout.setHorizontalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel1) + .addComponent(jLabel2) + .addComponent(jLabel3) + .addComponent(jLabel4) + .addComponent(jLabel5)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(txt_date, javax.swing.GroupLayout.DEFAULT_SIZE, 146, Short.MAX_VALUE) + .addComponent(txt_contact, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 146, Short.MAX_VALUE) + .addComponent(txt_address, javax.swing.GroupLayout.DEFAULT_SIZE, 146, Short.MAX_VALUE) + .addComponent(txt_name, javax.swing.GroupLayout.DEFAULT_SIZE, 146, Short.MAX_VALUE) + .addComponent(txt_id, javax.swing.GroupLayout.DEFAULT_SIZE, 146, Short.MAX_VALUE)) + .addContainerGap()) + ); + jPanel2Layout.setVerticalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel1) + .addComponent(txt_id, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2) + .addComponent(txt_name, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addComponent(jLabel3) + .addGap(47, 47, 47) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel4) + .addComponent(txt_contact, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addComponent(txt_address, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 34, Short.MAX_VALUE) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel5) + .addComponent(txt_date, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap()) + ); + + client_table.setModel(new javax.swing.table.DefaultTableModel( + new Object [][] { + {null, null, null, null}, + {null, null, null, null}, + {null, null, null, null}, + {null, null, null, null} + }, + new String [] { + "Title 1", "Title 2", "Title 3", "Title 4" + } + )); + client_table.addMouseListener(new java.awt.event.MouseAdapter() { + public void mouseClicked(java.awt.event.MouseEvent evt) { + client_tableMouseClicked(evt); + } + }); + jScrollPane1.setViewportView(client_table); + + jScrollPane2.setViewportView(jScrollPane1); + + jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Serach", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 14), new java.awt.Color(0, 51, 153))); // NOI18N + + search.setBackground(new java.awt.Color(153, 204, 255)); + search.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + searchActionPerformed(evt); + } + }); + search.addKeyListener(new java.awt.event.KeyAdapter() { + public void keyReleased(java.awt.event.KeyEvent evt) { + searchKeyReleased(evt); + } + }); + + jLabel6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/search-icon.png"))); // NOI18N + + javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); + jPanel3.setLayout(jPanel3Layout); + jPanel3Layout.setHorizontalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addGap(4, 4, 4) + .addComponent(jLabel6) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(search, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + jPanel3Layout.setVerticalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(search, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel6)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + jToolBar2.setRollover(true); + + jButton8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/1-Normal-Home-icon.png"))); // NOI18N + jButton8.setText("Home"); + jButton8.setFocusable(false); + jButton8.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton8.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton8.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton8ActionPerformed(evt); + } + }); + jToolBar2.add(jButton8); + + jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/new32.png"))); // NOI18N + jButton2.setText("New Client"); + jButton2.setFocusable(false); + jButton2.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton2.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jToolBar2.add(jButton2); + + jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/money-icon.png"))); // NOI18N + jButton3.setText("Transaction"); + jButton3.setFocusable(false); + jButton3.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton3.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton3.addMouseListener(new java.awt.event.MouseAdapter() { + public void mouseClicked(java.awt.event.MouseEvent evt) { + jButton3MouseClicked(evt); + } + }); + jButton3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton3ActionPerformed(evt); + } + }); + jToolBar2.add(jButton3); + + jButton4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/Collection-2-icon.png"))); // NOI18N + jButton4.setText("Collection"); + jButton4.setFocusable(false); + jButton4.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton4.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton4.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton4ActionPerformed(evt); + } + }); + jToolBar2.add(jButton4); + + jButton5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/print32.png"))); // NOI18N + jButton5.setText("Print"); + jButton5.setFocusable(false); + jButton5.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton5.setMaximumSize(new java.awt.Dimension(57, 57)); + jButton5.setMinimumSize(new java.awt.Dimension(57, 57)); + jButton5.setPreferredSize(new java.awt.Dimension(57, 57)); + jButton5.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton5.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton5ActionPerformed(evt); + } + }); + jToolBar2.add(jButton5); + + jButton6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/Calendar-icon.png"))); // NOI18N + jButton6.setText("Calender"); + jButton6.setFocusable(false); + jButton6.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton6.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton6.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton6ActionPerformed(evt); + } + }); + jToolBar2.add(jButton6); + + jButton9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/Button-Refresh-icon.png"))); // NOI18N + jButton9.setText("Refresh"); + jButton9.setFocusable(false); + jButton9.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton9.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jToolBar2.add(jButton9); + + jButton7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/search-icon.png"))); // NOI18N + jButton7.setText("Search"); + jButton7.setFocusable(false); + jButton7.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton7.setMaximumSize(new java.awt.Dimension(57, 57)); + jButton7.setMinimumSize(new java.awt.Dimension(57, 57)); + jButton7.setPreferredSize(new java.awt.Dimension(57, 57)); + jButton7.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jToolBar2.add(jButton7); + + jButton10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/close32.png"))); // NOI18N + jButton10.setText("Close"); + jButton10.setFocusable(false); + jButton10.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton10.setMaximumSize(new java.awt.Dimension(57, 57)); + jButton10.setMinimumSize(new java.awt.Dimension(57, 57)); + jButton10.setPreferredSize(new java.awt.Dimension(57, 57)); + jButton10.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jToolBar2.add(jButton10); + + jMenu1.setText("Option"); + + jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_H, java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/house-icon.png"))); // NOI18N + jMenuItem1.setText("Home"); + jMenuItem1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem1ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem1); + + jMenuItem2.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/new1.png"))); // NOI18N + jMenuItem2.setText("New Client"); + jMenuItem2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem2ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem2); + + jMenuItem3.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/money-icon (1).png"))); // NOI18N + jMenuItem3.setText("Transection"); + jMenuItem3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem3ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem3); + + jMenuItem4.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/Collection-2-icon (1).png"))); // NOI18N + jMenuItem4.setText("Collection"); + jMenuItem4.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem4ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem4); + + jMenuItem5.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Data/close1.png"))); // NOI18N + jMenuItem5.setText("Close"); + jMenuItem5.addMouseListener(new java.awt.event.MouseAdapter() { + public void mouseClicked(java.awt.event.MouseEvent evt) { + jMenuItem5MouseClicked(evt); + } + }); + jMenuItem5.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem5ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem5); + + jMenuBar1.add(jMenu1); + + setJMenuBar(jMenuBar1); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(19, 19, 19) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGap(18, 18, 18) + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18, Short.MAX_VALUE) + .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 425, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(jToolBar2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addComponent(jToolBar2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 412, Short.MAX_VALUE) + .addGroup(layout.createSequentialGroup() + .addGap(17, 17, 17) + .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(50, 50, 50) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 270, Short.MAX_VALUE) + .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) + .addGap(32, 32, 32)) + ); + + java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); + setBounds((screenSize.width-844)/2, (screenSize.height-547)/2, 844, 547); + }// //GEN-END:initComponents + + private void saveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveActionPerformed + + PreparedStatement pst; + + DataBase_connect obj=new DataBase_connect(); + + Connection conn=obj.Open(); + + try{ + //max_id upadate + + String sql="select max_id from variable_table"; + pst=(PreparedStatement) conn.prepareStatement(sql); + rs=pst.executeQuery(sql); + int num=0; + if(rs.next()) + { + num=rs.getInt(1)+1; + sql="UPDATE variable_table SET max_id='" + num +"'"; + pst=(PreparedStatement) conn.prepareStatement(sql); + pst.execute(); + } + num++; + + + String val=((JTextField)txt_date.getDateEditor().getUiComponent()).getText(); + sql="insert into client_info(id,name,address,contact,datee) values (NULL,'" + txt_name.getText() + "','" + txt_address.getText() + "','" + txt_contact.getText() + "','"+val+ "')"; + pst=(PreparedStatement) conn.prepareStatement(sql); + pst.execute(); + JOptionPane.showMessageDialog(null, "Saved"); + + txt_id.setText(""+num); //String sql="insert into client_info values(?,?,?,?)"; + txt_name.setText(""); + txt_address.setText(""); + txt_contact.setText(""); + txt_date.setDate(null); + + }catch(Exception e){ + JOptionPane.showMessageDialog(null, e); + }finally { + try { + conn.close(); + System.out.println("disconnected"); + } catch (SQLException ex) { + Logger.getLogger(client_info.class.getName()).log(Level.SEVERE, null, ex); + } + } + + update_table(); + + }//GEN-LAST:event_saveActionPerformed + + private void deleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteActionPerformed + int p=JOptionPane.showConfirmDialog(null, "Do you really want to delete","delete",JOptionPane.YES_NO_OPTION); + if(p==0){ + PreparedStatement pst; + + DataBase_connect obj=new DataBase_connect(); + + Connection conn=obj.Open(); + String sql="delete from client_info where id=?"; + try{ + pst=conn.prepareStatement(sql); + pst.setString(1, txt_id.getText()); + pst.execute(); + JOptionPane.showMessageDialog(null, "deleted"); + + }catch(Exception e){ + JOptionPane.showMessageDialog(null, e); + }finally { + try { + conn.close();System.out.println("disconnected"); + } catch (SQLException ex) { + Logger.getLogger(client_info.class.getName()).log(Level.SEVERE, null, ex); + } + + update_table(); + + } + } + }//GEN-LAST:event_deleteActionPerformed + + private void updateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_updateActionPerformed + + PreparedStatement pst; + + DataBase_connect obj=new DataBase_connect(); + + Connection conn=obj.Open(); + + try{ + String val=((JTextField)txt_date.getDateEditor().getUiComponent()).getText(); + String sql="update client_info set name='" + txt_name.getText() + "',address='" + txt_address.getText() + "',contact='" + txt_contact.getText() +"',datee='" +val+ "' where id='" + txt_id.getText() + "'"; + pst=(PreparedStatement) conn.prepareStatement(sql); + pst.execute(); + JOptionPane.showMessageDialog(null, "Updated"); + }catch(Exception e){ + JOptionPane.showMessageDialog(null, e); + }finally { + try { + conn.close();System.out.println("disconnected"); + } catch (SQLException ex) { + Logger.getLogger(client_info.class.getName()).log(Level.SEVERE, null, ex); + } + } + + update_table(); + + }//GEN-LAST:event_updateActionPerformed + + private void clearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clearActionPerformed + + set_client_id(); + + txt_name.setText(""); + txt_address.setText(""); + txt_contact.setText(""); + txt_date.setDate(null); + + }//GEN-LAST:event_clearActionPerformed + + private void client_tableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_client_tableMouseClicked + + PreparedStatement pst; + + DataBase_connect obj=new DataBase_connect(); + + Connection conn=obj.Open(); + + try{ + int row=client_table.getSelectedRow(); + String table_click=client_table.getModel().getValueAt(row, 0).toString(); + String sql="select * from client_info where id ='"+table_click+"'"; + pst=conn.prepareStatement(sql); + rs=pst.executeQuery(); + if(rs.next()) + { + String add1=rs.getString("id"); + txt_id.setText(add1); + String add2=rs.getString("name"); + txt_name.setText(add2); + String add3=rs.getString("address"); + txt_address.setText(add3); + String add4=rs.getString("contact"); + txt_contact.setText(add4); + + String ad=rs.getObject("datee").toString(); + java.util.Date dat = new SimpleDateFormat("yyyy-MM-dd").parse(ad); + txt_date.setDate(dat); + } + }catch(Exception e){ + JOptionPane.showMessageDialog(null, e); + }finally { + try { + conn.close();System.out.println("disconnected"); + } catch (SQLException ex) { + Logger.getLogger(client_info.class.getName()).log(Level.SEVERE, null, ex); + } + } + + update_table(); + + }//GEN-LAST:event_client_tableMouseClicked + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + + MessageFormat header=new MessageFormat("Report Print"); + MessageFormat footer=new MessageFormat("Page{0,number,integer}"); + try{ + client_table.print(JTable.PrintMode.NORMAL,header,footer); + }catch(Exception e){ + + } + + }//GEN-LAST:event_jButton1ActionPerformed + + private void jMenuItem5MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenuItem5MouseClicked + System.exit(0); +}//GEN-LAST:event_jMenuItem5MouseClicked + + private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed + System.exit(0); +}//GEN-LAST:event_jMenuItem5ActionPerformed + + private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed + + this.dispose(); + + new Delivery().setVisible(true); + + }//GEN-LAST:event_jButton3ActionPerformed + + private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed + + this.dispose(); + + new Collection_tab().setVisible(true); + + }//GEN-LAST:event_jButton4ActionPerformed + + private void jButton3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton3MouseClicked + this.dispose(); + new Delivery().setVisible(true); + }//GEN-LAST:event_jButton3MouseClicked + + private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed + this.dispose(); + new HomePage().setVisible(true); + }//GEN-LAST:event_jButton8ActionPerformed + + private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed + this.dispose(); + new HomePage().setVisible(true); + }//GEN-LAST:event_jMenuItem1ActionPerformed + + private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed + this.dispose(); + + new Collection().setVisible(true); + }//GEN-LAST:event_jMenuItem4ActionPerformed + + private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed + this.dispose(); + + new Delivery().setVisible(true); + }//GEN-LAST:event_jMenuItem3ActionPerformed + + private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed + this.dispose(); + + new client_info().setVisible(true); + }//GEN-LAST:event_jMenuItem2ActionPerformed + + private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed + + this.dispose(); + + new MyCalender().setVisible(true); + + }//GEN-LAST:event_jButton6ActionPerformed + + private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed + + this.dispose(); + + new Client_page().setVisible(true); + + }//GEN-LAST:event_jButton5ActionPerformed + + private void searchKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_searchKeyReleased + Searching(); + }//GEN-LAST:event_searchKeyReleased + + private void searchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_searchActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + /*if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + }*/ + //UIManager.setLookAndFeel("com.jtattoo.plaf.smart.SmartLookAndFeel"); + //UIManager.setLookAndFeel("com.jtattoo.plaf.acryl.AcrylLookAndFeel"); + UIManager.setLookAndFeel("com.jtattoo.plaf.aero.AeroLookAndFeel"); + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(StockEntry.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(StockEntry.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(StockEntry.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(StockEntry.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new client_info().setVisible(true); + } + }); + } + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton clear; + private javax.swing.JTable client_table; + private javax.swing.JButton delete; + private javax.swing.JButton jButton1; + private javax.swing.JButton jButton10; + private javax.swing.JButton jButton2; + private javax.swing.JButton jButton3; + private javax.swing.JButton jButton4; + private javax.swing.JButton jButton5; + private javax.swing.JButton jButton6; + private javax.swing.JButton jButton7; + private javax.swing.JButton jButton8; + private javax.swing.JButton jButton9; + 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 javax.swing.JLabel jLabel6; + private javax.swing.JMenu jMenu1; + private javax.swing.JMenuBar jMenuBar1; + private javax.swing.JMenuItem jMenuItem1; + private javax.swing.JMenuItem jMenuItem2; + private javax.swing.JMenuItem jMenuItem3; + private javax.swing.JMenuItem jMenuItem4; + private javax.swing.JMenuItem jMenuItem5; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel2; + private javax.swing.JPanel jPanel3; + private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JScrollPane jScrollPane2; + private javax.swing.JToolBar jToolBar2; + private java.awt.Menu menu1; + private java.awt.Menu menu2; + private java.awt.Menu menu3; + private java.awt.Menu menu4; + private java.awt.MenuBar menuBar1; + private java.awt.MenuBar menuBar2; + private javax.swing.JButton save; + private javax.swing.JTextField search; + private javax.swing.JTextField txt_address; + private javax.swing.JTextField txt_contact; + private com.toedter.calendar.JDateChooser txt_date; + private javax.swing.JTextField txt_id; + private javax.swing.JTextField txt_name; + private javax.swing.JButton update; + // End of variables declaration//GEN-END:variables +} diff --git a/ST2-Project-master/src/strtActivity.java b/ST2-Project-master/src/strtActivity.java new file mode 100644 index 0000000..5510421 --- /dev/null +++ b/ST2-Project-master/src/strtActivity.java @@ -0,0 +1,159 @@ +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.swing.*; +import java.awt.*; + + + +public class strtActivity extends JFrame { + + private String sss="Loading."; + private JFrame preloaderFrame; + private Container preloaderContainer; + private GridBagLayout preloaderLayout; + private GridBagConstraints preloaderConstraints; + private JLabel picJLabel = new JLabel(); + public static JLabel statusJLabel = new JLabel(); + private int picWidth, picHeight, x, y; + private static strtActivity frm; + private JLayeredPane layeredPane = new JLayeredPane(); + private Color fontcolororg = new Color(255, 197, 110, 255); + private Color fontcolorgray = new Color(124, 121, 118, 255); + + public strtActivity() { + + preloaderFrame = new JFrame("DataBase Project"); + preloaderFrame.setUndecorated(true); + preloaderFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + preloaderLayout = new GridBagLayout(); + preloaderConstraints = new GridBagConstraints(); + preloaderContainer = getContentPane(); + preloaderContainer.setLayout(preloaderLayout); + + layeredPane.setPreferredSize(new Dimension(435, 262)); + + Icon bug = new ImageIcon(getClass().getResource("/Data/preloader.png"), "Loading..."); + picJLabel = new JLabel(bug); + Font picJLabelfont = new java.awt.Font("Arial", 1, 18); + + picJLabel.setVerticalAlignment(JLabel.TOP); + picJLabel.setHorizontalAlignment(JLabel.LEFT); + //picJLabel.setBackground(Color.black); + //picJLabel.setForeground(fontcolororg); + //picJLabel.setBorder(BorderFactory.createLineBorder(Color.black)); + picJLabel.setBounds(0, 0, 435, 262); //X=232 + picJLabel.setFont(picJLabelfont); + layeredPane.add(picJLabel, new Integer(1)); + + statusJLabel = new JLabel("Loading.."); + Font statusJLabelfont = new java.awt.Font("Arial", Font.BOLD, 18); + + statusJLabel.setVerticalAlignment(JLabel.TOP); + statusJLabel.setHorizontalAlignment(JLabel.LEFT); + statusJLabel.setBackground(Color.black); + statusJLabel.setForeground(Color.white);//(fontcolorgray); + //statusJLabel.setBorder(BorderFactory.createLineBorder(Color.black)); + statusJLabel.setBounds(190, 225, 200, 40); //X=232 + statusJLabel.setFont(picJLabelfont); + layeredPane.add(statusJLabel, new Integer(2)); + + addComponent(layeredPane, 0, 0, 1, 1, 0, 0, GridBagConstraints.NONE); + preloaderFrame.add(preloaderContainer); + + + picHeight = bug.getIconHeight(); + picWidth = bug.getIconWidth(); + + Toolkit k = this.getToolkit(); + Dimension dim = k.getScreenSize(); + x = (int) (dim.width / 2) - (int) (picWidth / 2); + y = (int) (dim.height / 2) - (int) (picHeight / 2); + preloaderFrame.setBounds(x, y, picWidth, picHeight); + preloaderFrame.setVisible(true); + + } + + public void statusUpdate( ){ + sss +="."; + //System.out.println("slsl"); + statusJLabel.setText(sss); + } + + public void loading() + { + Thread t = new Thread(); + t.start(); + + for(int i=0;i<20;i++) + { + this.statusUpdate( ); + + try { + t.sleep(100); + } catch (InterruptedException ex) { + Logger.getLogger(strtActivity.class.getName()).log(Level.SEVERE, null, ex); + } + } + + if (t.isAlive() == false) { + try { + preloaderFrame.dispose(); + + } catch (Exception ex) { + Logger.getLogger(strtActivity.class.getName()).log(Level.SEVERE, null, ex); + } + + } + } + + private void addComponent(Component component, int row, int column, int width, int height, int weightx, int weighty, int fill) + { + preloaderConstraints.fill = fill; + preloaderConstraints.gridx = column; + preloaderConstraints.gridy = row; + + preloaderConstraints.gridwidth = width; + preloaderConstraints.gridheight = height; + + preloaderConstraints.weightx = weightx; + preloaderConstraints.weighty = weighty; + + preloaderConstraints.weightx = weightx; + preloaderConstraints.weighty = weighty; + // set mLoginConstraints and add component + preloaderLayout.setConstraints(component, preloaderConstraints); + preloaderContainer.add(component); + } + + public static void main(String[] args) + { + strtActivity preloaderFrame= new strtActivity(); + + preloaderFrame.loading(); + + try { + + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + /*if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + }*/ + UIManager.setLookAndFeel("com.jtattoo.plaf.smart.SmartLookAndFeel"); + UIManager.setLookAndFeel("com.jtattoo.plaf.acryl.AcrylLookAndFeel"); + UIManager.setLookAndFeel("com.jtattoo.plaf.aero.AeroLookAndFeel"); + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(StockEntry.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(StockEntry.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(StockEntry.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(StockEntry.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + + new Login_Frame().setVisible(true); + + } +} +