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);
        }
                
    }