private void jButton5ActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButton5ActionPerformed
    if (jLabel6.getText().isEmpty()) {
      JOptionPane.showMessageDialog(
          this, "Select The Job Details", "Eroor", JOptionPane.WARNING_MESSAGE);
    } else {
      try {
        // TODO add your handling code here:
        // update the feilds
        String cverPrint = datechosser(jDateChooser2);
        String insdePrint = datechosser(jDateChooser3);
        String rems = jTextField15.getText();
        String qty = jTextField17.getText();
        String cmplt = datechosser(jDateChooser1);

        ConnectionSet1.getInstance()
            .setResult(
                "update printing set cver_print_dte='"
                    + cverPrint
                    + "',insde_printed_date='"
                    + insdePrint
                    + "',paper_rim='"
                    + rems
                    + "',qty='"
                    + qty
                    + "',cmplt_date='"
                    + cmplt
                    + "' where prnting_shedul_idprnting_shedul='"
                    + jLabel7.getText()
                    + "'");

        jLabel7.setText("");
        jTextField9.setText("");
        jTextField11.setText("");
        jTextField10.setText("");
        jTextField7.setText("");
        jTextField6.setText("");
        jTextField4.setText("");
        jComboBox1.setSelectedIndex(0);
        jComboBox3.setSelectedIndex(0);
        jComboBox2.setSelectedIndex(0);
        jComboBox4.setSelectedIndex(0);
        jLabel6.setText("");

        jTextField15.setText("");
        jTextField17.setText("");
        jDateChooser1.setDate(null);
        jDateChooser2.setDate(null);
        jDateChooser3.setDate(null);
        tableLoad();

      } catch (Exception ex) {
        Logger.getLogger(PrintingDepartment.class.getName()).log(Level.SEVERE, null, ex);
      }
    }
  } // GEN-LAST:event_jButton5ActionPerformed
  private void jButton7ActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButton7ActionPerformed
    try {
      // TODO add your handling code here:
      // go back to home
      String uname = jLabel16.getText();
      String username = null;
      String desig = null;
      String typ = null;

      ResultSet rs =
          ConnectionSet1.getInstance()
              .getResult("select * from user where username='******'");
      if (rs.next()) {
        desig = rs.getString("designation");
        username = rs.getString("username");
        typ = rs.getString("user_type");
      }

      if (username.equals(uname) && typ.equals("Admin") && desig.equals("IT")) {
        System.out.println("3");
        new Menu("IT", "Admin", uname).setVisible(true);
        dispose();

      } else if (username.equals(uname) && typ.equals("User") && desig.equals("Printing")) {
        new Menu("Printing", "User", uname).setVisible(true);
        dispose();

      } else if (username.equals(uname)
          && typ.equals("Admin")
          && desig.equals("Publishing Manager")) {
        System.out.println("3");
        new Menu("Publishing Manager", "Admin", uname).setVisible(true);
        dispose();

      } else if (username.equals(uname) && typ.equals("Admin") && desig.equals("MD")) {
        System.out.println("3");
        new Menu("MD", "Admin", uname).setVisible(true);
        dispose();
      }

      //            new Menu("Planner", "User", jLabel5.getText()).setVisible(true);
      //            dispose();
    } catch (Exception ex) {
      Logger.getLogger(Planner.class.getName()).log(Level.SEVERE, null, ex);
    }
  } // GEN-LAST:event_jButton7ActionPerformed
  private void jTable2MouseClicked(
      java.awt.event.MouseEvent evt) { // GEN-FIRST:event_jTable2MouseClicked
    try {
      // TODO add your handling code here:
      //        set data for the feilds
      DefaultTableModel dtm = (DefaultTableModel) jTable2.getModel();
      int i = jTable2.getSelectedRow();
      String jbid = dtm.getValueAt(i, 0).toString();

      ResultSet rs =
          ConnectionSet1.getInstance()
              .getResult(
                  "select idjob_card,manuscript_name,fname,isbn,cver_print_dte,qty,insde_printed_date,paper_rim,cmplt_date,idprnting_shedul,p1.* from printing pr1 inner join prnting_shedul ps1 on pr1.prnting_shedul_idprnting_shedul = ps1.idprnting_shedul inner join production_description p1 "
                      + "on ps1.job_card_idjob_card = p1.job_card_idjob_card inner join job_card j1 on p1.job_card_idjob_card = j1.idjob_card inner join reseving_manuscript r1 on j1.reseving_manuscript_idrm = r1.idrm inner join author a1 on r1.author_idauthor = a1.idauthor where status_printing='Yes' AND idjob_card='"
                      + jbid
                      + "'");

      //
      // idjob_card,manuscript_name,fname,isbn,cver_print_dte,qty,insde_printed_date,paper_rim,cmplt_date,p1.*
      if (rs.next()) {
        String idshedul = rs.getString("idprnting_shedul");
        jLabel7.setText(idshedul);

        String jobid = rs.getString("idjob_card");
        jLabel6.setText(jbid);

        String titl = rs.getString("manuscript_name");
        jTextField9.setText(titl);

        String author = rs.getString("fname");
        jTextField10.setText(author);

        String isbn = rs.getString("isbn");
        jTextField11.setText(isbn);

        String prosiz = rs.getString("pduct_sz");
        jTextField6.setText(prosiz);

        String numofpg = rs.getString("nm_pages");
        jTextField4.setText(numofpg);

        String qty = rs.getString("print_qty");
        jTextField7.setText(qty);

        String papertyp = rs.getString("innr_paper_typ");
        Vector v = new Vector();
        v.add(papertyp);
        jComboBox1.setModel(new DefaultComboBoxModel(v));

        String paperguge = rs.getString("innr_paper_gauge");
        Vector v1 = new Vector();
        v1.add(paperguge);
        jComboBox3.setModel(new DefaultComboBoxModel(v1));

        String cver = rs.getString("cver_brd_typ");
        Vector v2 = new Vector();
        v2.add(cver);
        jComboBox2.setModel(new DefaultComboBoxModel(v2));

        String cvergige = rs.getString("cver_brd_gauge");
        Vector v3 = new Vector();
        v3.add(cvergige);
        jComboBox4.setModel(new DefaultComboBoxModel(v3));

        String cverpdte = rs.getString("cver_print_dte");
        Date d = new Date(cverpdte);
        d.getDate();
        jDateChooser2.setDate(d);

        String insdeprindte = rs.getString("insde_printed_date");
        Date d1 = new Date(insdeprindte);
        d1.getDate();
        jDateChooser3.setDate(d1);

        String rim = rs.getString("paper_rim");
        jTextField15.setText(rim);

        String qtyp = rs.getString("qty");
        jTextField17.setText(qtyp);

        String cmplt = rs.getString("cmplt_date");
        Date d2 = new Date(cmplt);
        d2.getDate();
        jDateChooser1.setDate(d2);
      }

    } catch (Exception ex) {
      Logger.getLogger(PrintingDepartment.class.getName()).log(Level.SEVERE, null, ex);
    }
  } // GEN-LAST:event_jTable2MouseClicked
  private void jButton4ActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButton4ActionPerformed
    if (jLabel6.getText().isEmpty()) {
      JOptionPane.showMessageDialog(
          this, "Select The Job Details", "Error", JOptionPane.WARNING_MESSAGE);
    } else {
      try {
        // TODO add your handling code here:
        //        save the data
        String cverPrint = datechosser(jDateChooser2);
        String insdePrint = datechosser(jDateChooser3);
        String rems = jTextField15.getText();
        String qty = jTextField17.getText();
        String cmplt = datechosser(jDateChooser1);

        int prinshedulid = 0;
        ResultSet rs =
            ConnectionSet1.getInstance()
                .getResult(
                    "select idprnting_shedul from prnting_shedul where idprnting_shedul='"
                        + jLabel7.getText()
                        + "'");
        if (rs.next()) {
          prinshedulid = rs.getInt("idprnting_shedul");
        }
        System.out.println(prinshedulid);

        ConnectionSet1.getInstance()
            .setResult(
                "insert into printing(cver_print_dte,insde_printed_date,paper_rim,qty,cmplt_date,prnting_shedul_idprnting_shedul,printing_step) values('"
                    + cverPrint
                    + "','"
                    + insdePrint
                    + "','"
                    + rems
                    + "','"
                    + qty
                    + "','"
                    + cmplt
                    + "','"
                    + prinshedulid
                    + "','1st Print')");
        ConnectionSet1.getInstance()
            .setResult(
                "update prnting_shedul set status_printing='Yes' where idprnting_shedul='"
                    + jLabel7.getText()
                    + "'");

        jLabel7.setText("");
        jTextField9.setText("");
        jTextField11.setText("");
        jTextField10.setText("");
        jTextField7.setText("");
        jTextField6.setText("");
        jTextField4.setText("");
        jComboBox1.setSelectedIndex(0);
        jComboBox3.setSelectedIndex(0);
        jComboBox2.setSelectedIndex(0);
        jComboBox4.setSelectedIndex(0);
        jLabel6.setText("");

        jTextField15.setText("");
        jTextField17.setText("");
        jDateChooser1.setDate(null);
        jDateChooser2.setDate(null);
        jDateChooser3.setDate(null);
        tableLoad();

      } catch (Exception ex) {
        Logger.getLogger(PrintingDepartment.class.getName()).log(Level.SEVERE, null, ex);
      }
    }
  } // GEN-LAST:event_jButton4ActionPerformed