Example #1
0
 private void jButton1ActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButton1ActionPerformed
   // TODO add your handling code here:
   String username = vw.username;
   Emp_id = jTextField2.getText();
   Bill_id = jTextField3.getText();
   if (vw.t == 1) {
     q.executeQuery("select mgr_id from man_id where username = '******'");
     try {
       if (q.rs.next()) {
         String mgr_id = q.rs.getString("mgr_id");
         q.executeQuery("select bill_id from bill where mgr_id = '" + mgr_id + "'");
         while (q.rs.next()) {
           System.out.println(q.rs.getString("Bill_id"));
           if (Bill_id.equals(q.rs.getString("Bill_id"))) {
             a = 0;
           }
         }
       }
     } catch (SQLException ex) {
       Logger.getLogger(View_Mb.class.getName()).log(Level.SEVERE, null, ex);
     }
     q.executeQuery("select * from Bill where Bill_id = '" + Bill_id + "'");
     if (a == 0) {
       JOptionPane.showMessageDialog(this, "proceed to next pane");
       try {
         if (q.rs.next()) {
           String binfo = q.rs.getString("Bill_Info");
           String amt = q.rs.getString("amount");
           String exp = q.rs.getString("expense");
           String st = q.rs.getString("status");
           System.out.println(binfo);
           jTextArea1.setText(
               "Bill_ID : "
                   + Bill_id
                   + "\n"
                   + "Emp_ID : "
                   + Emp_id
                   + "\n\n"
                   + "Amount : "
                   + amt
                   + "\n"
                   + "Expense : "
                   + exp
                   + "\n"
                   + "Status : "
                   + st
                   + "\n\n"
                   + "Bill_Info : "
                   + binfo);
         }
       } catch (SQLException ex) {
         // Logger.getLogger(Mgrlogn.class.getName()).log(Level.SEVERE, null, ex);
         JOptionPane.showMessageDialog(this, ex);
       }
     } else {
       jButton2.setVisible(false);
       jButton3.setVisible(false);
     }
   } else if (vw.t == 0) {
     // String username = vw.username;
     Emp_id = jTextField2.getText();
     Bill_id = jTextField3.getText();
     // if(vw.t == 0) {
     // q.executeQuery("select emp_id from employee_id where username = '******'");
     // try {
     //  if(q.rs.next())
     // {
     //  String emp_id = q.rs.getString("emp_id");
     q.executeQuery("select bill_id from meo");
     try {
       while (q.rs.next()) {
         System.out.println(q.rs.getString("Bill_id"));
         if (Bill_id.equals(q.rs.getString("Bill_id"))) {
           a = 0;
         }
       }
       // }
       // } catch (SQLException ex) {
       //  Logger.getLogger(View_Mb.class.getName()).log(Level.SEVERE, null, ex);
     } catch (SQLException ex) {
       Logger.getLogger(View_OR.class.getName()).log(Level.SEVERE, null, ex);
     }
   }
   q.executeQuery("select * from Bill where Bill_id = '" + Bill_id + "'");
   if (a == 0) {
     JOptionPane.showMessageDialog(this, "proceed to next pane");
     try {
       if (q.rs.next()) {
         String binfo = q.rs.getString("Bill_Info");
         String amt = q.rs.getString("amount");
         String exp = q.rs.getString("expense");
         String st = q.rs.getString("status");
         System.out.println(binfo);
         jTextArea1.setText(
             "Bill_ID : "
                 + Bill_id
                 + "\n"
                 + "Emp_ID : "
                 + Emp_id
                 + "\n\n"
                 + "Amount : "
                 + amt
                 + "\n"
                 + "Expense : "
                 + exp
                 + "\n"
                 + "Status : "
                 + st
                 + "\n\n"
                 + "Bill_Info : "
                 + binfo);
       }
     } catch (SQLException ex) {
       // Logger.getLogger(Mgrlogn.class.getName()).log(Level.SEVERE, null, ex);
       JOptionPane.showMessageDialog(this, ex);
     }
   } else {
     jButton2.setVisible(false);
     jButton3.setVisible(false);
   }
 } // GEN-LAST:event_jButton1ActionPerformed