public void run() {
            int x = getWidth();
            int y = getHeight();

            while (x > 0 || y > 0) {
                x = x - min;
                y = y - min;
                setSize(x, y);
                try {
                    sleep(sleepa);
                } catch (InterruptedException ex) {
                    
                }

            }

        }
    }
    
    private void txtQ19ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtQ19ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtQ19ActionPerformed

    private void btnRefreshActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRefreshActionPerformed
        // TODO add your handling code here:

        String query1 = "select pID as 'ID', pName as 'Name', pSdate as 'Start Date', pEndDate as 'End Date',  pGsupplier as 'Global Supplier', pStatus as 'Project Status'  from project where pAvailability = 'YES' ";

        ResultSet result= db1.executeSQLQuery(query1);

        try {

            int columCount = 0;
            ResultSetMetaData rsmd = result.getMetaData();
            Vector myVector = new Vector();
            columCount = rsmd.getColumnCount();
            for (int i = 1; i <= columCount; i++) {
                myVector.add(rsmd.getColumnLabel(i));
            }
            DefaultTableModel amodel = new DefaultTableModel(myVector, 0)/*0=row count*/ {
                @Override
                public boolean isCellEditable(int row, int column) {
                    //all cells false
                    return false;
                }
            };

            while (result.next()) {
                String[] rowData = new String[columCount];
                for (int i = 1; i <= columCount; i++) {
                    if (i == 1) {
                        String id = result.getString(i);
                        rowData[i - 1] = id.toUpperCase();
                    } else {
                        rowData[i - 1] = result.getString(i);
                    }
                }
                amodel.addRow(rowData);
            }

            tableSummaryProjects.setModel(amodel);

        } catch (Exception e) {
            JOptionPane.showMessageDialog(this, "Error in Showing Data", "METROPOLITAN ENGINEERING (PVT) LTD", 1);
        }
        
        
        
        
    }//GEN-LAST:event_btnRefreshActionPerformed

    private void btnAddProjectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddProjectActionPerformed
        // TODO add your handling code here:
      /*  
        String n = "fdsa";
       
        System.out.println(n);
        
        Date date;
date = this.date1.getDate();

if(date == null)
    System.out.println(n);
else
    System.out.println(this.date1.getDate().toString());

*/
        
        Color normal=new Color(255, 255, 255);//white normal colour
        Color error=new Color(255, 255, 153);
        this.txtProName.setBackground(normal);
        
        
            String pID = this.txtProID.getText().toString();
            String pName =this.txtProName.getText().toString(); 
            String pSdate = this.txtToday.getText().toString();
            
            String pGsupplier = this.cmbSuppGlobal.getSelectedItem().toString();
            String pStatus = "pending";
            String pAvailability = "YES";
            
           
            
            //String endDate = getDateInString(this.jDateChooser1.getDate());
        
        if(this.txtProName.getText().equals(""))
        {
            
            this.txtProName.setBackground(error);
            JOptionPane.showMessageDialog(null, "Insert Project Name","METROPOLITAN ENGINEERING (PVT) LTD", 1);
            
        }
        else
        {
            if(this.txtItem1.getText().equals("") && this.txtItem2.getText().equals("") && this.txtItem3.getText().equals("") && this.txtItem4.getText().equals("") && this.txtItem5.getText().equals("") && this.txtItem6.getText().equals("") && this.txtItem7.getText().equals("") && this.txtItem8.getText().equals("") && this.txtItem9.getText().equals("") && this.txtItem10.getText().equals("") )
            {
                JOptionPane.showMessageDialog(null, "This project has no components! Insert atleast one component to continue!","METROPOLITAN ENGINEERING (PVT) LTD", 1);
            }
            else
            {
                
                if(this.jDateChooser1.getDate()==null)
                {
                    JOptionPane.showMessageDialog(null, "Please insert an Ending Date", "METROPOLITAN ENGINEERING (PVT) LTD", 1);
                    
                }
                else
                {
                
                String endDate = getDateInString(this.jDateChooser1.getDate());

                Date dates[] = new Date[10];
                
                try
                {
                    dates[0] = this.date1.getDate();
                    dates[1] = this.date2.getDate();
                    dates[2] = this.date3.getDate();
                    dates[3] = this.date4.getDate();
                    dates[4] = this.date5.getDate();
                    dates[5] = this.date6.getDate();
                    dates[6] = this.date7.getDate();
                    dates[7] = this.date8.getDate();
                    dates[8] = this.date9.getDate();
                    dates[9] = this.date10.getDate();
                }
                catch(Exception e)
                {
                    System.out.println(e.getMessage());
                }
                
                String datee[] = new String[10];
                datee[0] = "00/00/00";
                datee[1] = "00/00/00";
                datee[2] = "00/00/00";
                datee[3] = "00/00/00";
                datee[4] = "00/00/00";
                datee[5] = "00/00/00";
                datee[6] = "00/00/00";
                datee[7] = "00/00/00";
                datee[8] = "00/00/00";
                datee[9] = "00/00/00";

                
                
                
                String qty[] = new String[10];
                qty[0] = this.txtQ1.getText().toString();
                qty[1] = this.txtQ2.getText().toString();
                qty[2] = this.txtQ3.getText().toString();
                qty[3] = this.txtQ4.getText().toString();
                qty[4] = this.txtQ5.getText().toString();
                qty[5] = this.txtQ6.getText().toString();
                qty[6] = this.txtQ7.getText().toString();
                qty[7] = this.txtQ8.getText().toString();
                qty[8] = this.txtQ9.getText().toString();
                qty[9] = this.txtQ10.getText().toString();
                
                String item[] = new String[10];
                item[0] = this.txtItem1.getText();
                item[1] = this.txtItem2.getText();
                item[2] = this.txtItem3.getText();
                item[3] = this.txtItem4.getText();
                item[4] = this.txtItem5.getText();
                item[5] = this.txtItem6.getText();
                item[6] = this.txtItem7.getText();
                item[7] = this.txtItem8.getText();
                item[8] = this.txtItem9.getText();
                item[9] = this.txtItem10.getText();
                
                
                String supplier[] = new String[10];
                supplier[0] = this.cmbSupp1.getSelectedItem().toString();
                supplier[1] = this.cmbSupp2.getSelectedItem().toString();
                supplier[2] = this.cmbSupp3.getSelectedItem().toString();
                supplier[3] = this.cmbSupp4.getSelectedItem().toString();
                supplier[4] = this.cmbSupp5.getSelectedItem().toString();
                supplier[5] = this.cmbSupp6.getSelectedItem().toString();
                supplier[6] = this.cmbSupp7.getSelectedItem().toString();
                supplier[7] = this.cmbSupp8.getSelectedItem().toString();
                supplier[8] = this.cmbSupp9.getSelectedItem().toString();
                supplier[9] = this.cmbSupp10.getSelectedItem().toString();
                
                Date globalDate = this.dateGlobal.getDate();
                String dateGlobal = "1900/00/00";
                
                String supplierGlobal = this.cmbSuppGlobal.getSelectedItem().toString();
                
                //calculate entered items
                
                int enteredItems = 0;
                
                for(int x=0; x<10; x++)
                {
                    if(!item[x].equals(""))
                        enteredItems +=1;
                }
                
                System.out.println(enteredItems);
                
                
                //generating queryies
                
                //item 1......................................................
                
               if(enteredItems==1)
               {
                   
                   if(globalDate==null)
                   {
                        dateGlobal = "1900/00/00";
                        datee[0] = getDateInString(dates[0]);
                   }
                   else
                   {
                       
                       dateGlobal = getDateInString(globalDate);
                       datee[0] = getDateInString(globalDate);
                      
                    }
                   
                   if(!this.cmbSuppGlobal.getSelectedItem().toString().equals("Not Available"))
                   {
                       for(int x=0; x<10; x++)
                           supplier[x] = this.cmbSuppGlobal.getSelectedItem().toString();
                   }
                   
                   if(this.date1.getDate()==null && this.dateGlobal.getDate()==null)
                   {
                       JOptionPane.showMessageDialog(null, "Insert Required Dates OR Set a Global Date!","METROPOLITAN ENGINEERING (PVT) LTD", 1);
                   }
                   
                   else{
                   
                   PreparedStatement stmt1 = null;
                   PreparedStatement stmt2 = null;
                   
                   int x1=0, x2=0;
                   try{
                   stmt1 = con1.prepareStatement("INSERT INTO project values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt1.setString(1, pID);
                   stmt1.setString(2, pName);
                   stmt1.setString(3, pSdate);
                   stmt1.setString(4, dateGlobal);
                   stmt1.setString(5, pGsupplier);
                   stmt1.setString(6, pStatus);
                   stmt1.setString(7, pAvailability);
                   stmt1.setString(8, endDate);
                   
                   x1 = stmt1.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt2 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt2.setString(1, getItemId());
                   stmt2.setString(2, item[0]);
                   stmt2.setString(3, datee[0]);
                   stmt2.setString(4, supplier[0]);
                   stmt2.setString(5, qty[0]);
                   stmt2.setString(6, qty[0]);
                   stmt2.setString(7, pStatus);
                   stmt2.setString(8, pID);
                   x2 = stmt2.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }


                  if(x1>0 && x2>0)
                      JOptionPane.showMessageDialog(null, "Records inserted sucessfully! ","METROPOLITAN ENGINEERING (PVT) LTD", 1);
                   else
                       JOptionPane.showMessageDialog(null, "Error in Database. Please Reconnect! ","METROPOLITAN ENGINEERING (PVT) LTD", 1);
                   }
               }
               
               //item 2............................................................................................
               
               if(enteredItems==2)
               {
                   if(globalDate==null)
                   {
                        dateGlobal = "1900/00/00";
                        datee[0] = getDateInString(dates[0]);
                        datee[1] = getDateInString(dates[1]);
                   }
                   else
                   {
                       
                     
                       datee[0] = getDateInString(globalDate);
                       datee[1] = getDateInString(globalDate);
                      
                    }
                   
                   if(!this.cmbSuppGlobal.getSelectedItem().toString().equals("Not Available"))
                   {
                       for(int x=0; x<10; x++)
                           supplier[x] = this.cmbSuppGlobal.getSelectedItem().toString();
                   }
                   
                   if(this.date1.getDate()==null && this.date2.getDate()==null && this.dateGlobal.getDate()==null)
                   {
                       JOptionPane.showMessageDialog(null, "Insert Required Dates OR Set a Global Date!","METROPOLITAN ENGINEERING (PVT) LTD", 1);
                   }
                   else
                   {
                   
                   
                   PreparedStatement stmt1 = null;
                   PreparedStatement stmt2 = null;
                   PreparedStatement stmt3 = null;
                   
                   int x1=0, x2=0, x3=0;
                   try{
                   stmt1 = con1.prepareStatement("INSERT INTO project values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt1.setString(1, pID);
                   stmt1.setString(2, pName);
                   stmt1.setString(3, pSdate);
                   stmt1.setString(4, dateGlobal);
                   stmt1.setString(5, pGsupplier);
                   stmt1.setString(6, pStatus);
                   stmt1.setString(7, pAvailability);
                   stmt1.setString(8, endDate);
                   x1 = stmt1.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt2 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt2.setString(1, getItemId());
                   stmt2.setString(2, item[0]);
                   stmt2.setString(3, datee[0]);
                   stmt2.setString(4, supplier[0]);
                   stmt2.setString(5, qty[0]);
                   stmt2.setString(6, qty[0]);
                   stmt2.setString(7, pStatus);
                   stmt2.setString(8, pID);
                   x2 = stmt2.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt3 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt3.setString(1, getItemId());
                   stmt3.setString(2, item[1]);
                   stmt3.setString(3, datee[1]);
                   stmt3.setString(4, supplier[1]);
                   stmt3.setString(5, qty[1]);
                   stmt3.setString(6, qty[1]);
                   stmt3.setString(7, pStatus);
                   stmt3.setString(8, pID);
                   x3 = stmt3.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }


                  if(x1>0 && x2>0 && x3>0)
                      JOptionPane.showMessageDialog(null, "Records inserted sucessfully! ","METROPOLITAN ENGINEERING (PVT) LTD", 1);
                   else
                       JOptionPane.showMessageDialog(null, "Error in Database. Please Reconnect! ","METROPOLITAN ENGINEERING (PVT) LTD", 1);
                   }
               }
               
               //item 3 ...................................................
               
               
               if(enteredItems==3)
               {
                   if(globalDate==null)
                   {
                        dateGlobal = "1900/00/00";
                        datee[0] = getDateInString(dates[0]);
                        datee[1] = getDateInString(dates[1]);
                        datee[2] = getDateInString(dates[2]);
                   }
                   else
                   {
                       
                     
                       datee[0] = getDateInString(globalDate);
                       datee[1] = getDateInString(globalDate);
                       datee[2] = getDateInString(globalDate);
                      
                    }
                   
                   if(!this.cmbSuppGlobal.getSelectedItem().toString().equals("Not Available"))
                   {
                       for(int x=0; x<10; x++)
                           supplier[x] = this.cmbSuppGlobal.getSelectedItem().toString();
                   }
                   
                   
                   if(this.date1.getDate()==null && this.date2.getDate()==null && this.date3.getDate()==null && this.dateGlobal.getDate()==null)
                   {
                       JOptionPane.showMessageDialog(null, "Insert Required Dates OR Set a Global Date!","METROPOLITAN ENGINEERING (PVT) LTD", 1);
                   }
                   else
                   {
                   
                   PreparedStatement stmt1 = null;
                   PreparedStatement stmt2 = null;
                   PreparedStatement stmt3 = null;
                   PreparedStatement stmt4 = null;
                   
                   int x1=0, x2=0, x3=0, x4=0;
                   try{
                   stmt1 = con1.prepareStatement("INSERT INTO project values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt1.setString(1, pID);
                   stmt1.setString(2, pName);
                   stmt1.setString(3, pSdate);
                   stmt1.setString(4, dateGlobal);
                   stmt1.setString(5, pGsupplier);
                   stmt1.setString(6, pStatus);
                   stmt1.setString(7, pAvailability);
                   stmt1.setString(8, endDate);
                   x1 = stmt1.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt2 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt2.setString(1, getItemId());
                   stmt2.setString(2, item[0]);
                   stmt2.setString(3, datee[0]);
                   stmt2.setString(4, supplier[0]);
                   stmt2.setString(5, qty[0]);
                   stmt2.setString(6, qty[0]);
                   stmt2.setString(7, pStatus);
                   stmt2.setString(8, pID);
                   x2 = stmt2.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt3 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt3.setString(1, getItemId());
                   stmt3.setString(2, item[1]);
                   stmt3.setString(3, datee[1]);
                   stmt3.setString(4, supplier[1]);
                   stmt3.setString(5, qty[1]);
                   stmt3.setString(6, qty[1]);
                   stmt3.setString(7, pStatus);
                   stmt3.setString(8, pID);
                   x3 = stmt3.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt4 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt4.setString(1, getItemId());
                   stmt4.setString(2, item[2]);
                   stmt4.setString(3, datee[2]);
                   stmt4.setString(4, supplier[2]);
                   stmt4.setString(5, qty[2]);
                   stmt4.setString(6, qty[2]);
                   stmt4.setString(7, pStatus);
                   stmt4.setString(8, pID);
                   x4 = stmt4.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }


                  if(x1>0 && x2>0 && x3>0 && x4>0)
                      JOptionPane.showMessageDialog(null, "Records inserted sucessfully! ","METROPOLITAN ENGINEERING (PVT) LTD", 1);
                   else
                       JOptionPane.showMessageDialog(null, "Error in Database. Please Reconnect! ","METROPOLITAN ENGINEERING (PVT) LTD", 1);
                   }
               }
               
               //item 4.......................................................
               
               if(enteredItems==4)
               {
                   if(globalDate==null)
                   {
                        dateGlobal = "1900/00/00";
                        datee[0] = getDateInString(dates[0]);
                        datee[1] = getDateInString(dates[1]);
                        datee[2] = getDateInString(dates[2]);
                        datee[3] = getDateInString(dates[3]);
                   }
                   else
                   {
                       
                     
                       datee[0] = getDateInString(globalDate);
                       datee[1] = getDateInString(globalDate);
                       datee[2] = getDateInString(globalDate);
                       datee[3] = getDateInString(globalDate);
                      
                    }
                   
                   if(!this.cmbSuppGlobal.getSelectedItem().toString().equals("Not Available"))
                   {
                       for(int x=0; x<10; x++)
                           supplier[x] = this.cmbSuppGlobal.getSelectedItem().toString();
                   }
                   
                   if(this.date1.getDate()==null && this.date2.getDate()==null && this.date3.getDate()==null && this.date4.getDate()==null && this.dateGlobal.getDate()==null)
                   {
                       JOptionPane.showMessageDialog(null, "Insert Required Dates OR Set a Global Date!","METROPOLITAN ENGINEERING (PVT) LTD", 1);
                   }
                   else
                   {
                   
                   
                   PreparedStatement stmt1 = null;
                   PreparedStatement stmt2 = null;
                   PreparedStatement stmt3 = null;
                   PreparedStatement stmt4 = null;
                   PreparedStatement stmt5 = null;
                   
                   int x1=0, x2=0, x3=0, x4=0, x5=0;
                   try{
                   stmt1 = con1.prepareStatement("INSERT INTO project values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt1.setString(1, pID);
                   stmt1.setString(2, pName);
                   stmt1.setString(3, pSdate);
                   stmt1.setString(4, dateGlobal);
                   stmt1.setString(5, pGsupplier);
                   stmt1.setString(6, pStatus);
                   stmt1.setString(7, pAvailability);
                   stmt1.setString(8, endDate);
                   x1 = stmt1.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt2 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt2.setString(1, getItemId());
                   stmt2.setString(2, item[0]);
                   stmt2.setString(3, datee[0]);
                   stmt2.setString(4, supplier[0]);
                   stmt2.setString(5, qty[0]);
                   stmt2.setString(6, qty[0]);
                   stmt2.setString(7, pStatus);
                   stmt2.setString(8, pID);
                   x2 = stmt2.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt3 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt3.setString(1, getItemId());
                   stmt3.setString(2, item[1]);
                   stmt3.setString(3, datee[1]);
                   stmt3.setString(4, supplier[1]);
                   stmt3.setString(5, qty[1]);
                   stmt3.setString(6, qty[1]);
                   stmt3.setString(7, pStatus);
                   stmt3.setString(8, pID);
                   x3 = stmt3.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt4 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt4.setString(1, getItemId());
                   stmt4.setString(2, item[2]);
                   stmt4.setString(3, datee[2]);
                   stmt4.setString(4, supplier[2]);
                   stmt4.setString(5, qty[2]);
                   stmt4.setString(6, qty[2]);
                   stmt4.setString(7, pStatus);
                   stmt4.setString(8, pID);
                   x4 = stmt4.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt5 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt5.setString(1, getItemId());
                   stmt5.setString(2, item[3]);
                   stmt5.setString(3, datee[3]);
                   stmt5.setString(4, supplier[3]);
                   stmt5.setString(5, qty[3]);
                   stmt5.setString(6, qty[3]);
                   stmt5.setString(7, pStatus);
                   stmt5.setString(8, pID);
                   x5 = stmt5.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }


                  if(x1>0 && x2>0 && x3>0 && x4>0 && x5>0)
                      JOptionPane.showMessageDialog(null, "Records inserted sucessfully! ","METROPOLITAN ENGINEERING (PVT) LTD", 1);
                   else
                       JOptionPane.showMessageDialog(null, "Error in Database. Please Reconnect! ","METROPOLITAN ENGINEERING (PVT) LTD", 1);
                   }
               }
               
               //item 5 ................................................................
               
               if(enteredItems==5)
               {
                   if(globalDate==null)
                   {
                        dateGlobal = "1900/00/00";
                        datee[0] = getDateInString(dates[0]);
                        datee[1] = getDateInString(dates[1]);
                        datee[2] = getDateInString(dates[2]);
                        datee[3] = getDateInString(dates[3]);
                        datee[4] = getDateInString(dates[4]);
                   }
                   else
                   {
                       
                     
                       datee[0] = getDateInString(globalDate);
                       datee[1] = getDateInString(globalDate);
                       datee[2] = getDateInString(globalDate);
                       datee[3] = getDateInString(globalDate);
                       datee[4] = getDateInString(globalDate);
                      
                    }
                   
                   if(!this.cmbSuppGlobal.getSelectedItem().toString().equals("Not Available"))
                   {
                       for(int x=0; x<10; x++)
                           supplier[x] = this.cmbSuppGlobal.getSelectedItem().toString();
                   }
                   
                   
                   if(this.date1.getDate()==null && this.date2.getDate()==null && this.date3.getDate()==null && this.date4.getDate()==null && this.date5.getDate()==null && this.dateGlobal.getDate()==null)
                   {
                       JOptionPane.showMessageDialog(null, "Insert Required Dates OR Set a Global Date!","METROPOLITAN ENGINEERING (PVT) LTD", 1);
                   }
                   else
                   {
                   
                   PreparedStatement stmt1 = null;
                   PreparedStatement stmt2 = null;
                   PreparedStatement stmt3 = null;
                   PreparedStatement stmt4 = null;
                   PreparedStatement stmt5 = null;
                   PreparedStatement stmt6 = null;
                   
                   int x1=0, x2=0, x3=0, x4=0, x5=0, x6=0;
                   try{
                   stmt1 = con1.prepareStatement("INSERT INTO project values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt1.setString(1, pID);
                   stmt1.setString(2, pName);
                   stmt1.setString(3, pSdate);
                   stmt1.setString(4, dateGlobal);
                   stmt1.setString(5, pGsupplier);
                   stmt1.setString(6, pStatus);
                   stmt1.setString(7, pAvailability);
                   stmt1.setString(8, endDate);
                   x1 = stmt1.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt2 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt2.setString(1, getItemId());
                   stmt2.setString(2, item[0]);
                   stmt2.setString(3, datee[0]);
                   stmt2.setString(4, supplier[0]);
                   stmt2.setString(5, qty[0]);
                   stmt2.setString(6, qty[0]);
                   stmt2.setString(7, pStatus);
                   stmt2.setString(8, pID);
                   x2 = stmt2.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt3 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt3.setString(1, getItemId());
                   stmt3.setString(2, item[1]);
                   stmt3.setString(3, datee[1]);
                   stmt3.setString(4, supplier[1]);
                   stmt3.setString(5, qty[1]);
                   stmt3.setString(6, qty[1]);
                   stmt3.setString(7, pStatus);
                   stmt3.setString(8, pID);
                   x3 = stmt3.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt4 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt4.setString(1, getItemId());
                   stmt4.setString(2, item[2]);
                   stmt4.setString(3, datee[2]);
                   stmt4.setString(4, supplier[2]);
                   stmt4.setString(5, qty[2]);
                   stmt4.setString(6, qty[2]);
                   stmt4.setString(7, pStatus);
                   stmt4.setString(8, pID);
                   x4 = stmt4.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt5 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt5.setString(1, getItemId());
                   stmt5.setString(2, item[3]);
                   stmt5.setString(3, datee[3]);
                   stmt5.setString(4, supplier[3]);
                   stmt5.setString(5, qty[3]);
                   stmt5.setString(6, qty[3]);
                   stmt5.setString(7, pStatus);
                   stmt5.setString(8, pID);
                   x5 = stmt5.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt6 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt6.setString(1, getItemId());
                   stmt6.setString(2, item[4]);
                   stmt6.setString(3, datee[4]);
                   stmt6.setString(4, supplier[4]);
                   stmt6.setString(5, qty[4]);
                   stmt6.setString(6, qty[4]);
                   stmt6.setString(7, pStatus);
                   stmt6.setString(8, pID);
                   x6 = stmt6.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }


                  if(x1>0 && x2>0 && x3>0 && x4>0 && x5>0 && x6>0)
                      JOptionPane.showMessageDialog(null, "Records inserted sucessfully! ","METROPOLITAN ENGINEERING (PVT) LTD", 1);
                   else
                       JOptionPane.showMessageDialog(null, "Error in Database. Please Reconnect! ","METROPOLITAN ENGINEERING (PVT) LTD", 1);
                   }
               }
               
               //item 6..............................................................
               
               
               if(enteredItems==6)
               {
                   if(globalDate==null)
                   {
                        dateGlobal = "1900/00/00";
                        datee[0] = getDateInString(dates[0]);
                        datee[1] = getDateInString(dates[1]);
                        datee[2] = getDateInString(dates[2]);
                        datee[3] = getDateInString(dates[3]);
                        datee[4] = getDateInString(dates[4]);
                        datee[5] = getDateInString(dates[5]);
                   }
                   else
                   {
                       
                     
                       datee[0] = getDateInString(globalDate);
                       datee[1] = getDateInString(globalDate);
                       datee[2] = getDateInString(globalDate);
                       datee[3] = getDateInString(globalDate);
                       datee[4] = getDateInString(globalDate);
                       datee[5] = getDateInString(globalDate);
                      
                    }
                   
                   if(!this.cmbSuppGlobal.getSelectedItem().toString().equals("Not Available"))
                   {
                       for(int x=0; x<10; x++)
                           supplier[x] = this.cmbSuppGlobal.getSelectedItem().toString();
                   }
                   
                   
                   if(this.date1.getDate()==null && this.date2.getDate()==null && this.date3.getDate()==null && this.date4.getDate()==null && this.date5.getDate()==null && this.date6.getDate()==null && this.dateGlobal.getDate()==null)
                   {
                       JOptionPane.showMessageDialog(null, "Insert Required Dates OR Set a Global Date!","METROPOLITAN ENGINEERING (PVT) LTD", 1);
                   }
                   else
                   {
                   
                   PreparedStatement stmt1 = null;
                   PreparedStatement stmt2 = null;
                   PreparedStatement stmt3 = null;
                   PreparedStatement stmt4 = null;
                   PreparedStatement stmt5 = null;
                   PreparedStatement stmt6 = null;
                   PreparedStatement stmt7 = null;
                   
                   int x1=0, x2=0, x3=0, x4=0, x5=0, x6=0, x7=0;
                   try{
                   stmt1 = con1.prepareStatement("INSERT INTO project values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt1.setString(1, pID);
                   stmt1.setString(2, pName);
                   stmt1.setString(3, pSdate);
                   stmt1.setString(4, dateGlobal);
                   stmt1.setString(5, pGsupplier);
                   stmt1.setString(6, pStatus);
                   stmt1.setString(7, pAvailability);
                   stmt1.setString(8, endDate);
                   x1 = stmt1.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt2 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt2.setString(1, getItemId());
                   stmt2.setString(2, item[0]);
                   stmt2.setString(3, datee[0]);
                   stmt2.setString(4, supplier[0]);
                   stmt2.setString(5, qty[0]);
                   stmt2.setString(6, qty[0]);
                   stmt2.setString(7, pStatus);
                   stmt2.setString(8, pID);
                   x2 = stmt2.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt3 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt3.setString(1, getItemId());
                   stmt3.setString(2, item[1]);
                   stmt3.setString(3, datee[1]);
                   stmt3.setString(4, supplier[1]);
                   stmt3.setString(5, qty[1]);
                   stmt3.setString(6, qty[1]);
                   stmt3.setString(7, pStatus);
                   stmt3.setString(8, pID);
                   x3 = stmt3.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt4 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt4.setString(1, getItemId());
                   stmt4.setString(2, item[2]);
                   stmt4.setString(3, datee[2]);
                   stmt4.setString(4, supplier[2]);
                   stmt4.setString(5, qty[2]);
                   stmt4.setString(6, qty[2]);
                   stmt4.setString(7, pStatus);
                   stmt4.setString(8, pID);
                   x4 = stmt4.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt5 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt5.setString(1, getItemId());
                   stmt5.setString(2, item[3]);
                   stmt5.setString(3, datee[3]);
                   stmt5.setString(4, supplier[3]);
                   stmt5.setString(5, qty[3]);
                   stmt5.setString(6, qty[3]);
                   stmt5.setString(7, pStatus);
                   stmt5.setString(8, pID);
                   x5 = stmt5.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt6 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt6.setString(1, getItemId());
                   stmt6.setString(2, item[4]);
                   stmt6.setString(3, datee[4]);
                   stmt6.setString(4, supplier[4]);
                   stmt6.setString(5, qty[4]);
                   stmt6.setString(6, qty[4]);
                   stmt6.setString(7, pStatus);
                   stmt6.setString(8, pID);
                   x6 = stmt6.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt7 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt7.setString(1, getItemId());
                   stmt7.setString(2, item[5]);
                   stmt7.setString(3, datee[5]);
                   stmt7.setString(4, supplier[5]);
                   stmt7.setString(5, qty[5]);
                   stmt7.setString(6, qty[5]);
                   stmt7.setString(7, pStatus);
                   stmt7.setString(8, pID);
                   x7 = stmt7.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }


                  if(x1>0 && x2>0 && x3>0 && x4>0 && x5>0 && x6>0 && x7>0)
                      JOptionPane.showMessageDialog(null, "Records inserted sucessfully! ","METROPOLITAN ENGINEERING (PVT) LTD", 1);
                   else
                       JOptionPane.showMessageDialog(null, "Error in Database. Please Reconnect! ","METROPOLITAN ENGINEERING (PVT) LTD", 1);
                   }
               }
               
               //Item 7 ........................................
               
               if(enteredItems==7)
               {
                   if(globalDate==null)
                   {
                        dateGlobal = "1900/00/00";
                        datee[0] = getDateInString(dates[0]);
                        datee[1] = getDateInString(dates[1]);
                        datee[2] = getDateInString(dates[2]);
                        datee[3] = getDateInString(dates[3]);
                        datee[4] = getDateInString(dates[4]);
                        datee[5] = getDateInString(dates[5]);
                        datee[6] = getDateInString(dates[6]);
                   }
                   else
                   {
                       
                     
                       datee[0] = getDateInString(globalDate);
                       datee[1] = getDateInString(globalDate);
                       datee[2] = getDateInString(globalDate);
                       datee[3] = getDateInString(globalDate);
                       datee[4] = getDateInString(globalDate);
                       datee[5] = getDateInString(globalDate);
                       datee[6] = getDateInString(globalDate);
                      
                    }
                   
                   if(!this.cmbSuppGlobal.getSelectedItem().toString().equals("Not Available"))
                   {
                       for(int x=0; x<10; x++)
                           supplier[x] = this.cmbSuppGlobal.getSelectedItem().toString();
                   }
                   
                   if(this.date1.getDate()==null && this.date2.getDate()==null && this.date3.getDate()==null && this.date4.getDate()==null && this.date5.getDate()==null && this.date6.getDate()==null && this.date7.getDate()==null && this.dateGlobal.getDate()==null)
                   {
                       JOptionPane.showMessageDialog(null, "Insert Required Dates OR Set a Global Date!","METROPOLITAN ENGINEERING (PVT) LTD", 1);
                   }
                   else
                   {
                   
                   
                   PreparedStatement stmt1 = null;
                   PreparedStatement stmt2 = null;
                   PreparedStatement stmt3 = null;
                   PreparedStatement stmt4 = null;
                   PreparedStatement stmt5 = null;
                   PreparedStatement stmt6 = null;
                   PreparedStatement stmt7 = null;
                   PreparedStatement stmt8 = null;
                   
                   int x1=0, x2=0, x3=0, x4=0, x5=0, x6=0, x7=0, x8=0;
                   try{
                   stmt1 = con1.prepareStatement("INSERT INTO project values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt1.setString(1, pID);
                   stmt1.setString(2, pName);
                   stmt1.setString(3, pSdate);
                   stmt1.setString(4, dateGlobal);
                   stmt1.setString(5, pGsupplier);
                   stmt1.setString(6, pStatus);
                   stmt1.setString(7, pAvailability);
                   stmt1.setString(8, endDate);
                   x1 = stmt1.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt2 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt2.setString(1, getItemId());
                   stmt2.setString(2, item[0]);
                   stmt2.setString(3, datee[0]);
                   stmt2.setString(4, supplier[0]);
                   stmt2.setString(5, qty[0]);
                   stmt2.setString(6, qty[0]);
                   stmt2.setString(7, pStatus);
                   stmt2.setString(8, pID);
                   x2 = stmt2.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt3 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt3.setString(1, getItemId());
                   stmt3.setString(2, item[1]);
                   stmt3.setString(3, datee[1]);
                   stmt3.setString(4, supplier[1]);
                   stmt3.setString(5, qty[1]);
                   stmt3.setString(6, qty[1]);
                   stmt3.setString(7, pStatus);
                   stmt3.setString(8, pID);
                   x3 = stmt3.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt4 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt4.setString(1, getItemId());
                   stmt4.setString(2, item[2]);
                   stmt4.setString(3, datee[2]);
                   stmt4.setString(4, supplier[2]);
                   stmt4.setString(5, qty[2]);
                   stmt4.setString(6, qty[2]);
                   stmt4.setString(7, pStatus);
                   stmt4.setString(8, pID);
                   x4 = stmt4.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt5 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt5.setString(1, getItemId());
                   stmt5.setString(2, item[3]);
                   stmt5.setString(3, datee[3]);
                   stmt5.setString(4, supplier[3]);
                   stmt5.setString(5, qty[3]);
                   stmt5.setString(6, qty[3]);
                   stmt5.setString(7, pStatus);
                   stmt5.setString(8, pID);
                   x5 = stmt5.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt6 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt6.setString(1, getItemId());
                   stmt6.setString(2, item[4]);
                   stmt6.setString(3, datee[4]);
                   stmt6.setString(4, supplier[4]);
                   stmt6.setString(5, qty[4]);
                   stmt6.setString(6, qty[4]);
                   stmt6.setString(7, pStatus);
                   stmt6.setString(8, pID);
                   x6 = stmt6.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt7 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt7.setString(1, getItemId());
                   stmt7.setString(2, item[5]);
                   stmt7.setString(3, datee[5]);
                   stmt7.setString(4, supplier[5]);
                   stmt7.setString(5, qty[5]);
                   stmt7.setString(6, qty[5]);
                   stmt7.setString(7, pStatus);
                   stmt7.setString(8, pID);
                   x7 = stmt7.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt8 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt8.setString(1, getItemId());
                   stmt8.setString(2, item[6]);
                   stmt8.setString(3, datee[6]);
                   stmt8.setString(4, supplier[6]);
                   stmt8.setString(5, qty[6]);
                   stmt8.setString(6, qty[6]);
                   stmt8.setString(7, pStatus);
                   stmt8.setString(8, pID);
                   x8 = stmt8.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }


                  if(x1>0 && x2>0 && x3>0 && x4>0 && x5>0 && x6>0 && x7>0 && x8>0)
                      JOptionPane.showMessageDialog(null, "Records inserted sucessfully! ","METROPOLITAN ENGINEERING (PVT) LTD", 1);
                   else
                       JOptionPane.showMessageDialog(null, "Error in Database. Please Reconnect! ","METROPOLITAN ENGINEERING (PVT) LTD", 1);
                   }
               }
               
               //item 8 ....................................................
               
               if(enteredItems==8)
               {
                   if(globalDate==null)
                   {
                        dateGlobal = "1900/00/00";
                        datee[0] = getDateInString(dates[0]);
                        datee[1] = getDateInString(dates[1]);
                        datee[2] = getDateInString(dates[2]);
                        datee[3] = getDateInString(dates[3]);
                        datee[4] = getDateInString(dates[4]);
                        datee[5] = getDateInString(dates[5]);
                        datee[6] = getDateInString(dates[6]);
                        datee[7] = getDateInString(dates[7]);
                   }
                   else
                   {
                       
                     
                       datee[0] = getDateInString(globalDate);
                       datee[1] = getDateInString(globalDate);
                       datee[2] = getDateInString(globalDate);
                       datee[3] = getDateInString(globalDate);
                       datee[4] = getDateInString(globalDate);
                       datee[5] = getDateInString(globalDate);
                       datee[6] = getDateInString(globalDate);
                       datee[7] = getDateInString(globalDate);
                      
                    }
                   
                   if(!this.cmbSuppGlobal.getSelectedItem().toString().equals("Not Available"))
                   {
                       for(int x=0; x<10; x++)
                           supplier[x] = this.cmbSuppGlobal.getSelectedItem().toString();
                   }
                   
                   
                   if(this.date1.getDate()==null && this.date2.getDate()==null && this.date3.getDate()==null && this.date4.getDate()==null && this.date5.getDate()==null && this.date6.getDate()==null && this.date7.getDate()==null && this.date8.getDate()==null && this.dateGlobal.getDate()==null)
                   {
                       JOptionPane.showMessageDialog(null, "Insert Required Dates OR Set a Global Date!","METROPOLITAN ENGINEERING (PVT) LTD", 1);
                   }
                   else
                   {
                   
                   PreparedStatement stmt1 = null;
                   PreparedStatement stmt2 = null;
                   PreparedStatement stmt3 = null;
                   PreparedStatement stmt4 = null;
                   PreparedStatement stmt5 = null;
                   PreparedStatement stmt6 = null;
                   PreparedStatement stmt7 = null;
                   PreparedStatement stmt8 = null;
                   PreparedStatement stmt9 = null;
                   
                   int x1=0, x2=0, x3=0, x4=0, x5=0, x6=0, x7=0, x8=0, x9=0;
                   try{
                   stmt1 = con1.prepareStatement("INSERT INTO project values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt1.setString(1, pID);
                   stmt1.setString(2, pName);
                   stmt1.setString(3, pSdate);
                   stmt1.setString(4, dateGlobal);
                   stmt1.setString(5, pGsupplier);
                   stmt1.setString(6, pStatus);
                   stmt1.setString(7, pAvailability);
                   stmt1.setString(8, endDate);
                   x1 = stmt1.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt2 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt2.setString(1, getItemId());
                   stmt2.setString(2, item[0]);
                   stmt2.setString(3, datee[0]);
                   stmt2.setString(4, supplier[0]);
                   stmt2.setString(5, qty[0]);
                   stmt2.setString(6, qty[0]);
                   stmt2.setString(7, pStatus);
                   stmt2.setString(8, pID);
                   x2 = stmt2.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt3 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt3.setString(1, getItemId());
                   stmt3.setString(2, item[1]);
                   stmt3.setString(3, datee[1]);
                   stmt3.setString(4, supplier[1]);
                   stmt3.setString(5, qty[1]);
                   stmt3.setString(6, qty[1]);
                   stmt3.setString(7, pStatus);
                   stmt3.setString(8, pID);
                   x3 = stmt3.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt4 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt4.setString(1, getItemId());
                   stmt4.setString(2, item[2]);
                   stmt4.setString(3, datee[2]);
                   stmt4.setString(4, supplier[2]);
                   stmt4.setString(5, qty[2]);
                   stmt4.setString(6, qty[2]);
                   stmt4.setString(7, pStatus);
                   stmt4.setString(8, pID);
                   x4 = stmt4.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt5 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt5.setString(1, getItemId());
                   stmt5.setString(2, item[3]);
                   stmt5.setString(3, datee[3]);
                   stmt5.setString(4, supplier[3]);
                   stmt5.setString(5, qty[3]);
                   stmt5.setString(6, qty[3]);
                   stmt5.setString(7, pStatus);
                   stmt5.setString(8, pID);
                   x5 = stmt5.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt6 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt6.setString(1, getItemId());
                   stmt6.setString(2, item[4]);
                   stmt6.setString(3, datee[4]);
                   stmt6.setString(4, supplier[4]);
                   stmt6.setString(5, qty[4]);
                   stmt6.setString(6, qty[4]);
                   stmt6.setString(7, pStatus);
                   stmt6.setString(8, pID);
                   x6 = stmt6.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt7 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt7.setString(1, getItemId());
                   stmt7.setString(2, item[5]);
                   stmt7.setString(3, datee[5]);
                   stmt7.setString(4, supplier[5]);
                   stmt7.setString(5, qty[5]);
                   stmt7.setString(6, qty[5]);
                   stmt7.setString(7, pStatus);
                   stmt7.setString(8, pID);
                   x7 = stmt7.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt8 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt8.setString(1, getItemId());
                   stmt8.setString(2, item[6]);
                   stmt8.setString(3, datee[6]);
                   stmt8.setString(4, supplier[6]);
                   stmt8.setString(5, qty[6]);
                   stmt8.setString(6, qty[6]);
                   stmt8.setString(7, pStatus);
                   stmt8.setString(8, pID);
                   x8 = stmt8.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt9 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt9.setString(1, getItemId());
                   stmt9.setString(2, item[7]);
                   stmt9.setString(3, datee[7]);
                   stmt9.setString(4, supplier[7]);
                   stmt9.setString(5, qty[7]);
                   stmt9.setString(6, qty[7]);
                   stmt9.setString(7, pStatus);
                   stmt9.setString(8, pID);
                   x9 = stmt9.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }


                  if(x1>0 && x2>0 && x3>0 && x4>0 && x5>0 && x6>0 && x7>0 && x8>0 && x9>0)
                      JOptionPane.showMessageDialog(null, "Records inserted sucessfully! ","METROPOLITAN ENGINEERING (PVT) LTD", 1);
                   else
                       JOptionPane.showMessageDialog(null, "Error in Database. Please Reconnect! ","METROPOLITAN ENGINEERING (PVT) LTD", 1);
                   }
               }
               
               //items 9 ................................................
               
               if(enteredItems==9)
               {
                   if(globalDate==null)
                   {
                        dateGlobal = "1900/00/00";
                        datee[0] = getDateInString(dates[0]);
                        datee[1] = getDateInString(dates[1]);
                        datee[2] = getDateInString(dates[2]);
                        datee[3] = getDateInString(dates[3]);
                        datee[4] = getDateInString(dates[4]);
                        datee[5] = getDateInString(dates[5]);
                        datee[6] = getDateInString(dates[6]);
                        datee[7] = getDateInString(dates[7]);
                        datee[8] = getDateInString(dates[8]);
                   }
                   else
                   {
                       
                     
                       datee[0] = getDateInString(globalDate);
                       datee[1] = getDateInString(globalDate);
                       datee[2] = getDateInString(globalDate);
                       datee[3] = getDateInString(globalDate);
                       datee[4] = getDateInString(globalDate);
                       datee[5] = getDateInString(globalDate);
                       datee[6] = getDateInString(globalDate);
                       datee[7] = getDateInString(globalDate);
                       datee[8] = getDateInString(globalDate);
                      
                    }
                   
                   if(!this.cmbSuppGlobal.getSelectedItem().toString().equals("Not Available"))
                   {
                       for(int x=0; x<10; x++)
                           supplier[x] = this.cmbSuppGlobal.getSelectedItem().toString();
                   }
                   
                   
                   if(this.date1.getDate()==null && this.date2.getDate()==null && this.date3.getDate()==null && this.date4.getDate()==null && this.date5.getDate()==null && this.date6.getDate()==null && this.date7.getDate()==null && this.date8.getDate()==null && this.date9.getDate()==null && this.dateGlobal.getDate()==null)
                   {
                       JOptionPane.showMessageDialog(null, "Insert Required Dates OR Set a Global Date!","METROPOLITAN ENGINEERING (PVT) LTD", 1);
                   }
                   else
                   {
                   
                   PreparedStatement stmt1 = null;
                   PreparedStatement stmt2 = null;
                   PreparedStatement stmt3 = null;
                   PreparedStatement stmt4 = null;
                   PreparedStatement stmt5 = null;
                   PreparedStatement stmt6 = null;
                   PreparedStatement stmt7 = null;
                   PreparedStatement stmt8 = null;
                   PreparedStatement stmt9 = null;
                   PreparedStatement stmt10 = null;
                   
                   int x1=0, x2=0, x3=0, x4=0, x5=0, x6=0, x7=0, x8=0, x9=0, x10=0;
                   try{
                   stmt1 = con1.prepareStatement("INSERT INTO project values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt1.setString(1, pID);
                   stmt1.setString(2, pName);
                   stmt1.setString(3, pSdate);
                   stmt1.setString(4, dateGlobal);
                   stmt1.setString(5, pGsupplier);
                   stmt1.setString(6, pStatus);
                   stmt1.setString(7, pAvailability);
                   stmt1.setString(8, endDate);
                   x1 = stmt1.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt2 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt2.setString(1, getItemId());
                   stmt2.setString(2, item[0]);
                   stmt2.setString(3, datee[0]);
                   stmt2.setString(4, supplier[0]);
                   stmt2.setString(5, qty[0]);
                   stmt2.setString(6, qty[0]);
                   stmt2.setString(7, pStatus);
                   stmt2.setString(8, pID);
                   x2 = stmt2.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt3 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt3.setString(1, getItemId());
                   stmt3.setString(2, item[1]);
                   stmt3.setString(3, datee[1]);
                   stmt3.setString(4, supplier[1]);
                   stmt3.setString(5, qty[1]);
                   stmt3.setString(6, qty[1]);
                   stmt3.setString(7, pStatus);
                   stmt3.setString(8, pID);
                   x3 = stmt3.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt4 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt4.setString(1, getItemId());
                   stmt4.setString(2, item[2]);
                   stmt4.setString(3, datee[2]);
                   stmt4.setString(4, supplier[2]);
                   stmt4.setString(5, qty[2]);
                   stmt4.setString(6, qty[2]);
                   stmt4.setString(7, pStatus);
                   stmt4.setString(8, pID);
                   x4 = stmt4.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt5 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt5.setString(1, getItemId());
                   stmt5.setString(2, item[3]);
                   stmt5.setString(3, datee[3]);
                   stmt5.setString(4, supplier[3]);
                   stmt5.setString(5, qty[3]);
                   stmt5.setString(6, qty[3]);
                   stmt5.setString(7, pStatus);
                   stmt5.setString(8, pID);
                   x5 = stmt5.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt6 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt6.setString(1, getItemId());
                   stmt6.setString(2, item[4]);
                   stmt6.setString(3, datee[4]);
                   stmt6.setString(4, supplier[4]);
                   stmt6.setString(5, qty[4]);
                   stmt6.setString(6, qty[4]);
                   stmt6.setString(7, pStatus);
                   stmt6.setString(8, pID);
                   x6 = stmt6.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt7 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt7.setString(1, getItemId());
                   stmt7.setString(2, item[5]);
                   stmt7.setString(3, datee[5]);
                   stmt7.setString(4, supplier[5]);
                   stmt7.setString(5, qty[5]);
                   stmt7.setString(6, qty[5]);
                   stmt7.setString(7, pStatus);
                   stmt7.setString(8, pID);
                   x7 = stmt7.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt8 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt8.setString(1, getItemId());
                   stmt8.setString(2, item[6]);
                   stmt8.setString(3, datee[6]);
                   stmt8.setString(4, supplier[6]);
                   stmt8.setString(5, qty[6]);
                   stmt8.setString(6, qty[6]);
                   stmt8.setString(7, pStatus);
                   stmt8.setString(8, pID);
                   x8 = stmt8.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt9 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt9.setString(1, getItemId());
                   stmt9.setString(2, item[7]);
                   stmt9.setString(3, datee[7]);
                   stmt9.setString(4, supplier[7]);
                   stmt9.setString(5, qty[7]);
                   stmt9.setString(6, qty[7]);
                   stmt9.setString(7, pStatus);
                   stmt9.setString(8, pID);
                   x9 = stmt9.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt10 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt10.setString(1, getItemId());
                   stmt10.setString(2, item[8]);
                   stmt10.setString(3, datee[8]);
                   stmt10.setString(4, supplier[8]);
                   stmt10.setString(5, qty[8]);
                   stmt10.setString(6, qty[8]);
                   stmt10.setString(7, pStatus);
                   stmt10.setString(8, pID);
                   x10 = stmt10.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }


                  if(x1>0 && x2>0 && x3>0 && x4>0 && x5>0 && x6>0 && x7>0 && x8>0 && x9>0 && x10>0)
                      JOptionPane.showMessageDialog(null, "Records inserted sucessfully! ","METROPOLITAN ENGINEERING (PVT) LTD", 1);
                   else
                       JOptionPane.showMessageDialog(null, "Error in Database. Please Reconnect! ","METROPOLITAN ENGINEERING (PVT) LTD", 1);
                   }
               }
               
               //items 10..............................
               
               if(enteredItems==10)
               {
                   if(globalDate==null)
                   {
                        dateGlobal = "1900/00/00";
                        datee[0] = getDateInString(dates[0]);
                        datee[1] = getDateInString(dates[1]);
                        datee[2] = getDateInString(dates[2]);
                        datee[3] = getDateInString(dates[3]);
                        datee[4] = getDateInString(dates[4]);
                        datee[5] = getDateInString(dates[5]);
                        datee[6] = getDateInString(dates[6]);
                        datee[7] = getDateInString(dates[7]);
                        datee[8] = getDateInString(dates[8]);
                        datee[9] = getDateInString(dates[9]);
                   }
                   else
                   {
                       
                     
                       datee[0] = getDateInString(globalDate);
                       datee[1] = getDateInString(globalDate);
                       datee[2] = getDateInString(globalDate);
                       datee[3] = getDateInString(globalDate);
                       datee[4] = getDateInString(globalDate);
                       datee[5] = getDateInString(globalDate);
                       datee[6] = getDateInString(globalDate);
                       datee[7] = getDateInString(globalDate);
                       datee[8] = getDateInString(globalDate);
                       datee[9] = getDateInString(globalDate);
                      
                    }
                   
                   if(!this.cmbSuppGlobal.getSelectedItem().toString().equals("Not Available"))
                   {
                       for(int x=0; x<10; x++)
                           supplier[x] = this.cmbSuppGlobal.getSelectedItem().toString();
                   }
                   
                   
                   if(this.date1.getDate()==null && this.date2.getDate()==null && this.date3.getDate()==null && this.date4.getDate()==null && this.date5.getDate()==null && this.date6.getDate()==null && this.date7.getDate()==null && this.date8.getDate()==null && this.date9.getDate()==null && this.date10.getDate()==null && this.dateGlobal.getDate()==null)
                   {
                       JOptionPane.showMessageDialog(null, "Insert Required Dates OR Set a Global Date!","METROPOLITAN ENGINEERING (PVT) LTD", 1);
                   }
                   else
                   {
                   
                   PreparedStatement stmt1 = null;
                   PreparedStatement stmt2 = null;
                   PreparedStatement stmt3 = null;
                   PreparedStatement stmt4 = null;
                   PreparedStatement stmt5 = null;
                   PreparedStatement stmt6 = null;
                   PreparedStatement stmt7 = null;
                   PreparedStatement stmt8 = null;
                   PreparedStatement stmt9 = null;
                   PreparedStatement stmt10 = null;
                   PreparedStatement stmt11 = null;
                   
                   int x1=0, x2=0, x3=0, x4=0, x5=0, x6=0, x7=0, x8=0, x9=0, x10=0, x11=0;
                   try{
                   stmt1 = con1.prepareStatement("INSERT INTO project values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt1.setString(1, pID);
                   stmt1.setString(2, pName);
                   stmt1.setString(3, pSdate);
                   stmt1.setString(4, dateGlobal);
                   stmt1.setString(5, pGsupplier);
                   stmt1.setString(6, pStatus);
                   stmt1.setString(7, pAvailability);
                   stmt1.setString(8, endDate);
                   x1 = stmt1.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt2 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt2.setString(1, getItemId());
                   stmt2.setString(2, item[0]);
                   stmt2.setString(3, datee[0]);
                   stmt2.setString(4, supplier[0]);
                   stmt2.setString(5, qty[0]);
                   stmt2.setString(6, qty[0]);
                   stmt2.setString(7, pStatus);
                   stmt2.setString(8, pID);
                   x2 = stmt2.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt3 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt3.setString(1, getItemId());
                   stmt3.setString(2, item[1]);
                   stmt3.setString(3, datee[1]);
                   stmt3.setString(4, supplier[1]);
                   stmt3.setString(5, qty[1]);
                   stmt3.setString(6, qty[1]);
                   stmt3.setString(7, pStatus);
                   stmt3.setString(8, pID);
                   x3 = stmt3.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt4 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt4.setString(1, getItemId());
                   stmt4.setString(2, item[2]);
                   stmt4.setString(3, datee[2]);
                   stmt4.setString(4, supplier[2]);
                   stmt4.setString(5, qty[2]);
                   stmt4.setString(6, qty[2]);
                   stmt4.setString(7, pStatus);
                   stmt4.setString(8, pID);
                   x4 = stmt4.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt5 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt5.setString(1, getItemId());
                   stmt5.setString(2, item[3]);
                   stmt5.setString(3, datee[3]);
                   stmt5.setString(4, supplier[3]);
                   stmt5.setString(5, qty[3]);
                   stmt5.setString(6, qty[3]);
                   stmt5.setString(7, pStatus);
                   stmt5.setString(8, pID);
                   x5 = stmt5.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt6 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt6.setString(1, getItemId());
                   stmt6.setString(2, item[4]);
                   stmt6.setString(3, datee[4]);
                   stmt6.setString(4, supplier[4]);
                   stmt6.setString(5, qty[4]);
                   stmt6.setString(6, qty[4]);
                   stmt6.setString(7, pStatus);
                   stmt6.setString(8, pID);
                   x6 = stmt6.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt7 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt7.setString(1, getItemId());
                   stmt7.setString(2, item[5]);
                   stmt7.setString(3, datee[5]);
                   stmt7.setString(4, supplier[5]);
                   stmt7.setString(5, qty[5]);
                   stmt7.setString(6, qty[5]);
                   stmt7.setString(7, pStatus);
                   stmt7.setString(8, pID);
                   x7 = stmt7.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt8 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt8.setString(1, getItemId());
                   stmt8.setString(2, item[6]);
                   stmt8.setString(3, datee[6]);
                   stmt8.setString(4, supplier[6]);
                   stmt8.setString(5, qty[6]);
                   stmt8.setString(6, qty[6]);
                   stmt8.setString(7, pStatus);
                   stmt8.setString(8, pID);
                   x8 = stmt8.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt9 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt9.setString(1, getItemId());
                   stmt9.setString(2, item[7]);
                   stmt9.setString(3, datee[7]);
                   stmt9.setString(4, supplier[7]);
                   stmt9.setString(5, qty[7]);
                   stmt9.setString(6, qty[7]);
                   stmt9.setString(7, pStatus);
                   stmt9.setString(8, pID);
                   x9 = stmt9.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt10 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt10.setString(1, getItemId());
                   stmt10.setString(2, item[8]);
                   stmt10.setString(3, datee[8]);
                   stmt10.setString(4, supplier[8]);
                   stmt10.setString(5, qty[8]);
                   stmt10.setString(6, qty[8]);
                   stmt10.setString(7, pStatus);
                   stmt10.setString(8, pID);
                   x10 = stmt10.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt11 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt11.setString(1, getItemId());
                   stmt11.setString(2, item[9]);
                   stmt11.setString(3, datee[9]);
                   stmt11.setString(4, supplier[9]);
                   stmt11.setString(5, qty[9]);
                   stmt11.setString(6, qty[9]);
                   stmt11.setString(7, pStatus);
                   stmt11.setString(8, pID);
                   x11 = stmt11.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                    
                   loadEditProjectList();
                   

                  if(x1>0 && x2>0 && x3>0 && x4>0 && x5>0 && x6>0 && x7>0 && x8>0 && x9>0 && x10>0 && x11>0)
                      JOptionPane.showMessageDialog(null, "Records inserted sucessfully! ","METROPOLITAN ENGINEERING (PVT) LTD", 1);
                   else
                       JOptionPane.showMessageDialog(null, "Error in Database. Please Reconnect! ","METROPOLITAN ENGINEERING (PVT) LTD", 1);
                   }
               }
               
               
                this.txtProID.setText(getProjectID());
                this.txtItem1.setText("");
        this.txtItem2.setText("");
        this.txtItem3.setText("");
        this.txtItem4.setText("");
        this.txtItem5.setText("");
        this.txtItem6.setText("");
        this.txtItem7.setText("");
        this.txtItem8.setText("");
        this.txtItem9.setText("");
        this.txtItem10.setText("");
        
        this.txtQ1.setText("1");
        this.txtQ2.setText("1");
        this.txtQ3.setText("1");
        this.txtQ4.setText("1");
        this.txtQ5.setText("1");
        this.txtQ6.setText("1");
        this.txtQ7.setText("1");
        this.txtQ8.setText("1");
        this.txtQ9.setText("1");
        this.txtQ10.setText("1");
        this.dateGlobal.setCalendar(null);
        this.txtProName.setText("");
        
        this.date1.setCalendar(null);
        this.date2.setCalendar(null);
        this.date3.setCalendar(null);
        this.date4.setCalendar(null);
        this.date5.setCalendar(null);
        this.date7.setCalendar(null);
        this.date8.setCalendar(null);
        this.date9.setCalendar(null);
        this.date6.setCalendar(null);
        this.date10.setCalendar(null);
        this.jDateChooser1.setCalendar(null);
        
        this.cmbSupp1.setSelectedItem("Not Available");
        this.cmbSupp2.setSelectedItem("Not Available");
        this.cmbSupp3.setSelectedItem("Not Available");
        this.cmbSupp4.setSelectedItem("Not Available");
        this.cmbSupp5.setSelectedItem("Not Available");
        this.cmbSupp6.setSelectedItem("Not Available");
        this.cmbSupp7.setSelectedItem("Not Available");
        this.cmbSupp8.setSelectedItem("Not Available");
        this.cmbSupp9.setSelectedItem("Not Available");
        this.cmbSupp10.setSelectedItem("Not Available");
        this.cmbSuppGlobal.setSelectedItem("Not Available");
        
        loadEditProjectList();
            }
        }
        }
        
       //refresh delete table
        
        String query1 = "select pID as 'ID', pName as 'Name', pSdate as 'Start Date', pEndDate as 'End Date',  pGsupplier as 'Global Supplier', pStatus as 'Project Status'  from project where pAvailability = 'YES' ";

        ResultSet result= db1.executeSQLQuery(query1);

        try {

            int columCount = 0;
            ResultSetMetaData rsmd = result.getMetaData();
            Vector myVector = new Vector();
            columCount = rsmd.getColumnCount();
            for (int i = 1; i <= columCount; i++) {
                myVector.add(rsmd.getColumnLabel(i));
            }
            DefaultTableModel amodel = new DefaultTableModel(myVector, 0)/*0=row count*/ {
                @Override
                public boolean isCellEditable(int row, int column) {
                    //all cells false
                    return false;
                }
            };

            while (result.next()) {
                String[] rowData = new String[columCount];
                for (int i = 1; i <= columCount; i++) {
                    if (i == 1) {
                        String id = result.getString(i);
                        rowData[i - 1] = id.toUpperCase();
                    } else {
                        rowData[i - 1] = result.getString(i);
                    }
                }
                amodel.addRow(rowData);
            }

            tableSummaryProjects.setModel(amodel);

        } 
        
        catch (Exception e) {
            JOptionPane.showMessageDialog(this, "Error in Showing Data", "METROPOLITAN ENGINEERING (PVT) LTD", 1);
        }
                
    }//GEN-LAST:event_btnAddProjectActionPerformed

    private void btnAddProject1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddProject1ActionPerformed

        // TODO add your handling code here:
        
        // clear fields
        
        this.txtItem11.setText("");
        this.txtItem12.setText("");
        this.txtItem13.setText("");
        this.txtItem14.setText("");
        this.txtItem15.setText("");
        this.txtItem16.setText("");
        this.txtItem17.setText("");
        this.txtItem18.setText("");
        this.txtItem19.setText("");
        this.txtItem20.setText("");
        
        this.txtQ12.setText("");
        this.txtQ13.setText("");
        this.txtQ14.setText("");
        this.txtQ15.setText("");
        this.txtQ16.setText("");
        this.txtQ17.setText("");
        this.txtQ18.setText("");
        this.txtQ19.setText("");
        this.txtQ20.setText("");
        this.txtQ11.setText("");
        
   

        
        this.date11.setCalendar(null);
        this.date12.setCalendar(null);
        this.date13.setCalendar(null);
        this.date14.setCalendar(null);
        this.date15.setCalendar(null);
        this.date17.setCalendar(null);
        this.date18.setCalendar(null);
        this.date19.setCalendar(null);
        this.date16.setCalendar(null);
        this.date20.setCalendar(null);
        this.jDateChooser2.setCalendar(null);
        this.dateGlobal1.setCalendar(null);
        
        this.cmbSupp11.setSelectedItem("Not Available");
        this.cmbSupp12.setSelectedItem("Not Available");
        this.cmbSupp13.setSelectedItem("Not Available");
        this.cmbSupp14.setSelectedItem("Not Available");
        this.cmbSupp15.setSelectedItem("Not Available");
        this.cmbSupp16.setSelectedItem("Not Available");
        this.cmbSupp17.setSelectedItem("Not Available");
        this.cmbSupp18.setSelectedItem("Not Available");
        this.cmbSupp19.setSelectedItem("Not Available");
        this.cmbSupp20.setSelectedItem("Not Available");
        this.cmbSuppGlobal1.setSelectedItem("Not Available");
        
        
        
        
        //clear fields ends
        
        
        //load item numbers to array
        
        String iPid = this.txtProID1.getText().toString();
        
        int p1=0;
        
        String tt = "select * from item where iPID = '"+iPid+"'";
       
        
        ResultSet result111= db1.executeSQLQuery(tt);
        
        try
        {
            /*
         if(p1==1)
            {
            result111.next();
        
            this.txtItem11.setText(result111.getString("iName"));
            this.txtQ11.setText(result111.getString("iName"));
            
            }
            */
            
            for(int x=0; x<10; x++)
            {
                result111.next();
                
                itemNumber[x] = result111.getString("iID");
                
            }
            
        }
        catch(Exception e)
        {
            
        }
        
        
        // finish loading
        
        
        
        String selected = this.cmbProName.getSelectedItem().toString();
        
        
        
        String gen = "select * from project where pName = '"+selected+"'";
       
        
        ResultSet result1= db1.executeSQLQuery(gen);
        
        
        try
        {
        while(result1.next())
        {
            this.txtProID1.setText(result1.getString("pID"));
            startDate = (result1.getString("pSdate"));
            Date d = (convertStringToDate(result1.getString("pEndDate")));
            this.jDateChooser2.setDate(d);
            System.out.println(result1.getString("pGdate"));
            /*
            if(result1.getString("pGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result1.getString("pGdate");
                this.dateGlobal1.setDate(convertStringToDate(x));
            }
            */
            
        }
        
        }
        catch(Exception e)
        {
            JOptionPane.showMessageDialog(null, e.getMessage(),"METROPOLITAN ENGINEERING (PVT) LTD", 1);
        }
        
        
        //check how many
        
        String gene = "select count(*) as 'field' from item where iPID = '"+this.txtProID1.getText().toString()+"'";
   
        int n1=0;
      
        
        ResultSet count1 = db1.executeSQLQuery(gene);
        
        try
        {
            if(count1.next())
            {
                n1 += Integer.parseInt(count1.getString("field"));
            }
        }
        catch(Exception e)
        {
            JOptionPane.showMessageDialog(null, e.getMessage(),"METROPOLITAN ENGINEERING (PVT) LTD", 1);
        }
        
        
        
        //load items
        
        String gen1 = "select * from item where iPID = '"+this.txtProID1.getText().toString()+"'";
       
        
        ResultSet result11= db1.executeSQLQuery(gen1);
        
        
        try
        {
            
            // 1..............
            if(n1==1)
            {
            result11.next();
        
            this.txtItem11.setText(result11.getString("iName"));
            this.txtQ11.setText(result11.getString("iQtyA"));
            this.cmbSupp11.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                System.out.println(x);
                this.date11.setDate(convertStringToDate(x));
            }
            
            }
            
            
            // 2 .....................
            
            if(n1==2)
            {
            result11.next();
            
            this.txtItem11.setText(result11.getString("iName"));
            this.txtQ11.setText(result11.getString("iQtyA"));
            this.cmbSupp11.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date11.setDate(convertStringToDate(x));
            }
            result11.next();
        
            this.txtItem12.setText(result11.getString("iName"));
            this.txtQ12.setText(result11.getString("iQtyA"));
            this.cmbSupp12.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date12.setDate(convertStringToDate(x));
            }
            }
            
            // 3 .....................
            
            if(n1==3)
            {
            result11.next();
            this.txtItem11.setText(result11.getString("iName"));
            this.txtQ11.setText(result11.getString("iQtyA"));
            this.cmbSupp11.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date11.setDate(convertStringToDate(x));
            }
            result11.next();
             this.txtItem12.setText(result11.getString("iName"));
            this.txtQ12.setText(result11.getString("iQtyA"));
            this.cmbSupp12.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date12.setDate(convertStringToDate(x));
            }
            result11.next();
        
            this.txtItem13.setText(result11.getString("iName"));
            this.txtQ13.setText(result11.getString("iQtyA"));
            this.cmbSupp13.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date13.setDate(convertStringToDate(x));
            }
            }
            
            // 4 .....................
            
            if(n1==4)
            {
            result11.next();
            this.txtItem11.setText(result11.getString("iName"));
            this.txtQ11.setText(result11.getString("iQtyA"));
            this.cmbSupp11.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date11.setDate(convertStringToDate(x));
            }
            result11.next();
             this.txtItem12.setText(result11.getString("iName"));
            this.txtQ12.setText(result11.getString("iQtyA"));
            this.cmbSupp12.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date12.setDate(convertStringToDate(x));
            }
            result11.next();
            
            this.txtItem13.setText(result11.getString("iName"));
            this.txtQ13.setText(result11.getString("iQtyA"));
            this.cmbSupp13.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date13.setDate(convertStringToDate(x));
            }
            result11.next();
            
        
            this.txtItem14.setText(result11.getString("iName"));
            this.txtQ14.setText(result11.getString("iQtyA"));
            this.cmbSupp14.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date14.setDate(convertStringToDate(x));
            }
            }
            
            // 5 .....................
            
            if(n1==5)
            {
            result11.next();
            this.txtItem11.setText(result11.getString("iName"));
            this.txtQ11.setText(result11.getString("iQtyA"));
            this.cmbSupp11.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date11.setDate(convertStringToDate(x));
            }
            result11.next();
             this.txtItem12.setText(result11.getString("iName"));
            this.txtQ12.setText(result11.getString("iQtyA"));
            this.cmbSupp12.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date12.setDate(convertStringToDate(x));
            }
            result11.next();
            
            this.txtItem13.setText(result11.getString("iName"));
            this.txtQ13.setText(result11.getString("iQtyA"));
            this.cmbSupp13.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date13.setDate(convertStringToDate(x));
            }
            result11.next();
            
            this.txtItem14.setText(result11.getString("iName"));
            this.txtQ14.setText(result11.getString("iQtyA"));
            this.cmbSupp14.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date14.setDate(convertStringToDate(x));
            }
            result11.next();
        
            this.txtItem15.setText(result11.getString("iName"));
            this.txtQ15.setText(result11.getString("iQtyA"));
            this.cmbSupp15.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date15.setDate(convertStringToDate(x));
            }
            }
            
            // 6 .....................
            
            if(n1==6)
            {
            result11.next();
            this.txtItem11.setText(result11.getString("iName"));
            this.txtQ11.setText(result11.getString("iQtyA"));
            this.cmbSupp11.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date11.setDate(convertStringToDate(x));
            }
            result11.next();
             this.txtItem12.setText(result11.getString("iName"));
            this.txtQ12.setText(result11.getString("iQtyA"));
            this.cmbSupp12.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date12.setDate(convertStringToDate(x));
            }
            result11.next();
            this.txtItem13.setText(result11.getString("iName"));
            this.txtQ13.setText(result11.getString("iQtyA"));
            this.cmbSupp13.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date13.setDate(convertStringToDate(x));
            }
            result11.next();
            this.txtItem14.setText(result11.getString("iName"));
            this.txtQ14.setText(result11.getString("iQtyA"));
            this.cmbSupp14.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date14.setDate(convertStringToDate(x));
            }
            result11.next();
            
            this.txtItem15.setText(result11.getString("iName"));
            this.txtQ15.setText(result11.getString("iQtyA"));
            this.cmbSupp15.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date15.setDate(convertStringToDate(x));
            }
            result11.next();
        
            this.txtItem16.setText(result11.getString("iName"));
            this.txtQ16.setText(result11.getString("iQtyA"));
            this.cmbSupp16.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date16.setDate(convertStringToDate(x));
            }
            }
            
            // 7 .....................
            
            if(n1==7)
            {
                
            
            result11.next();
            this.txtItem11.setText(result11.getString("iName"));
            this.txtQ11.setText(result11.getString("iQtyA"));
            this.cmbSupp11.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date11.setDate(convertStringToDate(x));
            }
            result11.next();
             this.txtItem12.setText(result11.getString("iName"));
            this.txtQ12.setText(result11.getString("iQtyA"));
            this.cmbSupp12.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date12.setDate(convertStringToDate(x));
            }
            result11.next();
            
            this.txtItem13.setText(result11.getString("iName"));
            this.txtQ13.setText(result11.getString("iQtyA"));
            this.cmbSupp13.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date13.setDate(convertStringToDate(x));
            }
            result11.next();
            
            this.txtItem14.setText(result11.getString("iName"));
            this.txtQ14.setText(result11.getString("iQtyA"));
            this.cmbSupp14.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date14.setDate(convertStringToDate(x));
            }
            result11.next();
            
            this.txtItem15.setText(result11.getString("iName"));
            this.txtQ15.setText(result11.getString("iQtyA"));
            this.cmbSupp15.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date15.setDate(convertStringToDate(x));
            }
            result11.next();
            
            this.txtItem16.setText(result11.getString("iName"));
            this.txtQ16.setText(result11.getString("iQtyA"));
            this.cmbSupp16.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date16.setDate(convertStringToDate(x));
            }
            result11.next();
        
            this.txtItem17.setText(result11.getString("iName"));
            this.txtQ17.setText(result11.getString("iQtyA"));
            this.cmbSupp17.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date17.setDate(convertStringToDate(x));
            }
            }
            
            // 8 .....................
            
            if(n1==8)
            {
            result11.next();
            this.txtItem11.setText(result11.getString("iName"));
            this.txtQ11.setText(result11.getString("iQtyA"));
            this.cmbSupp11.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date11.setDate(convertStringToDate(x));
            }
            result11.next();
             this.txtItem12.setText(result11.getString("iName"));
            this.txtQ12.setText(result11.getString("iQtyA"));
            this.cmbSupp12.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date12.setDate(convertStringToDate(x));
            }
            result11.next();
            
            this.txtItem13.setText(result11.getString("iName"));
            this.txtQ13.setText(result11.getString("iQtyA"));
            this.cmbSupp13.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date13.setDate(convertStringToDate(x));
            }
            result11.next();
            
            this.txtItem14.setText(result11.getString("iName"));
            this.txtQ14.setText(result11.getString("iQtyA"));
            this.cmbSupp14.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date14.setDate(convertStringToDate(x));
            }
            result11.next();
            
            this.txtItem15.setText(result11.getString("iName"));
            this.txtQ15.setText(result11.getString("iQtyA"));
            this.cmbSupp15.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date15.setDate(convertStringToDate(x));
            }
            result11.next();
            
            this.txtItem16.setText(result11.getString("iName"));
            this.txtQ16.setText(result11.getString("iQtyA"));
            this.cmbSupp16.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date16.setDate(convertStringToDate(x));
            }
            result11.next();
        
            this.txtItem17.setText(result11.getString("iName"));
            this.txtQ17.setText(result11.getString("iQtyA"));
            this.cmbSupp17.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date17.setDate(convertStringToDate(x));
            }
            result11.next();
            
        
            this.txtItem18.setText(result11.getString("iName"));
            this.txtQ18.setText(result11.getString("iQtyA"));
            this.cmbSupp18.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date18.setDate(convertStringToDate(x));
            }
            
            }
            // 9 .....................
            
            if(n1==9)
            {
            result11.next();
            this.txtItem11.setText(result11.getString("iName"));
            this.txtQ11.setText(result11.getString("iQtyA"));
            this.cmbSupp11.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date11.setDate(convertStringToDate(x));
            }
            result11.next();
             this.txtItem12.setText(result11.getString("iName"));
            this.txtQ12.setText(result11.getString("iQtyA"));
            this.cmbSupp12.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date12.setDate(convertStringToDate(x));
            }
            result11.next();
            
            this.txtItem13.setText(result11.getString("iName"));
            this.txtQ13.setText(result11.getString("iQtyA"));
            this.cmbSupp13.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date13.setDate(convertStringToDate(x));
            }
            result11.next();
            
            this.txtItem14.setText(result11.getString("iName"));
            this.txtQ14.setText(result11.getString("iQtyA"));
            this.cmbSupp14.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date14.setDate(convertStringToDate(x));
            }
            result11.next();
            
            this.txtItem15.setText(result11.getString("iName"));
            this.txtQ15.setText(result11.getString("iQtyA"));
            this.cmbSupp15.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date15.setDate(convertStringToDate(x));
            }
            result11.next();
            
            this.txtItem16.setText(result11.getString("iName"));
            this.txtQ16.setText(result11.getString("iQtyA"));
            this.cmbSupp16.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date16.setDate(convertStringToDate(x));
            }
            result11.next();
        
            this.txtItem17.setText(result11.getString("iName"));
            this.txtQ17.setText(result11.getString("iQtyA"));
            this.cmbSupp17.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date17.setDate(convertStringToDate(x));
            }
            result11.next();
            
        
            this.txtItem18.setText(result11.getString("iName"));
            this.txtQ18.setText(result11.getString("iQtyA"));
            this.cmbSupp18.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date18.setDate(convertStringToDate(x));
            }
            result11.next();
        
            this.txtItem19.setText(result11.getString("iName"));
            this.txtQ19.setText(result11.getString("iQtyA"));
            this.cmbSupp19.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date19.setDate(convertStringToDate(x));
            }
            
            }
            // 10 .....................
            
            if(n1==10)
            {
            result11.next();
            this.txtItem11.setText(result11.getString("iName"));
            this.txtQ11.setText(result11.getString("iQtyA"));
            this.cmbSupp11.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date11.setDate(convertStringToDate(x));
            }
            result11.next();
             this.txtItem12.setText(result11.getString("iName"));
            this.txtQ12.setText(result11.getString("iQtyA"));
            this.cmbSupp12.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date12.setDate(convertStringToDate(x));
            }
            result11.next();
            
            this.txtItem13.setText(result11.getString("iName"));
            this.txtQ13.setText(result11.getString("iQtyA"));
            this.cmbSupp13.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date13.setDate(convertStringToDate(x));
            }
            result11.next();
            
            this.txtItem14.setText(result11.getString("iName"));
            this.txtQ14.setText(result11.getString("iQtyA"));
            this.cmbSupp14.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date14.setDate(convertStringToDate(x));
            }
            result11.next();
            
            this.txtItem15.setText(result11.getString("iName"));
            this.txtQ15.setText(result11.getString("iQtyA"));
            this.cmbSupp15.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date15.setDate(convertStringToDate(x));
            }
            result11.next();
            
            this.txtItem16.setText(result11.getString("iName"));
            this.txtQ16.setText(result11.getString("iQtyA"));
            this.cmbSupp16.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date16.setDate(convertStringToDate(x));
            }
            result11.next();
        
            this.txtItem17.setText(result11.getString("iName"));
            this.txtQ17.setText(result11.getString("iQtyA"));
            this.cmbSupp17.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date17.setDate(convertStringToDate(x));
            }
            result11.next();
            
        
            this.txtItem18.setText(result11.getString("iName"));
            this.txtQ18.setText(result11.getString("iQtyA"));
            this.cmbSupp18.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date18.setDate(convertStringToDate(x));
            }
            result11.next();
        
            this.txtItem19.setText(result11.getString("iName"));
            this.txtQ19.setText(result11.getString("iQtyA"));
            this.cmbSupp19.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date19.setDate(convertStringToDate(x));
            }
            result11.next();
           
        
            this.txtItem20.setText(result11.getString("iName"));
            this.txtQ20.setText(result11.getString("iQtyA"));
            this.cmbSupp20.setSelectedItem(result11.getString("iSupplier"));
            if(result11.getString("iGdate").equals("00-00-00"))
            {
            }
            else
            {
                String x = result11.getString("iGdate");
                this.date20.setDate(convertStringToDate(x));
            }
        
            
            }
        }
        catch(Exception e)
        {
            JOptionPane.showMessageDialog(null, e.getMessage(),"METROPOLITAN ENGINEERING (PVT) LTD", 1);
        }
        
        
    }//GEN-LAST:event_btnAddProject1ActionPerformed

    private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveActionPerformed
        // TODO add your handling code here:
         //getting old todat
        
        int xxxx=JOptionPane.showConfirmDialog(null,"Editing project will restore default values on shipment arrivals. Do you want to continue?",
            "METROPOLITAN ENGINEERING (PVT) LTD",0,3 );
       
       if(xxxx==0)
       {
        
         String endDate = "1900/00/00";
        
        Date date;
        date = this.jDateChooser2.getDate();

        if(date == null)
        {
            //do nothing
        }
        else
            endDate = getDateInString(this.jDateChooser2.getDate());
        
        
           
           String adadine="fdsa";
           
           String selected = this.txtProID1.getText().toString();
        
        String gen = "select * from project where pID = '"+selected+"'";
       
        
        ResultSet result1= db1.executeSQLQuery(gen);
        
        
        try
        {
        while(result1.next())
        {
           
            
            adadine = getDateInString(result1.getDate("pSdate"));
            
           
           
        }
        
        }
        catch(Exception e)
        {
            JOptionPane.showMessageDialog(null, e.getMessage(),"METROPOLITAN ENGINEERING (PVT) LTD!", 1);
        }
           
           //finihsed getting old today
        
        
        
        String key = this.txtProID1.getText().toString();
        
        
        
        //deleling records
        
        String queryd1 = "delete from item where iPID = '"+key+"'";
         String queryd2 = "delete from project where pID='"+key+"'";
           

           int xxx = db1.executeNonQuery(queryd1);
           int xx = db1.executeNonQuery(queryd2);
           
           /*
           if(xxx==-1 || xx==-1)
               JOptionPane.showMessageDialog(null, "Error in Database. Please Reconnect! ","Error!", 1);
           else
               JOptionPane.showMessageDialog(null, "Records removed sucessfully! ","Sucessful!", 1);
           
           */
          
        //inserting data back
           
          
        
        
            String pID = selected;
            String pName =this.cmbProName.getSelectedItem().toString();
            String pSdate = adadine;
            
            String pGsupplier = this.cmbSuppGlobal1.getSelectedItem().toString();
            String pStatus = "pending";
            String pAvailability = "YES";
        
        
        
            if(this.txtItem11.getText().equals("") && this.txtItem12.getText().equals("") && this.txtItem13.getText().equals("") && this.txtItem14.getText().equals("") && this.txtItem15.getText().equals("") && this.txtItem16.getText().equals("") && this.txtItem17.getText().equals("") && this.txtItem18.getText().equals("") && this.txtItem19.getText().equals("") && this.txtItem20.getText().equals(""))
            {
                JOptionPane.showMessageDialog(null, "This project has no components! Insert atleast one component to continue!","METROPOLITAN ENGINEERING (PVT) LTD", 1);
            }
            else
            {
                
                Date dates[] = new Date[10];
                
                try
                {
                dates[0] = this.date11.getDate();
                dates[1] = this.date12.getDate();
                dates[2] = this.date13.getDate();
                dates[3] = this.date14.getDate();
                dates[4] = this.date15.getDate();
                dates[5] = this.date16.getDate();
                dates[6] = this.date17.getDate();
                dates[7] = this.date18.getDate();
                dates[8] = this.date19.getDate();
                dates[9] = this.date20.getDate();
                }
                catch(Exception e)
                {
                    System.out.println(e.getMessage());
                }
                
                String datee[] = new String[10];
                datee[0] = "00/00/00";
                datee[1] = "00/00/00";
                datee[2] = "00/00/00";
                datee[3] = "00/00/00";
                datee[4] = "00/00/00";
                datee[5] = "00/00/00";
                datee[6] = "00/00/00";
                datee[7] = "00/00/00";
                datee[8] = "00/00/00";
                datee[9] = "00/00/00";

                
                
                
                String qty[] = new String[10];
                qty[0] = this.txtQ11.getText().toString();
                qty[1] = this.txtQ12.getText().toString();
                qty[2] = this.txtQ13.getText().toString();
                qty[3] = this.txtQ14.getText().toString();
                qty[4] = this.txtQ15.getText().toString();
                qty[5] = this.txtQ16.getText().toString();
                qty[6] = this.txtQ17.getText().toString();
                qty[7] = this.txtQ18.getText().toString();
                qty[8] = this.txtQ19.getText().toString();
                qty[9] = this.txtQ20.getText().toString();
                
                String item[] = new String[10];
                item[0] = this.txtItem11.getText();
                item[1] = this.txtItem12.getText();
                item[2] = this.txtItem13.getText();
                item[3] = this.txtItem14.getText();
                item[4] = this.txtItem15.getText();
                item[5] = this.txtItem16.getText();
                item[6] = this.txtItem17.getText();
                item[7] = this.txtItem18.getText();
                item[8] = this.txtItem19.getText();
                item[9] = this.txtItem20.getText();
                
                
                String supplier[] = new String[10];
                supplier[0] = this.cmbSupp11.getSelectedItem().toString();
                supplier[1] = this.cmbSupp12.getSelectedItem().toString();
                supplier[2] = this.cmbSupp13.getSelectedItem().toString();
                supplier[3] = this.cmbSupp14.getSelectedItem().toString();
                supplier[4] = this.cmbSupp15.getSelectedItem().toString();
                supplier[5] = this.cmbSupp16.getSelectedItem().toString();
                supplier[6] = this.cmbSupp17.getSelectedItem().toString();
                supplier[7] = this.cmbSupp18.getSelectedItem().toString();
                supplier[8] = this.cmbSupp19.getSelectedItem().toString();
                supplier[9] = this.cmbSupp20.getSelectedItem().toString();
                
                Date globalDate = this.dateGlobal1.getDate();
                String dateGlobal = "1900/00/00";
                
                String supplierGlobal = this.cmbSuppGlobal1.getSelectedItem().toString();
                
                //calculate entered items
                
                int enteredItems = 0;
                
                for(int x=0; x<10; x++)
                {
                    if(!item[x].equals(""))
                        enteredItems +=1;
                }
                
                System.out.println(enteredItems);
                
                
                //generating queryies
                
                //item 1......................................................
                
               if(enteredItems==1)
               {
                   
                   if(globalDate==null)
                   {
                        dateGlobal = "1900/00/00";
                        datee[0] = getDateInString(dates[0]);
                   }
                   else
                   {
                       
                       dateGlobal = getDateInString(globalDate);
                       datee[0] = getDateInString(globalDate);
                      
                    }
                   
                   if(!this.cmbSuppGlobal1.getSelectedItem().toString().equals("Not Available"))
                   {
                       for(int x=0; x<10; x++)
                           supplier[x] = this.cmbSuppGlobal1.getSelectedItem().toString();
                   }
                   
                   
                   PreparedStatement stmt1 = null;
                   PreparedStatement stmt2 = null;
                   
                   int x1=0, x2=0;
                   try{
                   stmt1 = con1.prepareStatement("INSERT INTO project values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt1.setString(1, pID);
                   stmt1.setString(2, pName);
                   stmt1.setString(3, pSdate);
                   stmt1.setString(4, dateGlobal);
                   stmt1.setString(5, pGsupplier);
                   stmt1.setString(6, pStatus);
                   stmt1.setString(7, pAvailability);
                   stmt1.setString(8, endDate);
                   x1 = stmt1.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt2 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt2.setString(1, getItemId());
                   stmt2.setString(2, item[0]);
                   stmt2.setString(3, datee[0]);
                   stmt2.setString(4, supplier[0]);
                   stmt2.setString(5, qty[0]);
                   stmt2.setString(6, qty[0]);
                   stmt2.setString(7, pStatus);
                   stmt2.setString(8, pID);
                   x2 = stmt2.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }


                  if(x1>0 && x2>0)
                      JOptionPane.showMessageDialog(null, "Records Updated sucessfully! ","METROPOLITAN ENGINEERING (PVT) LTD!", 1);
                   else
                       JOptionPane.showMessageDialog(null, "Error in Database. Please Reconnect! ","METROPOLITAN ENGINEERING (PVT) LTD", 1);

               }
               
               //item 2............................................................................................
               
               if(enteredItems==2)
               {
                   if(globalDate==null)
                   {
                        dateGlobal = "1900/00/00";
                        datee[0] = getDateInString(dates[0]);
                        datee[1] = getDateInString(dates[1]);
                   }
                   else
                   {
                       
                     
                       datee[0] = getDateInString(globalDate);
                       datee[1] = getDateInString(globalDate);
                      
                    }
                   
                   if(!this.cmbSuppGlobal1.getSelectedItem().toString().equals("Not Available"))
                   {
                       for(int x=0; x<10; x++)
                           supplier[x] = this.cmbSuppGlobal1.getSelectedItem().toString();
                   }
                   
                   
                   PreparedStatement stmt1 = null;
                   PreparedStatement stmt2 = null;
                   PreparedStatement stmt3 = null;
                   
                   int x1=0, x2=0, x3=0;
                   try{
                   stmt1 = con1.prepareStatement("INSERT INTO project values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt1.setString(1, pID);
                   stmt1.setString(2, pName);
                   stmt1.setString(3, pSdate);
                   stmt1.setString(4, dateGlobal);
                   stmt1.setString(5, pGsupplier);
                   stmt1.setString(6, pStatus);
                   stmt1.setString(7, pAvailability);
                   stmt1.setString(8, endDate);
                   x1 = stmt1.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt2 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt2.setString(1, getItemId());
                   stmt2.setString(2, item[0]);
                   stmt2.setString(3, datee[0]);
                   stmt2.setString(4, supplier[0]);
                   stmt2.setString(5, qty[0]);
                   stmt2.setString(6, qty[0]);
                   stmt2.setString(7, pStatus);
                   stmt2.setString(8, pID);
                   x2 = stmt2.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt3 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt3.setString(1, getItemId());
                   stmt3.setString(2, item[1]);
                   stmt3.setString(3, datee[1]);
                   stmt3.setString(4, supplier[1]);
                   stmt3.setString(5, qty[1]);
                   stmt3.setString(6, qty[1]);
                   stmt3.setString(7, pStatus);
                   stmt3.setString(8, pID);
                   x3 = stmt3.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }


                  if(x1>0 && x2>0 && x3>0)
                      JOptionPane.showMessageDialog(null, "Records Updated sucessfully! ","METROPOLITAN ENGINEERING (PVT) LTD", 1);
                   else
                       JOptionPane.showMessageDialog(null, "Error in Database. Please Reconnect! ","METROPOLITAN ENGINEERING (PVT) LTD", 1);
               }
               
               //item 3 ...................................................
               
               
               if(enteredItems==3)
               {
                   if(globalDate==null)
                   {
                        dateGlobal = "1900/00/00";
                        datee[0] = getDateInString(dates[0]);
                        datee[1] = getDateInString(dates[1]);
                        datee[2] = getDateInString(dates[2]);
                   }
                   else
                   {
                       
                     
                       datee[0] = getDateInString(globalDate);
                       datee[1] = getDateInString(globalDate);
                       datee[2] = getDateInString(globalDate);
                      
                    }
                   
                   if(!this.cmbSuppGlobal1.getSelectedItem().toString().equals("Not Available"))
                   {
                       for(int x=0; x<10; x++)
                           supplier[x] = this.cmbSuppGlobal1.getSelectedItem().toString();
                   }
                   
                   
                   PreparedStatement stmt1 = null;
                   PreparedStatement stmt2 = null;
                   PreparedStatement stmt3 = null;
                   PreparedStatement stmt4 = null;
                   
                   int x1=0, x2=0, x3=0, x4=0;
                   try{
                   stmt1 = con1.prepareStatement("INSERT INTO project values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt1.setString(1, pID);
                   stmt1.setString(2, pName);
                   stmt1.setString(3, pSdate);
                   stmt1.setString(4, dateGlobal);
                   stmt1.setString(5, pGsupplier);
                   stmt1.setString(6, pStatus);
                   stmt1.setString(7, pAvailability);
                   stmt1.setString(8, endDate);
                   x1 = stmt1.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt2 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt2.setString(1, getItemId());
                   stmt2.setString(2, item[0]);
                   stmt2.setString(3, datee[0]);
                   stmt2.setString(4, supplier[0]);
                   stmt2.setString(5, qty[0]);
                   stmt2.setString(6, qty[0]);
                   stmt2.setString(7, pStatus);
                   stmt2.setString(8, pID);
                   x2 = stmt2.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt3 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt3.setString(1, getItemId());
                   stmt3.setString(2, item[1]);
                   stmt3.setString(3, datee[1]);
                   stmt3.setString(4, supplier[1]);
                   stmt3.setString(5, qty[1]);
                   stmt3.setString(6, qty[1]);
                   stmt3.setString(7, pStatus);
                   stmt3.setString(8, pID);
                   x3 = stmt3.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt4 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt4.setString(1, getItemId());
                   stmt4.setString(2, item[2]);
                   stmt4.setString(3, datee[2]);
                   stmt4.setString(4, supplier[2]);
                   stmt4.setString(5, qty[2]);
                   stmt4.setString(6, qty[2]);
                   stmt4.setString(7, pStatus);
                   stmt4.setString(8, pID);
                   x4 = stmt4.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }


                  if(x1>0 && x2>0 && x3>0 && x4>0)
                      JOptionPane.showMessageDialog(null, "Records Updated sucessfully! ","METROPOLITAN ENGINEERING (PVT) LTD", 1);
                   else
                       JOptionPane.showMessageDialog(null, "Error in Database. Please Reconnect! ","METROPOLITAN ENGINEERING (PVT) LTD", 1);
               }
               
               //item 4.......................................................
               
               if(enteredItems==4)
               {
                   if(globalDate==null)
                   {
                        dateGlobal = "1900/00/00";
                        datee[0] = getDateInString(dates[0]);
                        datee[1] = getDateInString(dates[1]);
                        datee[2] = getDateInString(dates[2]);
                        datee[3] = getDateInString(dates[3]);
                   }
                   else
                   {
                       
                     
                       datee[0] = getDateInString(globalDate);
                       datee[1] = getDateInString(globalDate);
                       datee[2] = getDateInString(globalDate);
                       datee[3] = getDateInString(globalDate);
                      
                    }
                   
                   if(!this.cmbSuppGlobal1.getSelectedItem().toString().equals("Not Available"))
                   {
                       for(int x=0; x<10; x++)
                           supplier[x] = this.cmbSuppGlobal1.getSelectedItem().toString();
                   }
                   
                   
                   PreparedStatement stmt1 = null;
                   PreparedStatement stmt2 = null;
                   PreparedStatement stmt3 = null;
                   PreparedStatement stmt4 = null;
                   PreparedStatement stmt5 = null;
                   
                   int x1=0, x2=0, x3=0, x4=0, x5=0;
                   try{
                   stmt1 = con1.prepareStatement("INSERT INTO project values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt1.setString(1, pID);
                   stmt1.setString(2, pName);
                   stmt1.setString(3, pSdate);
                   stmt1.setString(4, dateGlobal);
                   stmt1.setString(5, pGsupplier);
                   stmt1.setString(6, pStatus);
                   stmt1.setString(7, pAvailability);
                   stmt1.setString(8, endDate);
                   x1 = stmt1.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt2 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt2.setString(1, getItemId());
                   stmt2.setString(2, item[0]);
                   stmt2.setString(3, datee[0]);
                   stmt2.setString(4, supplier[0]);
                   stmt2.setString(5, qty[0]);
                   stmt2.setString(6, qty[0]);
                   stmt2.setString(7, pStatus);
                   stmt2.setString(8, pID);
                   x2 = stmt2.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt3 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt3.setString(1, getItemId());
                   stmt3.setString(2, item[1]);
                   stmt3.setString(3, datee[1]);
                   stmt3.setString(4, supplier[1]);
                   stmt3.setString(5, qty[1]);
                   stmt3.setString(6, qty[1]);
                   stmt3.setString(7, pStatus);
                   stmt3.setString(8, pID);
                   x3 = stmt3.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt4 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt4.setString(1, getItemId());
                   stmt4.setString(2, item[2]);
                   stmt4.setString(3, datee[2]);
                   stmt4.setString(4, supplier[2]);
                   stmt4.setString(5, qty[2]);
                   stmt4.setString(6, qty[2]);
                   stmt4.setString(7, pStatus);
                   stmt4.setString(8, pID);
                   x4 = stmt4.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt5 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt5.setString(1, getItemId());
                   stmt5.setString(2, item[3]);
                   stmt5.setString(3, datee[3]);
                   stmt5.setString(4, supplier[3]);
                   stmt5.setString(5, qty[3]);
                   stmt5.setString(6, qty[3]);
                   stmt5.setString(7, pStatus);
                   stmt5.setString(8, pID);
                   x5 = stmt5.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }


                  if(x1>0 && x2>0 && x3>0 && x4>0 && x5>0)
                      JOptionPane.showMessageDialog(null, "Records Updated sucessfully! ","METROPOLITAN ENGINEERING (PVT) LTD", 1);
                   else
                       JOptionPane.showMessageDialog(null, "Error in Database. Please Reconnect! ","METROPOLITAN ENGINEERING (PVT) LTD", 1);
               }
               
               //item 5 ................................................................
               
               if(enteredItems==5)
               {
                   if(globalDate==null)
                   {
                        dateGlobal = "1900/00/00";
                        datee[0] = getDateInString(dates[0]);
                        datee[1] = getDateInString(dates[1]);
                        datee[2] = getDateInString(dates[2]);
                        datee[3] = getDateInString(dates[3]);
                        datee[4] = getDateInString(dates[4]);
                   }
                   else
                   {
                       
                     
                       datee[0] = getDateInString(globalDate);
                       datee[1] = getDateInString(globalDate);
                       datee[2] = getDateInString(globalDate);
                       datee[3] = getDateInString(globalDate);
                       datee[4] = getDateInString(globalDate);
                      
                    }
                   
                   if(!this.cmbSuppGlobal1.getSelectedItem().toString().equals("Not Available"))
                   {
                       for(int x=0; x<10; x++)
                           supplier[x] = this.cmbSuppGlobal1.getSelectedItem().toString();
                   }
                   
                   
                   PreparedStatement stmt1 = null;
                   PreparedStatement stmt2 = null;
                   PreparedStatement stmt3 = null;
                   PreparedStatement stmt4 = null;
                   PreparedStatement stmt5 = null;
                   PreparedStatement stmt6 = null;
                   
                   int x1=0, x2=0, x3=0, x4=0, x5=0, x6=0;
                   try{
                   stmt1 = con1.prepareStatement("INSERT INTO project values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt1.setString(1, pID);
                   stmt1.setString(2, pName);
                   stmt1.setString(3, pSdate);
                   stmt1.setString(4, dateGlobal);
                   stmt1.setString(5, pGsupplier);
                   stmt1.setString(6, pStatus);
                   stmt1.setString(7, pAvailability);
                   stmt1.setString(8, endDate);
                   x1 = stmt1.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt2 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt2.setString(1, getItemId());
                   stmt2.setString(2, item[0]);
                   stmt2.setString(3, datee[0]);
                   stmt2.setString(4, supplier[0]);
                   stmt2.setString(5, qty[0]);
                   stmt2.setString(6, qty[0]);
                   stmt2.setString(7, pStatus);
                   stmt2.setString(8, pID);
                   x2 = stmt2.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt3 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt3.setString(1, getItemId());
                   stmt3.setString(2, item[1]);
                   stmt3.setString(3, datee[1]);
                   stmt3.setString(4, supplier[1]);
                   stmt3.setString(5, qty[1]);
                   stmt3.setString(6, qty[1]);
                   stmt3.setString(7, pStatus);
                   stmt3.setString(8, pID);
                   x3 = stmt3.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt4 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt4.setString(1, getItemId());
                   stmt4.setString(2, item[2]);
                   stmt4.setString(3, datee[2]);
                   stmt4.setString(4, supplier[2]);
                   stmt4.setString(5, qty[2]);
                   stmt4.setString(6, qty[2]);
                   stmt4.setString(7, pStatus);
                   stmt4.setString(8, pID);
                   x4 = stmt4.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt5 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt5.setString(1, getItemId());
                   stmt5.setString(2, item[3]);
                   stmt5.setString(3, datee[3]);
                   stmt5.setString(4, supplier[3]);
                   stmt5.setString(5, qty[3]);
                   stmt5.setString(6, qty[3]);
                   stmt5.setString(7, pStatus);
                   stmt5.setString(8, pID);
                   x5 = stmt5.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt6 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt6.setString(1, getItemId());
                   stmt6.setString(2, item[4]);
                   stmt6.setString(3, datee[4]);
                   stmt6.setString(4, supplier[4]);
                   stmt6.setString(5, qty[4]);
                   stmt6.setString(6, qty[4]);
                   stmt6.setString(7, pStatus);
                   stmt6.setString(8, pID);
                   x6 = stmt6.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }


                  if(x1>0 && x2>0 && x3>0 && x4>0 && x5>0 && x6>0)
                      JOptionPane.showMessageDialog(null, "Records Updated sucessfully! ","METROPOLITAN ENGINEERING (PVT) LTD", 1);
                   else
                       JOptionPane.showMessageDialog(null, "Error in Database. Please Reconnect! ","METROPOLITAN ENGINEERING (PVT) LTD", 1);
               }
               
               //item 6..............................................................
               
               
               if(enteredItems==6)
               {
                   if(globalDate==null)
                   {
                        dateGlobal = "1900/00/00";
                        datee[0] = getDateInString(dates[0]);
                        datee[1] = getDateInString(dates[1]);
                        datee[2] = getDateInString(dates[2]);
                        datee[3] = getDateInString(dates[3]);
                        datee[4] = getDateInString(dates[4]);
                        datee[5] = getDateInString(dates[5]);
                   }
                   else
                   {
                       
                     
                       datee[0] = getDateInString(globalDate);
                       datee[1] = getDateInString(globalDate);
                       datee[2] = getDateInString(globalDate);
                       datee[3] = getDateInString(globalDate);
                       datee[4] = getDateInString(globalDate);
                       datee[5] = getDateInString(globalDate);
                      
                    }
                   
                   if(!this.cmbSuppGlobal1.getSelectedItem().toString().equals("Not Available"))
                   {
                       for(int x=0; x<10; x++)
                           supplier[x] = this.cmbSuppGlobal1.getSelectedItem().toString();
                   }
                   
                   
                   PreparedStatement stmt1 = null;
                   PreparedStatement stmt2 = null;
                   PreparedStatement stmt3 = null;
                   PreparedStatement stmt4 = null;
                   PreparedStatement stmt5 = null;
                   PreparedStatement stmt6 = null;
                   PreparedStatement stmt7 = null;
                   
                   int x1=0, x2=0, x3=0, x4=0, x5=0, x6=0, x7=0;
                   try{
                   stmt1 = con1.prepareStatement("INSERT INTO project values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt1.setString(1, pID);
                   stmt1.setString(2, pName);
                   stmt1.setString(3, pSdate);
                   stmt1.setString(4, dateGlobal);
                   stmt1.setString(5, pGsupplier);
                   stmt1.setString(6, pStatus);
                   stmt1.setString(7, pAvailability);
                   stmt1.setString(8, endDate);
                   x1 = stmt1.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt2 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt2.setString(1, getItemId());
                   stmt2.setString(2, item[0]);
                   stmt2.setString(3, datee[0]);
                   stmt2.setString(4, supplier[0]);
                   stmt2.setString(5, qty[0]);
                   stmt2.setString(6, qty[0]);
                   stmt2.setString(7, pStatus);
                   stmt2.setString(8, pID);
                   x2 = stmt2.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt3 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt3.setString(1, getItemId());
                   stmt3.setString(2, item[1]);
                   stmt3.setString(3, datee[1]);
                   stmt3.setString(4, supplier[1]);
                   stmt3.setString(5, qty[1]);
                   stmt3.setString(6, qty[1]);
                   stmt3.setString(7, pStatus);
                   stmt3.setString(8, pID);
                   x3 = stmt3.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt4 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt4.setString(1, getItemId());
                   stmt4.setString(2, item[2]);
                   stmt4.setString(3, datee[2]);
                   stmt4.setString(4, supplier[2]);
                   stmt4.setString(5, qty[2]);
                   stmt4.setString(6, qty[2]);
                   stmt4.setString(7, pStatus);
                   stmt4.setString(8, pID);
                   x4 = stmt4.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt5 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt5.setString(1, getItemId());
                   stmt5.setString(2, item[3]);
                   stmt5.setString(3, datee[3]);
                   stmt5.setString(4, supplier[3]);
                   stmt5.setString(5, qty[3]);
                   stmt5.setString(6, qty[3]);
                   stmt5.setString(7, pStatus);
                   stmt5.setString(8, pID);
                   x5 = stmt5.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt6 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt6.setString(1, getItemId());
                   stmt6.setString(2, item[4]);
                   stmt6.setString(3, datee[4]);
                   stmt6.setString(4, supplier[4]);
                   stmt6.setString(5, qty[4]);
                   stmt6.setString(6, qty[4]);
                   stmt6.setString(7, pStatus);
                   stmt6.setString(8, pID);
                   x6 = stmt6.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt7 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt7.setString(1, getItemId());
                   stmt7.setString(2, item[5]);
                   stmt7.setString(3, datee[5]);
                   stmt7.setString(4, supplier[5]);
                   stmt7.setString(5, qty[5]);
                   stmt7.setString(6, qty[5]);
                   stmt7.setString(7, pStatus);
                   stmt7.setString(8, pID);
                   x7 = stmt7.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }


                  if(x1>0 && x2>0 && x3>0 && x4>0 && x5>0 && x6>0 && x7>0)
                      JOptionPane.showMessageDialog(null, "Records Updated sucessfully! ","METROPOLITAN ENGINEERING (PVT) LTD", 1);
                   else
                       JOptionPane.showMessageDialog(null, "Error in Database. Please Reconnect! ","METROPOLITAN ENGINEERING (PVT) LTD", 1);
               }
               
               //Item 7 ........................................
               
               if(enteredItems==7)
               {
                   if(globalDate==null)
                   {
                        dateGlobal = "1900/00/00";
                        datee[0] = getDateInString(dates[0]);
                        datee[1] = getDateInString(dates[1]);
                        datee[2] = getDateInString(dates[2]);
                        datee[3] = getDateInString(dates[3]);
                        datee[4] = getDateInString(dates[4]);
                        datee[5] = getDateInString(dates[5]);
                        datee[6] = getDateInString(dates[6]);
                   }
                   else
                   {
                       
                     
                       datee[0] = getDateInString(globalDate);
                       datee[1] = getDateInString(globalDate);
                       datee[2] = getDateInString(globalDate);
                       datee[3] = getDateInString(globalDate);
                       datee[4] = getDateInString(globalDate);
                       datee[5] = getDateInString(globalDate);
                       datee[6] = getDateInString(globalDate);
                      
                    }
                   
                   if(!this.cmbSuppGlobal1.getSelectedItem().toString().equals("Not Available"))
                   {
                       for(int x=0; x<10; x++)
                           supplier[x] = this.cmbSuppGlobal1.getSelectedItem().toString();
                   }
                   
                   
                   PreparedStatement stmt1 = null;
                   PreparedStatement stmt2 = null;
                   PreparedStatement stmt3 = null;
                   PreparedStatement stmt4 = null;
                   PreparedStatement stmt5 = null;
                   PreparedStatement stmt6 = null;
                   PreparedStatement stmt7 = null;
                   PreparedStatement stmt8 = null;
                   
                   int x1=0, x2=0, x3=0, x4=0, x5=0, x6=0, x7=0, x8=0;
                   try{
                   stmt1 = con1.prepareStatement("INSERT INTO project values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt1.setString(1, pID);
                   stmt1.setString(2, pName);
                   stmt1.setString(3, pSdate);
                   stmt1.setString(4, dateGlobal);
                   stmt1.setString(5, pGsupplier);
                   stmt1.setString(6, pStatus);
                   stmt1.setString(7, pAvailability);
                   stmt1.setString(8, endDate);
                   x1 = stmt1.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt2 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt2.setString(1, getItemId());
                   stmt2.setString(2, item[0]);
                   stmt2.setString(3, datee[0]);
                   stmt2.setString(4, supplier[0]);
                   stmt2.setString(5, qty[0]);
                   stmt2.setString(6, qty[0]);
                   stmt2.setString(7, pStatus);
                   stmt2.setString(8, pID);
                   x2 = stmt2.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt3 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt3.setString(1, getItemId());
                   stmt3.setString(2, item[1]);
                   stmt3.setString(3, datee[1]);
                   stmt3.setString(4, supplier[1]);
                   stmt3.setString(5, qty[1]);
                   stmt3.setString(6, qty[1]);
                   stmt3.setString(7, pStatus);
                   stmt3.setString(8, pID);
                   x3 = stmt3.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt4 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt4.setString(1, getItemId());
                   stmt4.setString(2, item[2]);
                   stmt4.setString(3, datee[2]);
                   stmt4.setString(4, supplier[2]);
                   stmt4.setString(5, qty[2]);
                   stmt4.setString(6, qty[2]);
                   stmt4.setString(7, pStatus);
                   stmt4.setString(8, pID);
                   x4 = stmt4.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt5 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt5.setString(1, getItemId());
                   stmt5.setString(2, item[3]);
                   stmt5.setString(3, datee[3]);
                   stmt5.setString(4, supplier[3]);
                   stmt5.setString(5, qty[3]);
                   stmt5.setString(6, qty[3]);
                   stmt5.setString(7, pStatus);
                   stmt5.setString(8, pID);
                   x5 = stmt5.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt6 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt6.setString(1, getItemId());
                   stmt6.setString(2, item[4]);
                   stmt6.setString(3, datee[4]);
                   stmt6.setString(4, supplier[4]);
                   stmt6.setString(5, qty[4]);
                   stmt6.setString(6, qty[4]);
                   stmt6.setString(7, pStatus);
                   stmt6.setString(8, pID);
                   x6 = stmt6.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt7 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt7.setString(1, getItemId());
                   stmt7.setString(2, item[5]);
                   stmt7.setString(3, datee[5]);
                   stmt7.setString(4, supplier[5]);
                   stmt7.setString(5, qty[5]);
                   stmt7.setString(6, qty[5]);
                   stmt7.setString(7, pStatus);
                   stmt7.setString(8, pID);
                   x7 = stmt7.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt8 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt8.setString(1, getItemId());
                   stmt8.setString(2, item[6]);
                   stmt8.setString(3, datee[6]);
                   stmt8.setString(4, supplier[6]);
                   stmt8.setString(5, qty[6]);
                   stmt8.setString(6, qty[6]);
                   stmt8.setString(7, pStatus);
                   stmt8.setString(8, pID);
                   x8 = stmt8.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }


                  if(x1>0 && x2>0 && x3>0 && x4>0 && x5>0 && x6>0 && x7>0 && x8>0)
                      JOptionPane.showMessageDialog(null, "Records Updated sucessfully! ","METROPOLITAN ENGINEERING (PVT) LTD", 1);
                   else
                       JOptionPane.showMessageDialog(null, "Error in Database. Please Reconnect! ","METROPOLITAN ENGINEERING (PVT) LTD", 1);
               }
               
               //item 8 ....................................................
               
               if(enteredItems==8)
               {
                   if(globalDate==null)
                   {
                        dateGlobal = "1900/00/00";
                        datee[0] = getDateInString(dates[0]);
                        datee[1] = getDateInString(dates[1]);
                        datee[2] = getDateInString(dates[2]);
                        datee[3] = getDateInString(dates[3]);
                        datee[4] = getDateInString(dates[4]);
                        datee[5] = getDateInString(dates[5]);
                        datee[6] = getDateInString(dates[6]);
                        datee[7] = getDateInString(dates[7]);
                   }
                   else
                   {
                       
                     
                       datee[0] = getDateInString(globalDate);
                       datee[1] = getDateInString(globalDate);
                       datee[2] = getDateInString(globalDate);
                       datee[3] = getDateInString(globalDate);
                       datee[4] = getDateInString(globalDate);
                       datee[5] = getDateInString(globalDate);
                       datee[6] = getDateInString(globalDate);
                       datee[7] = getDateInString(globalDate);
                      
                    }
                   
                   if(!this.cmbSuppGlobal1.getSelectedItem().toString().equals("Not Available"))
                   {
                       for(int x=0; x<10; x++)
                           supplier[x] = this.cmbSuppGlobal1.getSelectedItem().toString();
                   }
                   
                   
                   PreparedStatement stmt1 = null;
                   PreparedStatement stmt2 = null;
                   PreparedStatement stmt3 = null;
                   PreparedStatement stmt4 = null;
                   PreparedStatement stmt5 = null;
                   PreparedStatement stmt6 = null;
                   PreparedStatement stmt7 = null;
                   PreparedStatement stmt8 = null;
                   PreparedStatement stmt9 = null;
                   
                   int x1=0, x2=0, x3=0, x4=0, x5=0, x6=0, x7=0, x8=0, x9=0;
                   try{
                   stmt1 = con1.prepareStatement("INSERT INTO project values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt1.setString(1, pID);
                   stmt1.setString(2, pName);
                   stmt1.setString(3, pSdate);
                   stmt1.setString(4, dateGlobal);
                   stmt1.setString(5, pGsupplier);
                   stmt1.setString(6, pStatus);
                   stmt1.setString(7, pAvailability);
                   stmt1.setString(8, endDate);
                   x1 = stmt1.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt2 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt2.setString(1, getItemId());
                   stmt2.setString(2, item[0]);
                   stmt2.setString(3, datee[0]);
                   stmt2.setString(4, supplier[0]);
                   stmt2.setString(5, qty[0]);
                   stmt2.setString(6, qty[0]);
                   stmt2.setString(7, pStatus);
                   stmt2.setString(8, pID);
                   x2 = stmt2.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt3 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt3.setString(1, getItemId());
                   stmt3.setString(2, item[1]);
                   stmt3.setString(3, datee[1]);
                   stmt3.setString(4, supplier[1]);
                   stmt3.setString(5, qty[1]);
                   stmt3.setString(6, qty[1]);
                   stmt3.setString(7, pStatus);
                   stmt3.setString(8, pID);
                   x3 = stmt3.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt4 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt4.setString(1, getItemId());
                   stmt4.setString(2, item[2]);
                   stmt4.setString(3, datee[2]);
                   stmt4.setString(4, supplier[2]);
                   stmt4.setString(5, qty[2]);
                   stmt4.setString(6, qty[2]);
                   stmt4.setString(7, pStatus);
                   stmt4.setString(8, pID);
                   x4 = stmt4.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt5 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt5.setString(1, getItemId());
                   stmt5.setString(2, item[3]);
                   stmt5.setString(3, datee[3]);
                   stmt5.setString(4, supplier[3]);
                   stmt5.setString(5, qty[3]);
                   stmt5.setString(6, qty[3]);
                   stmt5.setString(7, pStatus);
                   stmt5.setString(8, pID);
                   x5 = stmt5.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt6 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt6.setString(1, getItemId());
                   stmt6.setString(2, item[4]);
                   stmt6.setString(3, datee[4]);
                   stmt6.setString(4, supplier[4]);
                   stmt6.setString(5, qty[4]);
                   stmt6.setString(6, qty[4]);
                   stmt6.setString(7, pStatus);
                   stmt6.setString(8, pID);
                   x6 = stmt6.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt7 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt7.setString(1, getItemId());
                   stmt7.setString(2, item[5]);
                   stmt7.setString(3, datee[5]);
                   stmt7.setString(4, supplier[5]);
                   stmt7.setString(5, qty[5]);
                   stmt7.setString(6, qty[5]);
                   stmt7.setString(7, pStatus);
                   stmt7.setString(8, pID);
                   x7 = stmt7.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt8 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt8.setString(1, getItemId());
                   stmt8.setString(2, item[6]);
                   stmt8.setString(3, datee[6]);
                   stmt8.setString(4, supplier[6]);
                   stmt8.setString(5, qty[6]);
                   stmt8.setString(6, qty[6]);
                   stmt8.setString(7, pStatus);
                   stmt8.setString(8, pID);
                   x8 = stmt8.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt9 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt9.setString(1, getItemId());
                   stmt9.setString(2, item[7]);
                   stmt9.setString(3, datee[7]);
                   stmt9.setString(4, supplier[7]);
                   stmt9.setString(5, qty[7]);
                   stmt9.setString(6, qty[7]);
                   stmt9.setString(7, pStatus);
                   stmt9.setString(8, pID);
                   x9 = stmt9.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }


                  if(x1>0 && x2>0 && x3>0 && x4>0 && x5>0 && x6>0 && x7>0 && x8>0 && x9>0)
                      JOptionPane.showMessageDialog(null, "Records Updated sucessfully! ","METROPOLITAN ENGINEERING (PVT) LTD", 1);
                   else
                       JOptionPane.showMessageDialog(null, "Error in Database. Please Reconnect! ","METROPOLITAN ENGINEERING (PVT) LTD", 1);
               }
               
               //items 9 ................................................
               
               if(enteredItems==9)
               {
                   if(globalDate==null)
                   {
                        dateGlobal = "1900/00/00";
                        datee[0] = getDateInString(dates[0]);
                        datee[1] = getDateInString(dates[1]);
                        datee[2] = getDateInString(dates[2]);
                        datee[3] = getDateInString(dates[3]);
                        datee[4] = getDateInString(dates[4]);
                        datee[5] = getDateInString(dates[5]);
                        datee[6] = getDateInString(dates[6]);
                        datee[7] = getDateInString(dates[7]);
                        datee[8] = getDateInString(dates[8]);
                   }
                   else
                   {
                       
                     
                       datee[0] = getDateInString(globalDate);
                       datee[1] = getDateInString(globalDate);
                       datee[2] = getDateInString(globalDate);
                       datee[3] = getDateInString(globalDate);
                       datee[4] = getDateInString(globalDate);
                       datee[5] = getDateInString(globalDate);
                       datee[6] = getDateInString(globalDate);
                       datee[7] = getDateInString(globalDate);
                       datee[8] = getDateInString(globalDate);
                      
                    }
                   
                   if(!this.cmbSuppGlobal1.getSelectedItem().toString().equals("Not Available"))
                   {
                       for(int x=0; x<10; x++)
                           supplier[x] = this.cmbSuppGlobal1.getSelectedItem().toString();
                   }
                   
                   
                   PreparedStatement stmt1 = null;
                   PreparedStatement stmt2 = null;
                   PreparedStatement stmt3 = null;
                   PreparedStatement stmt4 = null;
                   PreparedStatement stmt5 = null;
                   PreparedStatement stmt6 = null;
                   PreparedStatement stmt7 = null;
                   PreparedStatement stmt8 = null;
                   PreparedStatement stmt9 = null;
                   PreparedStatement stmt10 = null;
                   
                   int x1=0, x2=0, x3=0, x4=0, x5=0, x6=0, x7=0, x8=0, x9=0, x10=0;
                   try{
                   stmt1 = con1.prepareStatement("INSERT INTO project values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt1.setString(1, pID);
                   stmt1.setString(2, pName);
                   stmt1.setString(3, pSdate);
                   stmt1.setString(4, dateGlobal);
                   stmt1.setString(5, pGsupplier);
                   stmt1.setString(6, pStatus);
                   stmt1.setString(7, pAvailability);
                   stmt1.setString(8, endDate);
                   x1 = stmt1.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt2 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt2.setString(1, getItemId());
                   stmt2.setString(2, item[0]);
                   stmt2.setString(3, datee[0]);
                   stmt2.setString(4, supplier[0]);
                   stmt2.setString(5, qty[0]);
                   stmt2.setString(6, qty[0]);
                   stmt2.setString(7, pStatus);
                   stmt2.setString(8, pID);
                   x2 = stmt2.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt3 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt3.setString(1, getItemId());
                   stmt3.setString(2, item[1]);
                   stmt3.setString(3, datee[1]);
                   stmt3.setString(4, supplier[1]);
                   stmt3.setString(5, qty[1]);
                   stmt3.setString(6, qty[1]);
                   stmt3.setString(7, pStatus);
                   stmt3.setString(8, pID);
                   x3 = stmt3.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt4 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt4.setString(1, getItemId());
                   stmt4.setString(2, item[2]);
                   stmt4.setString(3, datee[2]);
                   stmt4.setString(4, supplier[2]);
                   stmt4.setString(5, qty[2]);
                   stmt4.setString(6, qty[2]);
                   stmt4.setString(7, pStatus);
                   stmt4.setString(8, pID);
                   x4 = stmt4.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt5 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt5.setString(1, getItemId());
                   stmt5.setString(2, item[3]);
                   stmt5.setString(3, datee[3]);
                   stmt5.setString(4, supplier[3]);
                   stmt5.setString(5, qty[3]);
                   stmt5.setString(6, qty[3]);
                   stmt5.setString(7, pStatus);
                   stmt5.setString(8, pID);
                   x5 = stmt5.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt6 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt6.setString(1, getItemId());
                   stmt6.setString(2, item[4]);
                   stmt6.setString(3, datee[4]);
                   stmt6.setString(4, supplier[4]);
                   stmt6.setString(5, qty[4]);
                   stmt6.setString(6, qty[4]);
                   stmt6.setString(7, pStatus);
                   stmt6.setString(8, pID);
                   x6 = stmt6.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt7 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt7.setString(1, getItemId());
                   stmt7.setString(2, item[5]);
                   stmt7.setString(3, datee[5]);
                   stmt7.setString(4, supplier[5]);
                   stmt7.setString(5, qty[5]);
                   stmt7.setString(6, qty[5]);
                   stmt7.setString(7, pStatus);
                   stmt7.setString(8, pID);
                   x7 = stmt7.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt8 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt8.setString(1, getItemId());
                   stmt8.setString(2, item[6]);
                   stmt8.setString(3, datee[6]);
                   stmt8.setString(4, supplier[6]);
                   stmt8.setString(5, qty[6]);
                   stmt8.setString(6, qty[6]);
                   stmt8.setString(7, pStatus);
                   stmt8.setString(8, pID);
                   x8 = stmt8.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt9 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt9.setString(1, getItemId());
                   stmt9.setString(2, item[7]);
                   stmt9.setString(3, datee[7]);
                   stmt9.setString(4, supplier[7]);
                   stmt9.setString(5, qty[7]);
                   stmt9.setString(6, qty[7]);
                   stmt9.setString(7, pStatus);
                   stmt9.setString(8, pID);
                   x9 = stmt9.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt10 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt10.setString(1, getItemId());
                   stmt10.setString(2, item[8]);
                   stmt10.setString(3, datee[8]);
                   stmt10.setString(4, supplier[8]);
                   stmt10.setString(5, qty[8]);
                   stmt10.setString(6, qty[8]);
                   stmt10.setString(7, pStatus);
                   stmt10.setString(8, pID);
                   x10 = stmt10.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }


                  if(x1>0 && x2>0 && x3>0 && x4>0 && x5>0 && x6>0 && x7>0 && x8>0 && x9>0 && x10>0)
                      JOptionPane.showMessageDialog(null, "Records Updated sucessfully! ","METROPOLITAN ENGINEERING (PVT) LTD", 1);
                   else
                       JOptionPane.showMessageDialog(null, "Error in Database. Please Reconnect! ","METROPOLITAN ENGINEERING (PVT) LTD", 1);
               }
               
               //items 10..............................
               
               if(enteredItems==10)
               {
                   if(globalDate==null)
                   {
                        dateGlobal = "1900/00/00";
                        datee[0] = getDateInString(dates[0]);
                        datee[1] = getDateInString(dates[1]);
                        datee[2] = getDateInString(dates[2]);
                        datee[3] = getDateInString(dates[3]);
                        datee[4] = getDateInString(dates[4]);
                        datee[5] = getDateInString(dates[5]);
                        datee[6] = getDateInString(dates[6]);
                        datee[7] = getDateInString(dates[7]);
                        datee[8] = getDateInString(dates[8]);
                        datee[9] = getDateInString(dates[9]);
                   }
                   else
                   {
                       
                     
                       datee[0] = getDateInString(globalDate);
                       datee[1] = getDateInString(globalDate);
                       datee[2] = getDateInString(globalDate);
                       datee[3] = getDateInString(globalDate);
                       datee[4] = getDateInString(globalDate);
                       datee[5] = getDateInString(globalDate);
                       datee[6] = getDateInString(globalDate);
                       datee[7] = getDateInString(globalDate);
                       datee[8] = getDateInString(globalDate);
                       datee[9] = getDateInString(globalDate);
                      
                    }
                   
                   if(!this.cmbSuppGlobal1.getSelectedItem().toString().equals("Not Available"))
                   {
                       for(int x=0; x<10; x++)
                           supplier[x] = this.cmbSuppGlobal1.getSelectedItem().toString();
                   }
                   
                   
                   PreparedStatement stmt1 = null;
                   PreparedStatement stmt2 = null;
                   PreparedStatement stmt3 = null;
                   PreparedStatement stmt4 = null;
                   PreparedStatement stmt5 = null;
                   PreparedStatement stmt6 = null;
                   PreparedStatement stmt7 = null;
                   PreparedStatement stmt8 = null;
                   PreparedStatement stmt9 = null;
                   PreparedStatement stmt10 = null;
                   PreparedStatement stmt11 = null;
                   
                   int x1=0, x2=0, x3=0, x4=0, x5=0, x6=0, x7=0, x8=0, x9=0, x10=0, x11=0;
                   try{
                   stmt1 = con1.prepareStatement("INSERT INTO project values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt1.setString(1, pID);
                   stmt1.setString(2, pName);
                   stmt1.setString(3, pSdate);
                   stmt1.setString(4, dateGlobal);
                   stmt1.setString(5, pGsupplier);
                   stmt1.setString(6, pStatus);
                   stmt1.setString(7, pAvailability);
                   stmt1.setString(8, endDate);
                   x1 = stmt1.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt2 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt2.setString(1, getItemId());
                   stmt2.setString(2, item[0]);
                   stmt2.setString(3, datee[0]);
                   stmt2.setString(4, supplier[0]);
                   stmt2.setString(5, qty[0]);
                   stmt2.setString(6, qty[0]);
                   stmt2.setString(7, pStatus);
                   stmt2.setString(8, pID);
                   x2 = stmt2.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt3 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt3.setString(1, getItemId());
                   stmt3.setString(2, item[1]);
                   stmt3.setString(3, datee[1]);
                   stmt3.setString(4, supplier[1]);
                   stmt3.setString(5, qty[1]);
                   stmt3.setString(6, qty[1]);
                   stmt3.setString(7, pStatus);
                   stmt3.setString(8, pID);
                   x3 = stmt3.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt4 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt4.setString(1, getItemId());
                   stmt4.setString(2, item[2]);
                   stmt4.setString(3, datee[2]);
                   stmt4.setString(4, supplier[2]);
                   stmt4.setString(5, qty[2]);
                   stmt4.setString(6, qty[2]);
                   stmt4.setString(7, pStatus);
                   stmt4.setString(8, pID);
                   x4 = stmt4.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt5 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt5.setString(1, getItemId());
                   stmt5.setString(2, item[3]);
                   stmt5.setString(3, datee[3]);
                   stmt5.setString(4, supplier[3]);
                   stmt5.setString(5, qty[3]);
                   stmt5.setString(6, qty[3]);
                   stmt5.setString(7, pStatus);
                   stmt5.setString(8, pID);
                   x5 = stmt5.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt6 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt6.setString(1, getItemId());
                   stmt6.setString(2, item[4]);
                   stmt6.setString(3, datee[4]);
                   stmt6.setString(4, supplier[4]);
                   stmt6.setString(5, qty[4]);
                   stmt6.setString(6, qty[4]);
                   stmt6.setString(7, pStatus);
                   stmt6.setString(8, pID);
                   x6 = stmt6.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt7 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt7.setString(1, getItemId());
                   stmt7.setString(2, item[5]);
                   stmt7.setString(3, datee[5]);
                   stmt7.setString(4, supplier[5]);
                   stmt7.setString(5, qty[5]);
                   stmt7.setString(6, qty[5]);
                   stmt7.setString(7, pStatus);
                   stmt7.setString(8, pID);
                   x7 = stmt7.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt8 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt8.setString(1, getItemId());
                   stmt8.setString(2, item[6]);
                   stmt8.setString(3, datee[6]);
                   stmt8.setString(4, supplier[6]);
                   stmt8.setString(5, qty[6]);
                   stmt8.setString(6, qty[6]);
                   stmt8.setString(7, pStatus);
                   stmt8.setString(8, pID);
                   x8 = stmt8.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt9 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt9.setString(1, getItemId());
                   stmt9.setString(2, item[7]);
                   stmt9.setString(3, datee[7]);
                   stmt9.setString(4, supplier[7]);
                   stmt9.setString(5, qty[7]);
                   stmt9.setString(6, qty[7]);
                   stmt9.setString(7, pStatus);
                   stmt9.setString(8, pID);
                   x9 = stmt9.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt10 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt10.setString(1, getItemId());
                   stmt10.setString(2, item[8]);
                   stmt10.setString(3, datee[8]);
                   stmt10.setString(4, supplier[8]);
                   stmt10.setString(5, qty[8]);
                   stmt10.setString(6, qty[8]);
                   stmt10.setString(7, pStatus);
                   stmt10.setString(8, pID);
                   x10 = stmt10.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                   
                   try{
                   stmt11 = con1.prepareStatement("INSERT INTO item values(?, ?, ?, ?, ?, ?, ?, ?)");
                   stmt11.setString(1, getItemId());
                   stmt11.setString(2, item[9]);
                   stmt11.setString(3, datee[9]);
                   stmt11.setString(4, supplier[9]);
                   stmt11.setString(5, qty[9]);
                   stmt11.setString(6, qty[9]);
                   stmt11.setString(7, pStatus);
                   stmt11.setString(8, pID);
                   x11 = stmt11.executeUpdate();


                   }
                   catch(Exception e)
                   {
                       System.out.println(e.getMessage());
                   }
                    
                   loadEditProjectList();
                   

                  if(x1>0 && x2>0 && x3>0 && x4>0 && x5>0 && x6>0 && x7>0 && x8>0 && x9>0 && x10>0 && x11>0)
                      JOptionPane.showMessageDialog(null, "Records Updated sucessfully! ","METROPOLITAN ENGINEERING (PVT) LTD", 1);
                   else
                       JOptionPane.showMessageDialog(null, "Error in Database. Please Reconnect! ","METROPOLITAN ENGINEERING (PVT) LTD", 1);
               }
               
               
                
        
        
            }
        
        
       
                
           
           //inserting ends here
        
           
        
        loadEditProjectList();
        
    }
    }//GEN-LAST:event_btnSaveActionPerformed

    private void btnDeleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDeleteActionPerformed
        // TODO add your handling code here:
        
        int x=JOptionPane.showConfirmDialog(null,"Are you sure you want to delete this PROJECT?",
            "METROPOLITAN ENGINEERING (PVT) LTD",0,3 );
       
       if(x==0)
       {
        
        int x1 = 0, x2=0;
           try{
           
           String gen = this.selectedItem;
               
           PreparedStatement stmt1 = null;
           PreparedStatement stmt2 = null;
           
           
           
           
           stmt1 = con1.prepareStatement("update project set pAvailability='NO' where pID=? ");
           
           stmt1.setString(1, gen);
           x1 = stmt1.executeUpdate();
    
           
           
           
           }
           catch(Exception e)
           {
               System.out.println(e.getMessage());
           }
       
           
        
          if(x1>0 )
          {
              JOptionPane.showMessageDialog(null, "Record deleted sucessfully! ","METROPOLITAN ENGINEERING (PVT) LTD", 1);
              
               String query1 = "select pID as 'ID', pName as 'Name', pSdate as 'Start Date', pEndDate as 'End Date',  pGsupplier as 'Global Supplier', pStatus as 'Project Status'  from project where pAvailability = 'YES' ";


        ResultSet result= db1.executeSQLQuery(query1);

        try {

            int columCount = 0;
            ResultSetMetaData rsmd = result.getMetaData();
            Vector myVector = new Vector();
            columCount = rsmd.getColumnCount();
            for (int i = 1; i <= columCount; i++) {
                myVector.add(rsmd.getColumnLabel(i));
            }
            DefaultTableModel amodel = new DefaultTableModel(myVector, 0)/*0=row count*/ {
                @Override
                public boolean isCellEditable(int row, int column) {
                    //all cells false
                    return false;
                }
            };

            while (result.next()) {
                String[] rowData = new String[columCount];
                for (int i = 1; i <= columCount; i++) {
                    if (i == 1) {
                        String id = result.getString(i);
                        rowData[i - 1] = id.toUpperCase();
                    } else {
                        rowData[i - 1] = result.getString(i);
                    }
                }
                amodel.addRow(rowData);
            }

            tableSummaryProjects.setModel(amodel);

        } catch (Exception e) {
            JOptionPane.showMessageDialog(this, "Error in Showing Data", "METROPOLITAN ENGINEERING (PVT) LTD", 1);
        }
        
               
         
          }
           else
               JOptionPane.showMessageDialog(null, "Error in Database. Please Reconnect! ","METROPOLITAN ENGINEERING (PVT) LTD", 1);
          
          loadEditProjectList();
       }
    }//GEN-LAST:event_btnDeleteActionPerformed

    private void btnClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnClearActionPerformed
        // TODO add your handling code here:
        
        this.txtProID.setText(getProjectID());
        
        this.txtItem1.setText("");
        this.txtItem2.setText("");
        this.txtItem3.setText("");
        this.txtItem4.setText("");
        this.txtItem5.setText("");
        this.txtItem6.setText("");
        this.txtItem7.setText("");
        this.txtItem8.setText("");
        this.txtItem9.setText("");
        this.txtItem10.setText("");
        
        this.txtQ1.setText("");
        this.txtQ2.setText("");
        this.txtQ3.setText("");
        this.txtQ4.setText("");
        this.txtQ5.setText("");
        this.txtQ6.setText("");
        this.txtQ7.setText("");
        this.txtQ8.setText("");
        this.txtQ9.setText("");
        this.txtQ10.setText("");
        
        this.dateGlobal.setCalendar(null);
        
    }//GEN-LAST:event_btnClearActionPerformed

    private void cmbProNameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbProNameActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_cmbProNameActionPerformed

    private void tableSummaryProjectsMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tableSummaryProjectsMouseClicked
        // TODO add your handling code here:
        
        int a=this.tableSummaryProjects.getSelectedRow();
             String c=tableSummaryProjects.getValueAt(a, 0).toString();
             this.selectedItem = c;
    }//GEN-LAST:event_tableSummaryProjectsMouseClicked

    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
        // TODO add your handling code here:
        
        if (Data.Login.getPre_UI_type() == 1 || Data.Login.getPre_UI_type() == 2) {
            animation_exit a = new animation_exit();
            a.start();
            try {
                a.join();
            } catch (InterruptedException ex) {
                
            }
        }
    }//GEN-LAST:event_formWindowClosing

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        // TODO add your handling code here:
        
        this.txtProName.setText("Mahddagdfvgajana Bankings");
        this.txtItem1.setText("Generator");
        this.txtItem2.setText("Alternator");
        this.txtItem3.setText("Switch Panel");
        this.txtItem4.setText("Wire Harness");
        this.txtItem5.setText("Engine");
        this.txtItem6.setText("Canopy");
        this.txtItem7.setText("Wiring Box");
        this.txtItem8.setText("Amphere Meter");
        this.txtItem9.setText("Voltage Regulator");
        //this.txtItem10.setText("Voltage Stablizer");
        
        this.txtQ1.setText("2");
        this.txtQ2.setText("2");
        this.txtQ3.setText("4");
        this.txtQ4.setText("6");
        this.txtQ5.setText("2");
        this.txtQ6.setText("2");
        this.txtQ7.setText("4");
        this.txtQ8.setText("8");
        this.txtQ9.setText("3");
       // this.txtQ10.setText("2");
        
        
    }//GEN-LAST:event_jButton1ActionPerformed

    
    // my own methods
    
    public String getDateInString(Date d)
    {
     
        String year = Integer.toString(d.getYear()+1900);
        String month = Integer.toString(d.getMonth()+1);
        String date = Integer.toString(d.getDate());
        
        String temp = year+"/"+month+"/"+date;
        return temp;
    }
    
    public Date convertStringToDate(String s)
    {
        
        StringTokenizer temp = new StringTokenizer(s, "-");
        int year = Integer.parseInt(temp.nextToken());
        int month = Integer.parseInt(temp.nextToken());
        int date = Integer.parseInt(temp.nextToken());
        
        Date d = new Date(year-1900, month-1, date);
        
        System.out.println(Integer.toString(year));
        
       // Date dd = new Date();
        return d;
    }
    
     public Date convertStringToDate2(String s)
    {
        
        StringTokenizer temp = new StringTokenizer(s, "/");
        int year = Integer.parseInt(temp.nextToken());
        int month = Integer.parseInt(temp.nextToken());
        int date = Integer.parseInt(temp.nextToken());
        
        Date d = new Date(year-1900, month-1, date);
        
        System.out.println(Integer.toString(year));
        
       // Date dd = new Date();
        return d;
    }
    
    public String getItemID()
    {
        String gen = "select count(*) as 'field' from item";
   
        int n1=0;
      
        
        ResultSet count1 = db1.executeSQLQuery(gen);
        
        try
        {
            if(count1.next())
            {
                n1 += Integer.parseInt(count1.getString("field"));
            }
        }
        catch(Exception e)
        {
            JOptionPane.showMessageDialog(null, e.getMessage(),"METROPOLITAN ENGINEERING (PVT) LTD", 1);
        }
        
        
        //this.jTextField1.setText("Gen"+Integer.toString(n1));
        
        return Integer.toString(n1);
    }
    
    public void loadSuppliers()
    {
        String na = "Not Available";
        
        this.cmbSupp1.removeAllItems();
        this.cmbSupp2.removeAllItems();
        this.cmbSupp3.removeAllItems();
        this.cmbSupp4.removeAllItems();
        this.cmbSupp5.removeAllItems();
        this.cmbSupp6.removeAllItems();
        this.cmbSupp7.removeAllItems();
        this.cmbSupp8.removeAllItems();
        this.cmbSupp9.removeAllItems();
        this.cmbSupp10.removeAllItems();
        this.cmbSupp11.removeAllItems();
        this.cmbSupp12.removeAllItems();
        this.cmbSupp13.removeAllItems();
        this.cmbSupp14.removeAllItems();
        this.cmbSupp15.removeAllItems();
        this.cmbSupp16.removeAllItems();
        this.cmbSupp17.removeAllItems();
        this.cmbSupp18.removeAllItems();
        this.cmbSupp19.removeAllItems();
        this.cmbSupp20.removeAllItems();
        this.cmbSuppGlobal.removeAllItems();
        this.cmbSuppGlobal1.removeAllItems();
        
                this.cmbSupp1.addItem(na);
                this.cmbSupp2.addItem(na);
                this.cmbSupp3.addItem(na);
                this.cmbSupp4.addItem(na);
                this.cmbSupp5.addItem(na);
                this.cmbSupp6.addItem(na);
                this.cmbSupp7.addItem(na);
                this.cmbSupp8.addItem(na);
                this.cmbSupp9.addItem(na);
                this.cmbSupp10.addItem(na);
                this.cmbSupp11.addItem(na);
                this.cmbSupp12.addItem(na);
                this.cmbSupp13.addItem(na);
                this.cmbSupp14.addItem(na);
                this.cmbSupp15.addItem(na);
                this.cmbSupp16.addItem(na);
                this.cmbSupp17.addItem(na);
                this.cmbSupp18.addItem(na);
                this.cmbSupp19.addItem(na);
                this.cmbSupp20.addItem(na);
                this.cmbSuppGlobal.addItem(na);
                this.cmbSuppGlobal1.addItem(na);
        
        
        String proList = "select sName as 'field' from supplier where sName != 'deleted'";
   
        
      
        
        ResultSet countList = db1.executeSQLQuery(proList);
        
        try
        {
            while(countList.next())
            {
                //n1 += Integer.parseInt(count1.getString("field"));
                this.cmbSupp1.addItem(countList.getString("field"));
                this.cmbSupp2.addItem(countList.getString("field"));
                this.cmbSupp3.addItem(countList.getString("field"));
                this.cmbSupp4.addItem(countList.getString("field"));
                this.cmbSupp5.addItem(countList.getString("field"));
                this.cmbSupp6.addItem(countList.getString("field"));
                this.cmbSupp7.addItem(countList.getString("field"));
                this.cmbSupp8.addItem(countList.getString("field"));
                this.cmbSupp9.addItem(countList.getString("field"));
                this.cmbSupp10.addItem(countList.getString("field"));
                this.cmbSupp11.addItem(countList.getString("field"));
                this.cmbSupp12.addItem(countList.getString("field"));
                this.cmbSupp13.addItem(countList.getString("field"));
                this.cmbSupp14.addItem(countList.getString("field"));
                this.cmbSupp15.addItem(countList.getString("field"));
                this.cmbSupp16.addItem(countList.getString("field"));
                this.cmbSupp17.addItem(countList.getString("field"));
                this.cmbSupp18.addItem(countList.getString("field"));
                this.cmbSupp19.addItem(countList.getString("field"));
                this.cmbSupp20.addItem(countList.getString("field"));
                this.cmbSuppGlobal.addItem(countList.getString("field"));
                this.cmbSuppGlobal1.addItem(countList.getString("field"));
            }
        }
        catch(Exception e)
        {
            JOptionPane.showMessageDialog(null, e.getMessage(),"METROPOLITAN ENGINEERING (PVT) LTD", 1);
        }
    }
    
    public String getProjectID()
    {
        String gen = "select count(*) as 'field' from project";
   
        int n1=1;
      
        
        ResultSet count1 = db1.executeSQLQuery(gen);
        
        try
        {
            if(count1.next())
            {
                n1 += Integer.parseInt(count1.getString("field"));
            }
        }
        catch(Exception e)
        {
            JOptionPane.showMessageDialog(null, e.getMessage(),"METROPOLITAN ENGINEERING (PVT) LTD", 1);
        }
        
        
        return ("Project"+Integer.toString(n1));
    }
    
    
    public String getItemId()
    {
        String gen = "select count(*) as 'field' from item";
   
        int n1=1;
      
        
        ResultSet count1 = db1.executeSQLQuery(gen);
        
        try
        {
            if(count1.next())
            {
                n1 += Integer.parseInt(count1.getString("field"));
            }
        }
        catch(Exception e)
        {
            JOptionPane.showMessageDialog(null, e.getMessage(),"METROPOLITAN ENGINEERING (PVT) LTD", 1);
        }
        
        
        return ("Item"+Integer.toString(n1));
    }
    
    public void loadEditProjectList()
    {
        
        this.cmbProName.removeAllItems();
        
        String proList = "select pName as 'field' from project where pAvailability = 'YES'";
   
        
      
        
        ResultSet countList = db1.executeSQLQuery(proList);
        
        try
        {
            while(countList.next())
            {
                //n1 += Integer.parseInt(count1.getString("field"));
                this.cmbProName.addItem(countList.getString("field"));
            }
        }
        catch(Exception e)
        {
            JOptionPane.showMessageDialog(null, e.getMessage(),"METROPOLITAN ENGINEERING (PVT) LTD", 1);
        }
    }
    
    //my own methods ends here
    
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* 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 ("Windows".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(AddEditRemoveProjects.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(AddEditRemoveProjects.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(AddEditRemoveProjects.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(AddEditRemoveProjects.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new AddEditRemoveProjects().setVisible(true);
            }
        }