package frames;

import function.Function;
import function.database.AdminProcess;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import main.Main;
import object.itemmanager.ItemApp;
import object.itemmanager.ProductApp;
import object.UserApp;
import object.billmanager.Bill;
import object.billmanager.BillItem;
import object.itemmanager.Size;

public class AdminManagement extends javax.swing.JFrame {

    public AdminManagement() {
        initComponents();
        setLocationRelativeTo(null);
        //quản lý mặt hàng
        alItemApps = AdminProcess.getArrayListItem(Main.sqlServerConn);
        fillToTableMH(alItemApps);
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        java.awt.GridBagConstraints gridBagConstraints;

        jPanel2 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTable2 = new javax.swing.JTable();
        tpAdmin = new javax.swing.JTabbedPane();
        Panel_menu = new javax.swing.JPanel();
        jPanel7 = new javax.swing.JPanel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jScrollPane3 = new javax.swing.JScrollPane();
        tbMH = new javax.swing.JTable();
        btnAddMH = new javax.swing.JButton();
        btnUpdateMH = new javax.swing.JButton();
        btnClearMH = new javax.swing.JButton();
        txtNameMH = new javax.swing.JTextField();
        txtIdMH = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        cbStatusMH = new javax.swing.JComboBox<>();
        txtSizeMH = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        txtOptionMH = new javax.swing.JTextField();
        btnDeleteMH = new javax.swing.JButton();
        jLabel5 = new javax.swing.JLabel();
        Panel_Material = new javax.swing.JPanel();
        jPanel8 = new javax.swing.JPanel();
        jLabel22 = new javax.swing.JLabel();
        jLabel23 = new javax.swing.JLabel();
        jLabel24 = new javax.swing.JLabel();
        jLabel28 = new javax.swing.JLabel();
        jScrollPane6 = new javax.swing.JScrollPane();
        tbSP = new javax.swing.JTable();
        btnAddSP = new javax.swing.JButton();
        btnUpdateSP = new javax.swing.JButton();
        btnClearSP = new javax.swing.JButton();
        txtNameSP = new javax.swing.JTextField();
        txtPriceSP = new javax.swing.JTextField();
        txtIdSP = new javax.swing.JTextField();
        cbMHSP = new javax.swing.JComboBox<>();
        cbStatusSP = new javax.swing.JComboBox<>();
        jLabel25 = new javax.swing.JLabel();
        btnDeleteSP = new javax.swing.JButton();
        jLabel12 = new javax.swing.JLabel();
        Panel_Bill = new javax.swing.JPanel();
        jPanel14 = new javax.swing.JPanel();
        jScrollPane7 = new javax.swing.JScrollPane();
        tbHD = new javax.swing.JTable();
        txtIDHD = new javax.swing.JTextField();
        jLabel26 = new javax.swing.JLabel();
        btnSearchIDHD = new javax.swing.JButton();
        jLabel27 = new javax.swing.JLabel();
        txtDateStartHD = new javax.swing.JTextField();
        txtDateStopHD = new javax.swing.JTextField();
        btnSearchDateHD = new javax.swing.JButton();
        jLabel16 = new javax.swing.JLabel();
        Panel_Staff = new javax.swing.JPanel();
        jPanel11 = new javax.swing.JPanel();
        cbStatusNV = new javax.swing.JComboBox<>();
        jLabel35 = new javax.swing.JLabel();
        cbPositionNV = new javax.swing.JComboBox<>();
        txtBirthdayNV = new javax.swing.JTextField();
        jScrollPane8 = new javax.swing.JScrollPane();
        tbNV = new javax.swing.JTable();
        jLabel33 = new javax.swing.JLabel();
        jLabel31 = new javax.swing.JLabel();
        txtSDTNV = new javax.swing.JTextField();
        btnUpdateNV = new javax.swing.JButton();
        jLabel37 = new javax.swing.JLabel();
        jLabel36 = new javax.swing.JLabel();
        btnAddNV = new javax.swing.JButton();
        jLabel32 = new javax.swing.JLabel();
        txtNameNV = new javax.swing.JTextField();
        btnClearNV = new javax.swing.JButton();
        jLabel34 = new javax.swing.JLabel();
        jLabel38 = new javax.swing.JLabel();
        txtUsernameNV = new javax.swing.JTextField();
        txtAndressNV = new javax.swing.JTextField();
        txtPasswordNV = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        Panel_Statistical = new javax.swing.JPanel();
        jPanel6 = new javax.swing.JPanel();
        btn_Top = new javax.swing.JButton();
        btn_Revenue = new javax.swing.JButton();
        btn_Time = new javax.swing.JButton();
        jLabel13 = new javax.swing.JLabel();
        Panel_Settings = new javax.swing.JPanel();
        jPanel9 = new javax.swing.JPanel();
        btn_Information = new javax.swing.JButton();
        btn_Adjusted = new javax.swing.JButton();
        btn_Support = new javax.swing.JButton();
        btn_Security = new javax.swing.JButton();
        jLabel4 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        Panel_Logout = new javax.swing.JPanel();

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 100, Short.MAX_VALUE)
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 100, Short.MAX_VALUE)
        );

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane1.setViewportView(jTable1);

        jTable2.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane2.setViewportView(jTable2);

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        setTitle("Coffee Master - Admin Management - v1.0.0");
        setResizable(false);

        tpAdmin.setBackground(new java.awt.Color(255, 204, 204));
        tpAdmin.setTabLayoutPolicy(javax.swing.JTabbedPane.SCROLL_TAB_LAYOUT);
        tpAdmin.setTabPlacement(javax.swing.JTabbedPane.LEFT);
        tpAdmin.setFont(new java.awt.Font("Source Sans Pro Semibold", 1, 20)); // NOI18N
        tpAdmin.setVerifyInputWhenFocusTarget(false);
        tpAdmin.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                tpAdminStateChanged(evt);
            }
        });

        Panel_menu.setLayout(new java.awt.GridBagLayout());

        jPanel7.setOpaque(false);

        jLabel7.setFont(new java.awt.Font("Source Sans Pro Semibold", 1, 20)); // NOI18N
        jLabel7.setForeground(new java.awt.Color(255, 255, 204));
        jLabel7.setText("Mã mặt hàng : ");

        jLabel8.setFont(new java.awt.Font("Source Sans Pro Semibold", 1, 20)); // NOI18N
        jLabel8.setForeground(new java.awt.Color(255, 255, 204));
        jLabel8.setText("Tên mặt hàng : ");

        tbMH.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Mã mặt hàng", "Tên mặt hàng", "List Size", "List Option", "Tình trạng"
            }
        ));
        tbMH.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tbMHMouseClicked(evt);
            }
        });
        jScrollPane3.setViewportView(tbMH);

        btnAddMH.setFont(new java.awt.Font("Source Sans Pro Semibold", 1, 18)); // NOI18N
        btnAddMH.setIcon(new javax.swing.ImageIcon(getClass().getResource("/coffeemaster/plus.png"))); // NOI18N
        btnAddMH.setText("Thêm");
        btnAddMH.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAddMHActionPerformed(evt);
            }
        });

        btnUpdateMH.setFont(new java.awt.Font("Source Sans Pro Semibold", 1, 18)); // NOI18N
        btnUpdateMH.setIcon(new javax.swing.ImageIcon(getClass().getResource("/coffeemaster/upgrade.png"))); // NOI18N
        btnUpdateMH.setText("Sửa");
        btnUpdateMH.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnUpdateMHActionPerformed(evt);
            }
        });

        btnClearMH.setFont(new java.awt.Font("Source Sans Pro Semibold", 1, 18)); // NOI18N
        btnClearMH.setIcon(new javax.swing.ImageIcon(getClass().getResource("/coffeemaster/delete.png"))); // NOI18N
        btnClearMH.setText("Clear");
        btnClearMH.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnClearMHActionPerformed(evt);
            }
        });

        jLabel9.setFont(new java.awt.Font("Source Sans Pro Semibold", 1, 20)); // NOI18N
        jLabel9.setForeground(new java.awt.Color(255, 255, 204));
        jLabel9.setText("Tình trạng:");

        cbStatusMH.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Kích hoạt", "Ẩn" }));

        txtSizeMH.setText("S[0.05]|M[0.1]|L[0.15]|XL[0.2]");

        jLabel10.setFont(new java.awt.Font("Source Sans Pro Semibold", 1, 20)); // NOI18N
        jLabel10.setForeground(new java.awt.Color(255, 255, 204));
        jLabel10.setText("List Size:");

        jLabel15.setFont(new java.awt.Font("Source Sans Pro Semibold", 1, 20)); // NOI18N
        jLabel15.setForeground(new java.awt.Color(255, 255, 204));
        jLabel15.setText("List Option:");

        txtOptionMH.setEnabled(false);

        btnDeleteMH.setFont(new java.awt.Font("Source Sans Pro Semibold", 1, 18)); // NOI18N
        btnDeleteMH.setIcon(new javax.swing.ImageIcon(getClass().getResource("/coffeemaster/upgrade.png"))); // NOI18N
        btnDeleteMH.setText("Xóa");
        btnDeleteMH.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnDeleteMHActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jScrollPane3))
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addGap(52, 52, 52)
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
                                    .addComponent(jLabel7)
                                    .addGap(33, 33, 33))
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
                                    .addComponent(jLabel8)
                                    .addGap(26, 26, 26)))
                            .addGroup(jPanel7Layout.createSequentialGroup()
                                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel10)
                                    .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel9))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(cbStatusMH, 0, 308, Short.MAX_VALUE)
                            .addComponent(txtOptionMH)
                            .addComponent(txtSizeMH, javax.swing.GroupLayout.DEFAULT_SIZE, 308, Short.MAX_VALUE)
                            .addComponent(txtIdMH)
                            .addComponent(txtNameMH))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 119, Short.MAX_VALUE)
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(btnUpdateMH, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(btnAddMH, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(btnDeleteMH, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addComponent(btnClearMH, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                .addGap(35, 35, 35))
        );

        jPanel7Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {btnAddMH, btnClearMH, btnUpdateMH});

        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addComponent(btnAddMH, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnUpdateMH)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnDeleteMH))
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel7)
                            .addComponent(txtIdMH, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(20, 20, 20)
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel8)
                            .addComponent(txtNameMH, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel10)
                            .addComponent(txtSizeMH, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel15)
                            .addComponent(txtOptionMH, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(18, 18, 18)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(cbStatusMH, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnClearMH))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 17, Short.MAX_VALUE)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 246, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        jPanel7Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {txtIdMH, txtNameMH});

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        Panel_menu.add(jPanel7, gridBagConstraints);

        jLabel5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/coffeemaster/ud.jpg"))); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        Panel_menu.add(jLabel5, gridBagConstraints);

        tpAdmin.addTab("Mặt Hàng", new javax.swing.ImageIcon(getClass().getResource("/coffeemaster/add.png")), Panel_menu); // NOI18N

        Panel_Material.setLayout(new java.awt.GridBagLayout());

        jPanel8.setOpaque(false);

        jLabel22.setFont(new java.awt.Font("Source Sans Pro Semibold", 1, 20)); // NOI18N
        jLabel22.setForeground(new java.awt.Color(255, 255, 204));
        jLabel22.setText("Tên sản phẩm:");

        jLabel23.setFont(new java.awt.Font("Source Sans Pro Semibold", 1, 20)); // NOI18N
        jLabel23.setForeground(new java.awt.Color(255, 255, 204));
        jLabel23.setText("Giá tiền:");

        jLabel24.setFont(new java.awt.Font("Source Sans Pro Semibold", 1, 20)); // NOI18N
        jLabel24.setForeground(new java.awt.Color(255, 255, 204));
        jLabel24.setText("Loại mặt hàng:");

        jLabel28.setFont(new java.awt.Font("Source Sans Pro Semibold", 1, 20)); // NOI18N
        jLabel28.setForeground(new java.awt.Color(255, 255, 204));
        jLabel28.setText("Mã sản phẩm:");

        tbSP.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Mã MH", "Tên MH", "Mã SP", "Tên SP", "Giá tiền", "Tình trạng"
            }
        ));
        tbSP.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tbSPMouseClicked(evt);
            }
        });
        jScrollPane6.setViewportView(tbSP);

        btnAddSP.setFont(new java.awt.Font("Source Sans Pro Semibold", 1, 16)); // NOI18N
        btnAddSP.setIcon(new javax.swing.ImageIcon(getClass().getResource("/coffeemaster/plus.png"))); // NOI18N
        btnAddSP.setText("Thêm");
        btnAddSP.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAddSPActionPerformed(evt);
            }
        });

        btnUpdateSP.setFont(new java.awt.Font("Source Sans Pro Semibold", 1, 16)); // NOI18N
        btnUpdateSP.setIcon(new javax.swing.ImageIcon(getClass().getResource("/coffeemaster/upgrade.png"))); // NOI18N
        btnUpdateSP.setText("Sửa");
        btnUpdateSP.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnUpdateSPActionPerformed(evt);
            }
        });

        btnClearSP.setFont(new java.awt.Font("Source Sans Pro Semibold", 1, 16)); // NOI18N
        btnClearSP.setIcon(new javax.swing.ImageIcon(getClass().getResource("/coffeemaster/delete.png"))); // NOI18N
        btnClearSP.setText("Clear");
        btnClearSP.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnClearSPActionPerformed(evt);
            }
        });

        cbMHSP.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

        cbStatusSP.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        cbStatusSP.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Kích hoạt", "Ẩn" }));

        jLabel25.setFont(new java.awt.Font("Source Sans Pro Semibold", 1, 20)); // NOI18N
        jLabel25.setForeground(new java.awt.Color(255, 255, 204));
        jLabel25.setText("Tình trạng:");

        btnDeleteSP.setFont(new java.awt.Font("Source Sans Pro Semibold", 1, 16)); // NOI18N
        btnDeleteSP.setIcon(new javax.swing.ImageIcon(getClass().getResource("/coffeemaster/upgrade.png"))); // NOI18N
        btnDeleteSP.setText("Xóa");
        btnDeleteSP.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnDeleteSPActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addGap(30, 30, 30)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel8Layout.createSequentialGroup()
                        .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel22, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(jLabel23)
                                .addComponent(jLabel24)
                                .addComponent(jLabel25))
                            .addComponent(jLabel28, javax.swing.GroupLayout.Alignment.TRAILING))
                        .addGap(25, 25, 25)
                        .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(cbMHSP, javax.swing.GroupLayout.PREFERRED_SIZE, 297, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtNameSP, javax.swing.GroupLayout.PREFERRED_SIZE, 297, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtPriceSP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtIdSP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(btnUpdateSP, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(btnAddSP, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(btnDeleteSP, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btnClearSP, javax.swing.GroupLayout.Alignment.TRAILING))
                        .addGap(80, 80, 80))
                    .addGroup(jPanel8Layout.createSequentialGroup()
                        .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, 715, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanel8Layout.createSequentialGroup()
                                .addGap(166, 166, 166)
                                .addComponent(cbStatusSP, javax.swing.GroupLayout.PREFERRED_SIZE, 297, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addContainerGap(55, Short.MAX_VALUE))))
        );

        jPanel8Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {txtIdSP, txtNameSP, txtPriceSP});

        jPanel8Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {btnAddSP, btnClearSP, btnUpdateSP});

        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel8Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel28)
                            .addComponent(txtIdSP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtNameSP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel22))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel23)
                            .addComponent(txtPriceSP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel24)
                            .addComponent(cbMHSP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel8Layout.createSequentialGroup()
                        .addGap(20, 20, 20)
                        .addComponent(btnAddSP)
                        .addGap(18, 18, 18)
                        .addComponent(btnUpdateSP)
                        .addGap(18, 18, 18)
                        .addComponent(btnDeleteSP)))
                .addGap(18, 18, 18)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel25)
                    .addGroup(jPanel8Layout.createSequentialGroup()
                        .addGap(4, 4, 4)
                        .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(cbStatusSP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btnClearSP))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 26, Short.MAX_VALUE)
                .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, 235, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        jPanel8Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {txtIdSP, txtNameSP, txtPriceSP});

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        Panel_Material.add(jPanel8, gridBagConstraints);

        jLabel12.setIcon(new javax.swing.ImageIcon(getClass().getResource("/coffeemaster/ud.jpg"))); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        Panel_Material.add(jLabel12, gridBagConstraints);

        tpAdmin.addTab("Sản Phẩm", new javax.swing.ImageIcon(getClass().getResource("/coffeemaster/grocery.png")), Panel_Material); // NOI18N

        Panel_Bill.setLayout(new java.awt.GridBagLayout());

        jPanel14.setOpaque(false);

        tbHD.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "ID Bàn", "Tên Bàn", "Mã hóa đơn", "Tổng tiền", "Thời gian"
            }
        ));
        tbHD.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tbHDMouseClicked(evt);
            }
        });
        jScrollPane7.setViewportView(tbHD);

        jLabel26.setFont(new java.awt.Font("Source Sans Pro Semibold", 1, 20)); // NOI18N
        jLabel26.setForeground(new java.awt.Color(255, 255, 204));
        jLabel26.setText("Tìm kiếm theo id: ");

        btnSearchIDHD.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        btnSearchIDHD.setText("Search");
        btnSearchIDHD.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSearchIDHDActionPerformed(evt);
            }
        });

        jLabel27.setFont(new java.awt.Font("Source Sans Pro Semibold", 1, 20)); // NOI18N
        jLabel27.setForeground(new java.awt.Color(255, 255, 204));
        jLabel27.setText("Tìm kiếm theo ngày: ");

        btnSearchDateHD.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        btnSearchDateHD.setText("Search");

        javax.swing.GroupLayout jPanel14Layout = new javax.swing.GroupLayout(jPanel14);
        jPanel14.setLayout(jPanel14Layout);
        jPanel14Layout.setHorizontalGroup(
            jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel14Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel14Layout.createSequentialGroup()
                        .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(jPanel14Layout.createSequentialGroup()
                                .addComponent(jLabel26, javax.swing.GroupLayout.PREFERRED_SIZE, 178, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(txtIDHD, javax.swing.GroupLayout.PREFERRED_SIZE, 316, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel14Layout.createSequentialGroup()
                                .addComponent(jLabel27)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(txtDateStartHD, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(txtDateStopHD, javax.swing.GroupLayout.PREFERRED_SIZE, 149, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(119, 119, 119)
                        .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(btnSearchIDHD)
                            .addComponent(btnSearchDateHD)))
                    .addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 732, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(100, Short.MAX_VALUE))
        );
        jPanel14Layout.setVerticalGroup(
            jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel14Layout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtIDHD, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel26)
                    .addComponent(btnSearchIDHD))
                .addGap(18, 18, 18)
                .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel27)
                    .addComponent(txtDateStartHD, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtDateStopHD, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnSearchDateHD))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 109, Short.MAX_VALUE)
                .addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 280, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        Panel_Bill.add(jPanel14, gridBagConstraints);

        jLabel16.setIcon(new javax.swing.ImageIcon(getClass().getResource("/coffeemaster/ud.jpg"))); // NOI18N
        jLabel16.setText("jLabel16");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        Panel_Bill.add(jLabel16, gridBagConstraints);

        tpAdmin.addTab("Hóa Đơn  ", new javax.swing.ImageIcon(getClass().getResource("/coffeemaster/invoice.png")), Panel_Bill); // NOI18N

        Panel_Staff.setLayout(new java.awt.GridBagLayout());

        jPanel11.setOpaque(false);

        cbStatusNV.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        cbStatusNV.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Đang Làm Việc", "Nghỉ Việc" }));

        jLabel35.setFont(new java.awt.Font("Source Sans Pro Semibold", 1, 20)); // NOI18N
        jLabel35.setForeground(new java.awt.Color(255, 255, 204));
        jLabel35.setText("SDT:");

        cbPositionNV.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        cbPositionNV.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Quản Lý", "Nhân Viên" }));

        tbNV.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Tài khoản", "Mật khẩu", "Tên", "Ngày sinh", "SĐT", "Quê Quán", "Tình trạng", "Chức Vụ"
            }
        ));
        tbNV.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tbNVMouseClicked(evt);
            }
        });
        jScrollPane8.setViewportView(tbNV);

        jLabel33.setFont(new java.awt.Font("Source Sans Pro Semibold", 1, 20)); // NOI18N
        jLabel33.setForeground(new java.awt.Color(255, 255, 204));
        jLabel33.setText("Tên NV: ");

        jLabel31.setFont(new java.awt.Font("Source Sans Pro Semibold", 1, 20)); // NOI18N
        jLabel31.setForeground(new java.awt.Color(255, 255, 204));
        jLabel31.setText("Tài khoản : ");

        btnUpdateNV.setFont(new java.awt.Font("Source Sans Pro Semibold", 1, 16)); // NOI18N
        btnUpdateNV.setText("Cập nhật");
        btnUpdateNV.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnUpdateNVActionPerformed(evt);
            }
        });

        jLabel37.setFont(new java.awt.Font("Source Sans Pro Semibold", 1, 20)); // NOI18N
        jLabel37.setForeground(new java.awt.Color(255, 255, 204));
        jLabel37.setText("Ngày sinh : ");

        jLabel36.setFont(new java.awt.Font("Source Sans Pro Semibold", 1, 20)); // NOI18N
        jLabel36.setForeground(new java.awt.Color(255, 255, 204));
        jLabel36.setText("Mật khẩu : ");

        btnAddNV.setFont(new java.awt.Font("Source Sans Pro Semibold", 1, 16)); // NOI18N
        btnAddNV.setText("Thêm");
        btnAddNV.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAddNVActionPerformed(evt);
            }
        });

        jLabel32.setFont(new java.awt.Font("Source Sans Pro Semibold", 1, 20)); // NOI18N
        jLabel32.setForeground(new java.awt.Color(255, 255, 204));
        jLabel32.setText("Chức vụ : ");

        btnClearNV.setFont(new java.awt.Font("Source Sans Pro Semibold", 1, 16)); // NOI18N
        btnClearNV.setIcon(new javax.swing.ImageIcon(getClass().getResource("/coffeemaster/delete.png"))); // NOI18N
        btnClearNV.setText("Clear");
        btnClearNV.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnClearNVActionPerformed(evt);
            }
        });

        jLabel34.setFont(new java.awt.Font("Source Sans Pro Semibold", 1, 20)); // NOI18N
        jLabel34.setForeground(new java.awt.Color(255, 255, 204));
        jLabel34.setText("Status:");

        jLabel38.setFont(new java.awt.Font("Source Sans Pro Semibold", 1, 20)); // NOI18N
        jLabel38.setForeground(new java.awt.Color(255, 255, 204));
        jLabel38.setText("Quê quán : ");

        javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11);
        jPanel11.setLayout(jPanel11Layout);
        jPanel11Layout.setHorizontalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel11Layout.createSequentialGroup()
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel11Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE, 733, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel11Layout.createSequentialGroup()
                        .addGap(72, 72, 72)
                        .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel36)
                            .addComponent(jLabel31)
                            .addComponent(jLabel33)
                            .addComponent(jLabel32)
                            .addComponent(jLabel35)
                            .addComponent(jLabel37)
                            .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addComponent(jLabel34, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 1, Short.MAX_VALUE)
                                .addComponent(jLabel38, javax.swing.GroupLayout.Alignment.LEADING)))
                        .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel11Layout.createSequentialGroup()
                                .addGap(9, 9, 9)
                                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addComponent(txtSDTNV)
                                        .addComponent(cbPositionNV, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(txtBirthdayNV, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 295, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addComponent(txtUsernameNV, javax.swing.GroupLayout.PREFERRED_SIZE, 295, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(txtNameNV, javax.swing.GroupLayout.PREFERRED_SIZE, 295, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(txtPasswordNV, javax.swing.GroupLayout.PREFERRED_SIZE, 295, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(txtAndressNV, javax.swing.GroupLayout.PREFERRED_SIZE, 295, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(jPanel11Layout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(cbStatusNV, javax.swing.GroupLayout.PREFERRED_SIZE, 302, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(83, 83, 83)
                        .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(btnClearNV, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(btnAddNV, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(btnUpdateNV, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                .addContainerGap(57, Short.MAX_VALUE))
        );
        jPanel11Layout.setVerticalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel11Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel11Layout.createSequentialGroup()
                        .addGap(8, 8, 8)
                        .addComponent(btnAddNV)
                        .addGap(18, 18, 18)
                        .addComponent(btnUpdateNV)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(jPanel11Layout.createSequentialGroup()
                        .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel31)
                            .addComponent(txtUsernameNV, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel36)
                            .addComponent(txtPasswordNV, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel33)
                            .addComponent(txtNameNV, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 20, Short.MAX_VALUE)
                        .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel32)
                            .addComponent(cbPositionNV, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel37)
                            .addComponent(txtBirthdayNV, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel38)
                            .addGroup(jPanel11Layout.createSequentialGroup()
                                .addGap(7, 7, 7)
                                .addComponent(txtAndressNV, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel35)
                            .addComponent(txtSDTNV, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btnClearNV))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel34)
                            .addComponent(cbStatusNV, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(14, 14, 14)))
                .addComponent(jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE, 182, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        Panel_Staff.add(jPanel11, gridBagConstraints);

        jLabel14.setIcon(new javax.swing.ImageIcon(getClass().getResource("/coffeemaster/ud.jpg"))); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        Panel_Staff.add(jLabel14, gridBagConstraints);

        tpAdmin.addTab("Nhân Viên  ", new javax.swing.ImageIcon(getClass().getResource("/coffeemaster/staff.png")), Panel_Staff); // NOI18N

        Panel_Statistical.setRequestFocusEnabled(false);
        Panel_Statistical.setVerifyInputWhenFocusTarget(false);
        Panel_Statistical.setLayout(new java.awt.GridBagLayout());

        jPanel6.setOpaque(false);

        btn_Top.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        btn_Top.setIcon(new javax.swing.ImageIcon(getClass().getResource("/coffeemaster/ranking.png"))); // NOI18N
        btn_Top.setText("Sản Phẩm Bán Chạy Nhất ");
        btn_Top.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btn_Top.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);

        btn_Revenue.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        btn_Revenue.setIcon(new javax.swing.ImageIcon(getClass().getResource("/coffeemaster/revenue.png"))); // NOI18N
        btn_Revenue.setText("Doanh Thu Của Tháng");
        btn_Revenue.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btn_Revenue.setRequestFocusEnabled(false);
        btn_Revenue.setRolloverEnabled(false);
        btn_Revenue.setVerifyInputWhenFocusTarget(false);
        btn_Revenue.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);

        btn_Time.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        btn_Time.setIcon(new javax.swing.ImageIcon(getClass().getResource("/coffeemaster/calendar.png"))); // NOI18N
        btn_Time.setText("Thời Gian Làm Việc ");
        btn_Time.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btn_Time.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addGap(106, 106, 106)
                        .addComponent(btn_Revenue)
                        .addGap(49, 49, 49)
                        .addComponent(btn_Top))
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addGap(238, 238, 238)
                        .addComponent(btn_Time)))
                .addContainerGap(111, Short.MAX_VALUE))
        );

        jPanel6Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {btn_Revenue, btn_Time, btn_Top});

        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addGap(70, 70, 70)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btn_Top)
                    .addComponent(btn_Revenue))
                .addGap(34, 34, 34)
                .addComponent(btn_Time)
                .addContainerGap(198, Short.MAX_VALUE))
        );

        jPanel6Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {btn_Revenue, btn_Time, btn_Top});

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        Panel_Statistical.add(jPanel6, gridBagConstraints);

        jLabel13.setIcon(new javax.swing.ImageIcon(getClass().getResource("/coffeemaster/ud.jpg"))); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        Panel_Statistical.add(jLabel13, gridBagConstraints);

        tpAdmin.addTab("Thông Kê  ", new javax.swing.ImageIcon(getClass().getResource("/coffeemaster/presentation.png")), Panel_Statistical); // NOI18N

        Panel_Settings.setLayout(new java.awt.GridBagLayout());

        jPanel9.setOpaque(false);

        btn_Information.setBackground(new java.awt.Color(255, 255, 255));
        btn_Information.setIcon(new javax.swing.ImageIcon(getClass().getResource("/coffeemaster/personal-information.png"))); // NOI18N

        btn_Adjusted.setBackground(new java.awt.Color(255, 255, 255));
        btn_Adjusted.setIcon(new javax.swing.ImageIcon(getClass().getResource("/coffeemaster/adjust.png"))); // NOI18N

        btn_Support.setBackground(new java.awt.Color(255, 255, 255));
        btn_Support.setIcon(new javax.swing.ImageIcon(getClass().getResource("/coffeemaster/support.png"))); // NOI18N

        btn_Security.setBackground(new java.awt.Color(255, 255, 255));
        btn_Security.setIcon(new javax.swing.ImageIcon(getClass().getResource("/coffeemaster/shield.png"))); // NOI18N

        jLabel4.setFont(new java.awt.Font("Tahoma", 1, 20)); // NOI18N
        jLabel4.setForeground(new java.awt.Color(255, 255, 204));
        jLabel4.setText("Thông tin cá nhân");

        jLabel3.setFont(new java.awt.Font("Tahoma", 1, 20)); // NOI18N
        jLabel3.setForeground(new java.awt.Color(255, 255, 204));
        jLabel3.setText("Hỗ trợ");

        jLabel2.setFont(new java.awt.Font("Tahoma", 1, 20)); // NOI18N
        jLabel2.setForeground(new java.awt.Color(255, 255, 204));
        jLabel2.setText("Điều chỉnh giao diện");

        jLabel11.setFont(new java.awt.Font("Tahoma", 1, 20)); // NOI18N
        jLabel11.setForeground(new java.awt.Color(255, 255, 204));
        jLabel11.setText("Bảo mật phần mền ");

        javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
        jPanel9.setLayout(jPanel9Layout);
        jPanel9Layout.setHorizontalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup()
                .addGap(0, 189, Short.MAX_VALUE)
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup()
                        .addComponent(jLabel3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(btn_Support))
                    .addGroup(jPanel9Layout.createSequentialGroup()
                        .addComponent(jLabel2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(btn_Adjusted))
                    .addGroup(jPanel9Layout.createSequentialGroup()
                        .addComponent(jLabel4)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(btn_Information))
                    .addGroup(jPanel9Layout.createSequentialGroup()
                        .addComponent(jLabel11)
                        .addGap(94, 94, 94)
                        .addComponent(btn_Security)))
                .addGap(256, 256, 256))
        );
        jPanel9Layout.setVerticalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addGap(31, 31, 31)
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel4)
                    .addComponent(btn_Information))
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup()
                        .addGap(18, 40, Short.MAX_VALUE)
                        .addComponent(btn_Security)
                        .addGap(34, 34, 34))
                    .addGroup(jPanel9Layout.createSequentialGroup()
                        .addGap(33, 33, 33)
                        .addComponent(jLabel11)
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btn_Adjusted)
                    .addGroup(jPanel9Layout.createSequentialGroup()
                        .addGap(8, 8, 8)
                        .addComponent(jLabel2)))
                .addGap(30, 30, 30)
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btn_Support)
                    .addGroup(jPanel9Layout.createSequentialGroup()
                        .addGap(8, 8, 8)
                        .addComponent(jLabel3)))
                .addContainerGap(201, Short.MAX_VALUE))
        );

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        Panel_Settings.add(jPanel9, gridBagConstraints);

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/coffeemaster/ud.jpg"))); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        Panel_Settings.add(jLabel1, gridBagConstraints);

        tpAdmin.addTab("Settings  ", new javax.swing.ImageIcon(getClass().getResource("/coffeemaster/settings.png")), Panel_Settings); // NOI18N

        javax.swing.GroupLayout Panel_LogoutLayout = new javax.swing.GroupLayout(Panel_Logout);
        Panel_Logout.setLayout(Panel_LogoutLayout);
        Panel_LogoutLayout.setHorizontalGroup(
            Panel_LogoutLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 839, Short.MAX_VALUE)
        );
        Panel_LogoutLayout.setVerticalGroup(
            Panel_LogoutLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 504, Short.MAX_VALUE)
        );

        tpAdmin.addTab("Đăng Xuất", new javax.swing.ImageIcon(getClass().getResource("/coffeemaster/exit.png")), Panel_Logout); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(tpAdmin, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 973, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(tpAdmin, javax.swing.GroupLayout.PREFERRED_SIZE, 509, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void tbNVMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tbNVMouseClicked
        int index = tbNV.getSelectedRow();
        fillToFormNV(alUserApps.get(index));
    }//GEN-LAST:event_tbNVMouseClicked

    private void btnAddNVActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddNVActionPerformed
        if (!checkFormNV()) {
            return;
        }
        if (!confirm("Bạn chắc chắn muốn thêm chứ?")) {
            return;
        }
        if (!AdminProcess.addAccount(Main.sqlServerConn, formToUserApp())) {
            alert("Không thể thêm nhân viên, hãy thử lại!");
            return;
        }
        alUserApps = AdminProcess.getArrayListAccount(Main.sqlServerConn);
        fillToTableNV(alUserApps);
        alert("Thêm nhân viên thành công!");
    }//GEN-LAST:event_btnAddNVActionPerformed

    private void btnUpdateNVActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUpdateNVActionPerformed
        int index = tbNV.getSelectedRow();
        if (index == -1) {
            alert("Phải chọn tài khoản cần cập nhật!");
            return;
        }
        if (!checkFormNV()) {
            return;
        }
        if (!confirm("Bạn chắc chắn muốn cập nhật?")) {
            return;
        }
        if (!AdminProcess.updateAccount(Main.sqlServerConn, alUserApps.get(index).getUsername(), formToUserApp())) {
            alert("Cập nhật thất bại, hãy thử lại!");
            return;
        }
        alUserApps = AdminProcess.getArrayListAccount(Main.sqlServerConn);
        fillToTableNV(alUserApps);
        alert("Cập nhật thành công!");
    }//GEN-LAST:event_btnUpdateNVActionPerformed

    private void btnClearNVActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnClearNVActionPerformed
        clearFormNV();
    }//GEN-LAST:event_btnClearNVActionPerformed

    private void btnAddMHActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddMHActionPerformed
        if (!checkFormMH()) {
            return;
        }
        if (!confirm("Bạn chắc chắn muốn thêm chứ?")) {
            return;
        }
        if (!AdminProcess.addItem(Main.sqlServerConn, formToItemApp())) {
            alert("Không thể thêm mặt hàng!");
            return;
        }
        alItemApps = AdminProcess.getArrayListItem(Main.sqlServerConn);
        fillToTableMH(alItemApps);
        alert("Thêm mặt hàng thành công!");
    }//GEN-LAST:event_btnAddMHActionPerformed

    private void tbMHMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tbMHMouseClicked
        int index = tbMH.getSelectedRow();
        fillToFormMH(alItemApps.get(index));
    }//GEN-LAST:event_tbMHMouseClicked

    private void btnUpdateMHActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUpdateMHActionPerformed
        int index = tbMH.getSelectedRow();
        if (index == -1) {
            alert("Phải chọn mặt hàng cần cập nhật!");
            return;
        }
        if (!checkFormMH()) {
            return;
        }
        if (!confirm("Bạn chắc chắn muốn cập nhật?")) {
            return;
        }
        if (!AdminProcess.updateItem(Main.sqlServerConn, alItemApps.get(index).getId(), formToItemApp())) {
            alert("Cập nhật thất bại, hãy thử lại!");
            return;
        }
        alItemApps = AdminProcess.getArrayListItem(Main.sqlServerConn);
        fillToTableMH(alItemApps);
        alert("Cập nhật thành công!");
    }//GEN-LAST:event_btnUpdateMHActionPerformed

    private void btnClearMHActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnClearMHActionPerformed
        clearFormMH();
    }//GEN-LAST:event_btnClearMHActionPerformed

    private void btnClearSPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnClearSPActionPerformed
        clearFormSP();
    }//GEN-LAST:event_btnClearSPActionPerformed

    private void tpAdminStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_tpAdminStateChanged
        int index = tpAdmin.getSelectedIndex();
        switch (index) {
            case 0:
                alItemApps = AdminProcess.getArrayListItem(Main.sqlServerConn);
                fillToTableMH(alItemApps);
                break;
            case 1:
                //quản lý sản phẩm
                alProductApps = AdminProcess.getArrayListProduct(Main.sqlServerConn);
                fillToTableSP(alProductApps);
                fillToComboBoxItemSP(alItemApps);
                break;
            case 2:
                alBills = AdminProcess.getBill(Main.sqlServerConn);
                fillToTableHD(alBills);
                break;
            case 3:
                //quản lý nhân viên
                alUserApps = AdminProcess.getArrayListAccount(Main.sqlServerConn);
                fillToTableNV(alUserApps);
                break;
            case 6:
                tpAdmin.setSelectedIndex(0);
                setVisible(false);
                break;
        }
    }//GEN-LAST:event_tpAdminStateChanged

    private void btnAddSPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddSPActionPerformed
        if (!checkFormSP()) {
            return;
        }
        if (!confirm("Bạn chắc chắn muốn thêm chứ?")) {
            return;
        }
        if (!AdminProcess.addProduct(Main.sqlServerConn, formToProductApp())) {
            alert("Thêm mặt hàng thất bại!");
            return;
        }
        alProductApps = AdminProcess.getArrayListProduct(Main.sqlServerConn);
        fillToTableSP(alProductApps);
        alert("Thêm mặt hàng thành công!");
    }//GEN-LAST:event_btnAddSPActionPerformed

    private void btnUpdateSPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUpdateSPActionPerformed
        int index = tbSP.getSelectedRow();
        if (index == -1) {
            alert("Phải chọn sản phẩm cần cập nhật!");
            return;
        }
        if (!checkFormSP()) {
            return;
        }
        if (!confirm("Bạn chắc chắn muốn cập nhật?")) {
            return;
        }
        if (!AdminProcess.updateProduct(Main.sqlServerConn, alProductApps.get(index).getIdSP(), formToProductApp())) {
            alert("Cập nhật thất bại, hãy thử lại!");
            return;
        }
        alProductApps = AdminProcess.getArrayListProduct(Main.sqlServerConn);
        fillToTableSP(alProductApps);
        alert("Cập nhật thành công!");
    }//GEN-LAST:event_btnUpdateSPActionPerformed

    private void tbSPMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tbSPMouseClicked
        int index = tbSP.getSelectedRow();
        fillToFormSP(alProductApps.get(index));
    }//GEN-LAST:event_tbSPMouseClicked

    private void btnDeleteSPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDeleteSPActionPerformed
        int index = tbSP.getSelectedRow();
        if (index == -1) {
            alert("Phải chọn 1 sản phẩm cần xóa!");
            return;
        }
        if (!confirm("Bạn chắc chắn muốn xóa chứ?")) {
            return;
        }
        if (!AdminProcess.deleteProduct(Main.sqlServerConn, alProductApps.get(index).getIdSP())) {
            alert("Xóa sản phẩm thất bại!");
            return;
        }
        alProductApps = AdminProcess.getArrayListProduct(Main.sqlServerConn);
        fillToTableSP(alProductApps);
        alert("Xóa sản phẩm thành công!");
    }//GEN-LAST:event_btnDeleteSPActionPerformed

    private void btnDeleteMHActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDeleteMHActionPerformed
        int index = tbMH.getSelectedRow();
        if (index == -1) {
            alert("Phải chọn 1 mặt hàng cần xóa!");
            return;
        }
        if (!confirm("Bạn chắc chắn muốn xóa chứ?")) {
            return;
        }
        if (!AdminProcess.deleteItem(Main.sqlServerConn, alItemApps.get(index).getId())) {
            alert("Xóa mặt hàng thất bại!");
            return;
        }
        alItemApps = AdminProcess.getArrayListItem(Main.sqlServerConn);
        fillToTableMH(alItemApps);
        alert("Xóa mặt hàng thành công!");
    }//GEN-LAST:event_btnDeleteMHActionPerformed

    private void tbHDMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tbHDMouseClicked
        int index = tbHD.getSelectedRow();
        Bill bill = alBills.get(index);
        ItemDetailAdminManagement itemDetailAdminManagement = new ItemDetailAdminManagement();
        itemDetailAdminManagement.setIdHD(bill.getId() + "");
        itemDetailAdminManagement.setTimeHD(bill.getDate().toString());
        itemDetailAdminManagement.setTotalMoneyHD((int) bill.getTotalMoney());
        itemDetailAdminManagement.setArrayListBillItem(AdminProcess.getBillItem(Main.sqlServerConn, bill.getId()));
    }//GEN-LAST:event_tbHDMouseClicked

    private void btnSearchIDHDActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSearchIDHDActionPerformed
        if (!checkFormSearchNV()) {
            return;
        }
        int idHD = Integer.parseInt(txtIDHD.getText().trim());
        Bill bill = AdminProcess.getBill(Main.sqlServerConn, idHD);
        if (bill == null) {
            alert("Không tìm thấy mã hóa đơn này!");
            return;
        }
        ArrayList<BillItem> alBillItems = AdminProcess.getBillItem(Main.sqlServerConn, idHD);
        ItemDetailAdminManagement itemDetailAdminManagement = new ItemDetailAdminManagement();
        itemDetailAdminManagement.setIdHD(idHD + "");
        itemDetailAdminManagement.setTimeHD(bill.getDate().toString());
        itemDetailAdminManagement.setTotalMoneyHD((int) bill.getTotalMoney());
        itemDetailAdminManagement.setArrayListBillItem(alBillItems);
    }//GEN-LAST:event_btnSearchIDHDActionPerformed
    //tab Hóa đơn
    private ArrayList<Bill> alBills;
    private ArrayList<BillItem> alBillItems;

    private void fillToTableHD(ArrayList<Bill> alBills) {
        DefaultTableModel model = (DefaultTableModel) tbHD.getModel();
        model.setRowCount(0);
        alBills.forEach((bill) -> {
            model.addRow(bill.toArray());
        });
    }

    private boolean checkFormSearchNV() {
        try {
            Integer.parseInt(txtIDHD.getText().trim());
        } catch (NumberFormatException e) {
            alert("Mã hóa đơn không hợp lệ!");
            return false;
        }
        return true;
    }

    //tab sản phẩm
    private ArrayList<ProductApp> alProductApps;

    private void fillToFormSP(ProductApp productApp) {
        txtIdSP.setText(productApp.getIdSP());
        txtNameSP.setText(productApp.getNameSP());
        txtPriceSP.setText(productApp.getPriceSP() + "");
        cbMHSP.setSelectedItem("[" + productApp.getId() + "] " + productApp.getName());
    }

    private ProductApp formToProductApp() {
        ProductApp productApp = new ProductApp();

        String nameItem = cbMHSP.getSelectedItem().toString();
        String idItem = Function.parseIdString(nameItem);

        if (idItem == null) {
            return null;
        }

        productApp.setId(idItem);
        productApp.setIdSP(txtIdSP.getText().trim());
        productApp.setNameSP(txtNameSP.getText().trim());
        productApp.setPriceSP(Integer.parseInt(txtPriceSP.getText().trim()));
        productApp.setActiveSP(cbStatusSP.getSelectedIndex() == 0);

        return productApp;
    }

    private boolean checkFormSP() {
        if (txtIdSP.getText().trim().equals("")) {
            alert("mã sản phẩm không được để trống!");
            return false;
        }
        if (txtNameSP.getText().trim().equals("")) {
            alert("tên sản phẩm không được để trống!");
            return false;
        }
        try {
            Integer.parseInt(txtPriceSP.getText().trim());
        } catch (NumberFormatException e) {
            alert("Giá tiền không hợp lệ!");
            return false;
        }
        return true;
    }

    private void clearFormSP() {
        txtIdSP.setText("");
        txtNameSP.setText("");
        txtPriceSP.setText("");
        cbMHSP.setSelectedIndex(0);
    }

    private void fillToComboBoxItemSP(ArrayList<ItemApp> alItemApps) {
        DefaultComboBoxModel model = (DefaultComboBoxModel) cbMHSP.getModel();
        model.removeAllElements();
        alItemApps.forEach((itemApp) -> {
            if (itemApp.isActive()) {
                model.addElement("[" + itemApp.getId() + "] " + itemApp.getName());
            }
        });
    }

    private void fillToTableSP(ArrayList<ProductApp> alProductApps) {
        DefaultTableModel model = (DefaultTableModel) tbSP.getModel();
        model.setRowCount(0);
        alProductApps.forEach((productApp) -> {
            if (productApp.isActive()) {
                model.addRow(productApp.toArray());
            }
        });
    }
    //tab mặt hàng
    private ArrayList<ItemApp> alItemApps;

    private void fillToFormMH(ItemApp itemApp) {
        txtIdMH.setText(itemApp.getId());
        txtNameMH.setText(itemApp.getName());
        txtSizeMH.setText(itemApp.sizeToString());
        txtOptionMH.setText(itemApp.optionToString());
        cbStatusMH.setSelectedIndex(itemApp.isActive() ? 0 : 1);
    }

    private ItemApp formToItemApp() {
        ItemApp itemApp = new ItemApp();
        itemApp.setId(txtIdMH.getText().trim());
        itemApp.setName(txtNameMH.getText().trim());
        itemApp.setListSize(AdminProcess.parseListSizeFromItemApp(txtSizeMH.getText().trim()));
        itemApp.setListOption(AdminProcess.parseListOptionFromItemApp(txtOptionMH.getText().trim()));
        itemApp.setActive(cbStatusMH.getSelectedIndex() == 0);
        return itemApp;
    }

    private boolean checkFormMH() {
        if (txtIdMH.getText().trim().equals("")) {
            alert("mã mặt hàng không được trống!");
            return false;
        }
        if (txtNameMH.getText().trim().equals("")) {
            alert("tên mặt hàng không được trống!");
            return false;
        }
        return true;
    }

    private void clearFormMH() {
        txtIdMH.setText("");
        txtNameMH.setText("");
        cbStatusMH.setSelectedIndex(0);
    }

    private void fillToTableMH(ArrayList<ItemApp> alItemApps) {
        DefaultTableModel model = (DefaultTableModel) tbMH.getModel();
        model.setRowCount(0);
        alItemApps.forEach((itemApp) -> {
            model.addRow(itemApp.toArray());
        });
    }
    //Tab nhân viên
    private ArrayList<UserApp> alUserApps;

    private void clearFormNV() {
        txtUsernameNV.setText("");
        txtPasswordNV.setText("");
        txtNameNV.setText("");
        cbPositionNV.setSelectedIndex(0);
        txtBirthdayNV.setText("");
        txtAndressNV.setText("");
        txtSDTNV.setText("");
        cbStatusNV.setSelectedIndex(0);
    }

    private UserApp formToUserApp() {
        UserApp userApp = new UserApp();
        userApp.setUsername(txtUsernameNV.getText().trim());
        userApp.setPassword(txtPasswordNV.getText().trim());
        userApp.setName(txtNameNV.getText().trim());
        userApp.setBirthday(txtBirthdayNV.getText().trim());
        userApp.setPhone(txtSDTNV.getText().trim());
        userApp.setAndress(txtAndressNV.getText().trim());
        userApp.setStatus(cbStatusNV.getSelectedIndex() == 0);
        userApp.setRoles(cbPositionNV.getSelectedIndex() == 0 ? 1 : 2);
        return userApp;
    }

    private void fillToFormNV(UserApp userApp) {
        txtUsernameNV.setText(userApp.getUsername());
        txtPasswordNV.setText(userApp.getPassword());
        txtNameNV.setText(userApp.getUsername());
        cbPositionNV.setSelectedIndex(userApp.getRoles() == 1 ? 0 : 1);
        txtBirthdayNV.setText(userApp.getBirthday());
        txtAndressNV.setText(userApp.getAndress());
        txtSDTNV.setText(userApp.getPhone());
        cbStatusNV.setSelectedIndex(userApp.isStatus() ? 0 : 1);
    }

    private void fillToTableNV(ArrayList<UserApp> alUserApps) {
        DefaultTableModel model = (DefaultTableModel) tbNV.getModel();
        model.setRowCount(0);
        alUserApps.forEach((userApp) -> {
            model.addRow(userApp.toArray());
        });
    }

    private boolean checkFormNV() {
        if (txtUsernameNV.getText().trim().equals("")) {
            alert("tài khoản không được để trống!");
            return false;
        }
        if (txtPasswordNV.getText().trim().equals("")) {
            alert("mật khẩu không được để trống!");
            return false;
        }
        if (txtNameNV.getText().trim().equals("")) {
            alert("Tên không được để trống!");
            return false;
        }
        try {
            new SimpleDateFormat("dd/mm/YYYY").parse(txtBirthdayNV.getText().trim());
        } catch (ParseException e) {
            alert("năm tháng không đúng định dạng!");
            return false;
        }
        if (txtAndressNV.getText().trim().equals("")) {
            alert("Quê quán không được để trống!");
            return false;
        }
        if (txtSDTNV.getText().trim().equals("")) {
            alert("Số điện thoại không được để trống!");
            return false;
        }
        return true;
    }

    //
    private boolean confirm(String content) {
        return JOptionPane.showConfirmDialog(this, content) == 0;
    }

    private void alert(String content) {
        JOptionPane.showMessageDialog(this, content);
    }
    //
    //end nhân viên
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel Panel_Bill;
    private javax.swing.JPanel Panel_Logout;
    private javax.swing.JPanel Panel_Material;
    private javax.swing.JPanel Panel_Settings;
    private javax.swing.JPanel Panel_Staff;
    private javax.swing.JPanel Panel_Statistical;
    private javax.swing.JPanel Panel_menu;
    private javax.swing.JButton btnAddMH;
    private javax.swing.JButton btnAddNV;
    private javax.swing.JButton btnAddSP;
    private javax.swing.JButton btnClearMH;
    private javax.swing.JButton btnClearNV;
    private javax.swing.JButton btnClearSP;
    private javax.swing.JButton btnDeleteMH;
    private javax.swing.JButton btnDeleteSP;
    private javax.swing.JButton btnSearchDateHD;
    private javax.swing.JButton btnSearchIDHD;
    private javax.swing.JButton btnUpdateMH;
    private javax.swing.JButton btnUpdateNV;
    private javax.swing.JButton btnUpdateSP;
    private javax.swing.JButton btn_Adjusted;
    private javax.swing.JButton btn_Information;
    private javax.swing.JButton btn_Revenue;
    private javax.swing.JButton btn_Security;
    private javax.swing.JButton btn_Support;
    private javax.swing.JButton btn_Time;
    private javax.swing.JButton btn_Top;
    private javax.swing.JComboBox<String> cbMHSP;
    private javax.swing.JComboBox<String> cbPositionNV;
    private javax.swing.JComboBox<String> cbStatusMH;
    private javax.swing.JComboBox<String> cbStatusNV;
    private javax.swing.JComboBox<String> cbStatusSP;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel31;
    private javax.swing.JLabel jLabel32;
    private javax.swing.JLabel jLabel33;
    private javax.swing.JLabel jLabel34;
    private javax.swing.JLabel jLabel35;
    private javax.swing.JLabel jLabel36;
    private javax.swing.JLabel jLabel37;
    private javax.swing.JLabel jLabel38;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel14;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JScrollPane jScrollPane7;
    private javax.swing.JScrollPane jScrollPane8;
    private javax.swing.JTable jTable1;
    private javax.swing.JTable jTable2;
    private javax.swing.JTable tbHD;
    private javax.swing.JTable tbMH;
    private javax.swing.JTable tbNV;
    private javax.swing.JTable tbSP;
    private javax.swing.JTabbedPane tpAdmin;
    private javax.swing.JTextField txtAndressNV;
    private javax.swing.JTextField txtBirthdayNV;
    private javax.swing.JTextField txtDateStartHD;
    private javax.swing.JTextField txtDateStopHD;
    private javax.swing.JTextField txtIDHD;
    private javax.swing.JTextField txtIdMH;
    private javax.swing.JTextField txtIdSP;
    private javax.swing.JTextField txtNameMH;
    private javax.swing.JTextField txtNameNV;
    private javax.swing.JTextField txtNameSP;
    private javax.swing.JTextField txtOptionMH;
    private javax.swing.JTextField txtPasswordNV;
    private javax.swing.JTextField txtPriceSP;
    private javax.swing.JTextField txtSDTNV;
    private javax.swing.JTextField txtSizeMH;
    private javax.swing.JTextField txtUsernameNV;
    // End of variables declaration//GEN-END:variables
}
