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