private void simpanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_simpanActionPerformed
        try {
            Class.forName ("com.mysql.jdbc.Driver");
            String urldb="jdbc:mysql://localhost:3306/restaurant";
            String user=main.dbUser;
            String password=main.dbPassword;
            Connection koneksi=java.sql.DriverManager.getConnection(urldb,user,password);
            String sql = "insert into `pembayaran`(`no_pesanan`,`dibayar`,`kembali`) "
                       + "values((select max(no_pesanan) from pesanan where lunas = 0 and no_meja = '"+(meja.getSelectedIndex()+1)+"'), "
                       + "       '"+dibayar.getText()+"', "
                       + "       '"+kembali.getText()+"')";

            Statement st = koneksi.createStatement();
            st.executeUpdate(sql);
    
            st.close();
            koneksi.close();
        }catch(ClassNotFoundException cnfe){
            System.out.println("kesalahan saat"+"me-load driver jdbc \n"+cnfe.getMessage());
        }catch(SQLException sqle){
            System.out.println("keslahan saat koneksi atau "+"kesalahan query sql \n"+sqle.getMessage());
        }   
    }//GEN-LAST:event_simpanActionPerformed