Sales.TabbedPaneWin.java Source code

Java tutorial

Introduction

Here is the source code for Sales.TabbedPaneWin.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Sales;

//import interfaces.MainWindow;
import HRM.Login;
import java.awt.BorderLayout;
import java.awt.Dimension;
import static Sales.OOAgreement.dispalyTableExpiary;
import static Sales.OOClient.refreshTableClient;
import static Sales.OOClient.searchTableClientName;
import static Sales.OOInvoice.refreshTableInvoice;
import static Sales.OOInvoice.searchTableItemName;
import static Sales.incrementations.getNextAgreementIdStr;
import static Sales.incrementations.getNextClientIdStr;
import static Sales.incrementations.getNextInvoiceIdStr;
import static Sales.incrementations.nextAgreementId;
import static Sales.incrementations.nextClientId;
import static Sales.incrementations.nextInvoiceId;
//import pkg8ware_totalmanagementsystem.DBAccess;
import static Sales.incrementations.getNextAgreementIdStr;
import static Sales.incrementations.getNextClientIdStr;
import static Sales.incrementations.getNextInvoiceIdStr;
import static Sales.incrementations.nextAgreementId;
import static Sales.incrementations.nextClientId;
import static Sales.incrementations.nextInvoiceId;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.DefaultListModel;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.ListModel;
import javax.swing.table.DefaultTableModel;
import net.proteanit.sql.DbUtils;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.view.JasperViewer;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import static org.jfree.chart.demo.PieChartDemo1.createDemoPanel;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.plot.PiePlot;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.category.DefaultCategoryDataset;
import org.jfree.data.general.DefaultPieDataset;
import org.jfree.data.time.Year;
//import Sales.Login;
//import reportsHaritha.ReportView;

/**
 *
 * @author harithaperera
 */
public class TabbedPaneWin extends javax.swing.JFrame {

    /**
     * Creates new form SalesPerformanceWin
     */
    OOClient clientSetter = new OOClient();
    DefaultListModel dlm = new DefaultListModel();

    public TabbedPaneWin() throws Exception {
        initComponents();
        setLocationRelativeTo(null);

        initCustom();

    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        homeBtn = new javax.swing.JButton();
        logoutBtn = new javax.swing.JButton();
        jLabel3 = new javax.swing.JLabel();
        loggedUserNamelbl = new javax.swing.JLabel();
        jSeparator2 = new javax.swing.JSeparator();
        jSeparator1 = new javax.swing.JSeparator();
        jTabbedPane2 = new javax.swing.JTabbedPane();
        jPanel8 = new javax.swing.JPanel();
        jPanel16 = new javax.swing.JPanel();
        coEmailTxtF = new javax.swing.JTextField();
        jLabel31 = new javax.swing.JLabel();
        jLabel32 = new javax.swing.JLabel();
        coNameTxtF = new javax.swing.JTextField();
        coMobileTxtF = new javax.swing.JTextField();
        jLabel33 = new javax.swing.JLabel();
        jLabel66 = new javax.swing.JLabel();
        coIdF = new javax.swing.JTextField();
        jLabel70 = new javax.swing.JLabel();
        jLabel72 = new javax.swing.JLabel();
        jLabel73 = new javax.swing.JLabel();
        jLabel34 = new javax.swing.JLabel();
        resetBtn2 = new javax.swing.JButton();
        modifyRecBtn = new javax.swing.JButton();
        jScrollPane8 = new javax.swing.JScrollPane();
        jTable3 = new javax.swing.JTable();
        jPanel17 = new javax.swing.JPanel();
        mobileTxtF = new javax.swing.JTextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        addrTxtF = new javax.swing.JTextArea();
        jLabel35 = new javax.swing.JLabel();
        jLabel36 = new javax.swing.JLabel();
        jLabel37 = new javax.swing.JLabel();
        telephoneTxtF = new javax.swing.JTextField();
        jLabel38 = new javax.swing.JLabel();
        emailTxtF = new javax.swing.JTextField();
        jLabel39 = new javax.swing.JLabel();
        jLabel40 = new javax.swing.JLabel();
        faxTxtF = new javax.swing.JTextField();
        nameTxtF = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        clientIdTxtF2 = new org.jdesktop.swingx.JXTextField();
        jLabel1 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        jLabel43 = new javax.swing.JLabel();
        jLabel44 = new javax.swing.JLabel();
        jLabel45 = new javax.swing.JLabel();
        registerBtn = new javax.swing.JButton();
        removeBtn = new javax.swing.JButton();
        tableSearchField1 = new org.jdesktop.swingx.JXTextField();
        jPanel7 = new javax.swing.JPanel();
        resetBtn = new javax.swing.JButton();
        renewAgreementBtn = new javax.swing.JButton();
        jPanel15 = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        toDateChooser = new com.toedter.calendar.JDateChooser();
        jLabel7 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        fromDateChooser = new com.toedter.calendar.JDateChooser();
        agTypeComboBox = new javax.swing.JComboBox<>();
        agreementIdTxtF = new org.jdesktop.swingx.JXTextField();
        jLabel63 = new javax.swing.JLabel();
        agreementIdTxtF1 = new org.jdesktop.swingx.JXTextField();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jScrollPane13 = new javax.swing.JScrollPane();
        jList1 = new javax.swing.JList<>();
        jTextField1 = new javax.swing.JTextField();
        jLabel67 = new javax.swing.JLabel();
        jLabel71 = new javax.swing.JLabel();
        jLabel74 = new javax.swing.JLabel();
        jLabel75 = new javax.swing.JLabel();
        jLabel76 = new javax.swing.JLabel();
        clientIdTxtF4 = new org.jdesktop.swingx.JXTextField();
        jScrollPane7 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        cancelAgreementBtn = new javax.swing.JButton();
        addAgreementBtn = new javax.swing.JButton();
        jLabel9 = new javax.swing.JLabel();
        jPanel22 = new javax.swing.JPanel();
        clientIdTxtF5 = new org.jdesktop.swingx.JXTextField();
        jButton3 = new javax.swing.JButton();
        jPanel5 = new javax.swing.JPanel();
        jPanel3 = new javax.swing.JPanel();
        addToCartBtn = new javax.swing.JButton();
        saleQtyTxtF = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jScrollPane3 = new javax.swing.JScrollPane();
        selectItemsTable = new javax.swing.JTable();
        searchTxtF = new org.jdesktop.swingx.JXTextField();
        jLabel80 = new javax.swing.JLabel();
        jPanel4 = new javax.swing.JPanel();
        removeSelectedBtn = new javax.swing.JButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        clientCartTable = new javax.swing.JTable();
        ClearCartBtn = new javax.swing.JButton();
        jPanel1 = new javax.swing.JPanel();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        invoiceDateTxtF = new javax.swing.JTextField();
        clientIdTxtF = new javax.swing.JTextField();
        jScrollPane4 = new javax.swing.JScrollPane();
        remarksTxtF = new javax.swing.JTextArea();
        invoiceNoTxtF = new org.jdesktop.swingx.JXTextField();
        jLabel24 = new javax.swing.JLabel();
        clientIdTxtF1 = new javax.swing.JTextField();
        jComboBox1 = new javax.swing.JComboBox<>();
        jLabel25 = new javax.swing.JLabel();
        jLabel77 = new javax.swing.JLabel();
        jLabel78 = new javax.swing.JLabel();
        jLabel81 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        duePaymentTxtF = new javax.swing.JTextField();
        jLabel19 = new javax.swing.JLabel();
        totAmountLbl1 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        discountTxtF = new javax.swing.JTextField();
        jLabel21 = new javax.swing.JLabel();
        totalPaymentTxtF = new javax.swing.JTextField();
        createInvoiceBtn = new javax.swing.JButton();
        jLabel22 = new javax.swing.JLabel();
        grandTotalLbl1 = new javax.swing.JLabel();
        jLabel64 = new javax.swing.JLabel();
        jLabel65 = new javax.swing.JLabel();
        jLabel79 = new javax.swing.JLabel();
        jLabel82 = new javax.swing.JLabel();
        jLabel83 = new javax.swing.JLabel();
        jPanel6 = new javax.swing.JPanel();
        jTabbedPane3 = new javax.swing.JTabbedPane();
        jPanel9 = new javax.swing.JPanel();
        jLabel23 = new javax.swing.JLabel();
        exportExcelBtn1 = new javax.swing.JButton();
        jScrollPane5 = new javax.swing.JScrollPane();
        jTable2 = new javax.swing.JTable();
        clientNSearchTextF = new org.jdesktop.swingx.JXTextField();
        jPanel23 = new javax.swing.JPanel();
        amountTxtF1 = new javax.swing.JTextField();
        totPayTxtF1 = new javax.swing.JTextField();
        duePayTxtF1 = new javax.swing.JTextField();
        jLabel30 = new javax.swing.JLabel();
        jLabel28 = new javax.swing.JLabel();
        jLabel29 = new javax.swing.JLabel();
        jPanel10 = new javax.swing.JPanel();
        exportExcelBtn2 = new javax.swing.JButton();
        jScrollPane9 = new javax.swing.JScrollPane();
        jTable4 = new javax.swing.JTable();
        jLabel47 = new javax.swing.JLabel();
        invoiceSearchTextF = new org.jdesktop.swingx.JXTextField();
        invoiceSearchTextF1 = new org.jdesktop.swingx.JXTextField();
        jLabel69 = new javax.swing.JLabel();
        jPanel11 = new javax.swing.JPanel();
        jPanel13 = new javax.swing.JPanel();
        fromDateChooser4 = new com.toedter.calendar.JDateChooser();
        ToDateChooser4 = new com.toedter.calendar.JDateChooser();
        jScrollPane11 = new javax.swing.JScrollPane();
        jTable6 = new javax.swing.JTable();
        jLabel54 = new javax.swing.JLabel();
        jLabel55 = new javax.swing.JLabel();
        jButton6 = new javax.swing.JButton();
        jPanel20 = new javax.swing.JPanel();
        jLabel53 = new javax.swing.JLabel();
        duePayTxtF3 = new javax.swing.JTextField();
        totPayTxtF3 = new javax.swing.JTextField();
        jLabel56 = new javax.swing.JLabel();
        jLabel51 = new javax.swing.JLabel();
        amountTxtF3 = new javax.swing.JTextField();
        jPanel21 = new javax.swing.JPanel();
        jPanel14 = new javax.swing.JPanel();
        jScrollPane12 = new javax.swing.JScrollPane();
        jTable7 = new javax.swing.JTable();
        jLabel60 = new javax.swing.JLabel();
        jLabel61 = new javax.swing.JLabel();
        toSearchTextF1 = new org.jdesktop.swingx.JXTextField();
        fromSearchTextF1 = new org.jdesktop.swingx.JXTextField();
        jButton5 = new javax.swing.JButton();
        jLabel84 = new javax.swing.JLabel();
        jLabel85 = new javax.swing.JLabel();
        jPanel18 = new javax.swing.JPanel();
        jPanel19 = new javax.swing.JPanel();
        jLabel57 = new javax.swing.JLabel();
        jLabel62 = new javax.swing.JLabel();
        jLabel59 = new javax.swing.JLabel();
        duePayTxtF4 = new javax.swing.JTextField();
        totPayTxtF4 = new javax.swing.JTextField();
        amountTxtF4 = new javax.swing.JTextField();
        jPanel12 = new javax.swing.JPanel();
        jLabel46 = new javax.swing.JLabel();
        jScrollPane10 = new javax.swing.JScrollPane();
        jTable5 = new javax.swing.JTable();
        jLabel48 = new javax.swing.JLabel();
        fromDateChooser3 = new com.toedter.calendar.JDateChooser();
        ToDateChooser3 = new com.toedter.calendar.JDateChooser();
        jButton7 = new javax.swing.JButton();
        jPanel24 = new javax.swing.JPanel();
        jLabel52 = new javax.swing.JLabel();
        jLabel42 = new javax.swing.JLabel();
        jLabel50 = new javax.swing.JLabel();
        amountTxtF2 = new javax.swing.JTextField();
        totPayTxtF2 = new javax.swing.JTextField();
        duePayTxtF2 = new javax.swing.JTextField();
        jPanel25 = new javax.swing.JPanel();
        jButton4 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                formMouseClicked(evt);
            }
        });

        homeBtn.setText("Home");
        homeBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                homeBtnActionPerformed(evt);
            }
        });

        logoutBtn.setText("Logout");
        logoutBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                logoutBtnActionPerformed(evt);
            }
        });

        jLabel3.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLabel3.setForeground(new java.awt.Color(51, 51, 255));
        jLabel3.setText("Logged in as  :");

        loggedUserNamelbl.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        loggedUserNamelbl.setForeground(new java.awt.Color(51, 51, 255));
        loggedUserNamelbl.setText("loggedUserNamelbl");

        jTabbedPane2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTabbedPane2MouseClicked(evt);
            }
        });

        jPanel8.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jPanel16.setBorder(javax.swing.BorderFactory.createTitledBorder("Coordinator Details"));

        coEmailTxtF.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseExited(java.awt.event.MouseEvent evt) {
                coEmailTxtFMouseExited(evt);
            }
        });

        jLabel31.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel31.setText("Name");

        jLabel32.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel32.setText("E-mail");

        coNameTxtF.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                coNameTxtFKeyReleased(evt);
            }
        });

        coMobileTxtF.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseExited(java.awt.event.MouseEvent evt) {
                coMobileTxtFMouseExited(evt);
            }
        });

        jLabel33.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel33.setText("Mobile");

        jLabel66.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel66.setText("ID");

        coIdF.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                coIdFKeyReleased(evt);
            }
        });

        jLabel70.setFont(new java.awt.Font("Lucida Grande", 1, 18)); // NOI18N
        jLabel70.setForeground(new java.awt.Color(255, 0, 51));
        jLabel70.setText("*");

        jLabel72.setFont(new java.awt.Font("Lucida Grande", 1, 18)); // NOI18N
        jLabel72.setForeground(new java.awt.Color(255, 0, 51));
        jLabel72.setText("*");

        jLabel73.setFont(new java.awt.Font("Lucida Grande", 1, 18)); // NOI18N
        jLabel73.setForeground(new java.awt.Color(255, 0, 51));
        jLabel73.setText("*");

        javax.swing.GroupLayout jPanel16Layout = new javax.swing.GroupLayout(jPanel16);
        jPanel16.setLayout(jPanel16Layout);
        jPanel16Layout.setHorizontalGroup(jPanel16Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel16Layout.createSequentialGroup().addContainerGap()
                        .addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabel31).addComponent(jLabel33).addComponent(jLabel32)
                                .addComponent(jLabel66))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 157, Short.MAX_VALUE)
                        .addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel16Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(coMobileTxtF, javax.swing.GroupLayout.Alignment.TRAILING,
                                                javax.swing.GroupLayout.PREFERRED_SIZE, 315,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(coEmailTxtF, javax.swing.GroupLayout.Alignment.TRAILING,
                                                javax.swing.GroupLayout.PREFERRED_SIZE, 315,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(coNameTxtF, javax.swing.GroupLayout.Alignment.TRAILING,
                                                javax.swing.GroupLayout.PREFERRED_SIZE, 315,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addComponent(coIdF, javax.swing.GroupLayout.Alignment.TRAILING,
                                        javax.swing.GroupLayout.PREFERRED_SIZE, 315,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel16Layout.createSequentialGroup().addGap(15, 15, 15).addComponent(
                                        jLabel70, javax.swing.GroupLayout.PREFERRED_SIZE, 20,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel16Layout.createSequentialGroup().addGap(18, 18, 18)
                                        .addGroup(jPanel16Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(jLabel73, javax.swing.GroupLayout.PREFERRED_SIZE, 20,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(jLabel72, javax.swing.GroupLayout.PREFERRED_SIZE, 20,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE))))
                        .addGap(27, 27, 27)));
        jPanel16Layout.setVerticalGroup(jPanel16Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel16Layout.createSequentialGroup()
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel16Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(coIdF, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jLabel70))
                                .addComponent(jLabel66, javax.swing.GroupLayout.Alignment.TRAILING))
                        .addGap(17, 17, 17)
                        .addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addGroup(jPanel16Layout.createSequentialGroup().addComponent(jLabel31)
                                        .addGap(29, 29, 29).addComponent(jLabel33))
                                .addGroup(jPanel16Layout.createSequentialGroup()
                                        .addComponent(coNameTxtF, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addGroup(jPanel16Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                                .addComponent(coMobileTxtF, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(jLabel73))))
                        .addGap(23, 23, 23)
                        .addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(jLabel32)
                                .addGroup(jPanel16Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(coEmailTxtF, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jLabel72)))
                        .addGap(41, 41, 41)));

        jPanel8.add(jPanel16, new org.netbeans.lib.awtextra.AbsoluteConstraints(477, 6, 600, 209));

        jLabel34.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel34.setText("Search by");
        jPanel8.add(jLabel34, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 380, -1, -1));

        resetBtn2.setFont(new java.awt.Font("Lucida Grande", 1, 14)); // NOI18N
        resetBtn2.setText("Reset");
        resetBtn2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                resetBtn2ActionPerformed(evt);
            }
        });
        jPanel8.add(resetBtn2, new org.netbeans.lib.awtextra.AbsoluteConstraints(940, 330, 140, 35));

        modifyRecBtn.setFont(new java.awt.Font("Lucida Grande", 1, 14)); // NOI18N
        modifyRecBtn.setText("Modify Record");
        modifyRecBtn.setEnabled(false);
        modifyRecBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                modifyRecBtnActionPerformed(evt);
            }
        });
        jPanel8.add(modifyRecBtn, new org.netbeans.lib.awtextra.AbsoluteConstraints(630, 330, 150, 35));

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

        }, new String[] { "ClientID", "ClientName", "Address", "Mobile", "Telephone", "Fax", "Email", "Co-Name",
                "Co-Mobile", "Co-Mail", "AgreementID" }) {
            Class[] types = new Class[] { java.lang.String.class, java.lang.String.class, java.lang.String.class,
                    java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class,
                    java.lang.String.class, java.lang.String.class, java.lang.String.class,
                    java.lang.String.class };

            public Class getColumnClass(int columnIndex) {
                return types[columnIndex];
            }
        });
        jTable3.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTable3MouseClicked(evt);
            }
        });
        jScrollPane8.setViewportView(jTable3);

        jPanel8.add(jScrollPane8, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 411, 1070, 150));

        jPanel17.setBorder(javax.swing.BorderFactory.createTitledBorder("Client Details"));

        mobileTxtF.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseExited(java.awt.event.MouseEvent evt) {
                mobileTxtFMouseExited(evt);
            }
        });

        addrTxtF.setColumns(20);
        addrTxtF.setRows(5);
        jScrollPane1.setViewportView(addrTxtF);

        jLabel35.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel35.setText("Mobile");

        jLabel36.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel36.setText("Client ID ");

        jLabel37.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel37.setText("Name");

        telephoneTxtF.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseExited(java.awt.event.MouseEvent evt) {
                telephoneTxtFMouseExited(evt);
            }
        });

        jLabel38.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel38.setText("Telephone");

        emailTxtF.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseExited(java.awt.event.MouseEvent evt) {
                emailTxtFMouseExited(evt);
            }
        });
        emailTxtF.addInputMethodListener(new java.awt.event.InputMethodListener() {
            public void caretPositionChanged(java.awt.event.InputMethodEvent evt) {
            }

            public void inputMethodTextChanged(java.awt.event.InputMethodEvent evt) {
                emailTxtFInputMethodTextChanged(evt);
            }
        });
        emailTxtF.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                emailTxtFKeyReleased(evt);
            }
        });

        jLabel39.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel39.setText("Address");

        jLabel40.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel40.setText("Fax");

        faxTxtF.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseExited(java.awt.event.MouseEvent evt) {
                faxTxtFMouseExited(evt);
            }
        });

        jLabel10.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel10.setText("E-mail");

        clientIdTxtF2.setPrompt("CXXXX");
        clientIdTxtF2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseExited(java.awt.event.MouseEvent evt) {
                clientIdTxtF2MouseExited(evt);
            }
        });
        clientIdTxtF2.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                clientIdTxtF2KeyTyped(evt);
            }

            public void keyReleased(java.awt.event.KeyEvent evt) {
                clientIdTxtF2KeyReleased(evt);
            }
        });

        jLabel1.setFont(new java.awt.Font("Lucida Grande", 1, 18)); // NOI18N
        jLabel1.setForeground(new java.awt.Color(255, 0, 51));
        jLabel1.setText("*");

        jLabel18.setFont(new java.awt.Font("Lucida Grande", 1, 18)); // NOI18N
        jLabel18.setForeground(new java.awt.Color(255, 0, 51));
        jLabel18.setText("*");

        jLabel43.setFont(new java.awt.Font("Lucida Grande", 1, 18)); // NOI18N
        jLabel43.setForeground(new java.awt.Color(255, 0, 51));
        jLabel43.setText("*");

        jLabel44.setFont(new java.awt.Font("Lucida Grande", 1, 18)); // NOI18N
        jLabel44.setForeground(new java.awt.Color(255, 0, 51));
        jLabel44.setText("*");

        jLabel45.setFont(new java.awt.Font("Lucida Grande", 1, 18)); // NOI18N
        jLabel45.setForeground(new java.awt.Color(255, 0, 51));
        jLabel45.setText("*");

        javax.swing.GroupLayout jPanel17Layout = new javax.swing.GroupLayout(jPanel17);
        jPanel17.setLayout(jPanel17Layout);
        jPanel17Layout
                .setHorizontalGroup(jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel17Layout.createSequentialGroup().addContainerGap().addGroup(jPanel17Layout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(jLabel38)
                                .addComponent(jLabel36, javax.swing.GroupLayout.DEFAULT_SIZE, 85, Short.MAX_VALUE)
                                .addComponent(jLabel37, javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jLabel39, javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jLabel10, javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jLabel40, javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jLabel35, javax.swing.GroupLayout.DEFAULT_SIZE, 76, Short.MAX_VALUE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 22,
                                        Short.MAX_VALUE)
                                .addGroup(jPanel17Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addComponent(nameTxtF, javax.swing.GroupLayout.Alignment.TRAILING)
                                        .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, 294, Short.MAX_VALUE)
                                        .addComponent(mobileTxtF, javax.swing.GroupLayout.Alignment.TRAILING)
                                        .addComponent(telephoneTxtF, javax.swing.GroupLayout.Alignment.TRAILING)
                                        .addComponent(faxTxtF, javax.swing.GroupLayout.Alignment.TRAILING)
                                        .addComponent(emailTxtF, javax.swing.GroupLayout.Alignment.TRAILING)
                                        .addComponent(clientIdTxtF2, javax.swing.GroupLayout.Alignment.TRAILING,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanel17Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 20,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jLabel43, javax.swing.GroupLayout.PREFERRED_SIZE, 20,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jLabel44, javax.swing.GroupLayout.PREFERRED_SIZE, 20,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jLabel45, javax.swing.GroupLayout.PREFERRED_SIZE, 20,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(15, 15, 15))
                        .addGroup(jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                        jPanel17Layout.createSequentialGroup().addContainerGap(412, Short.MAX_VALUE)
                                                .addComponent(jLabel18, javax.swing.GroupLayout.PREFERRED_SIZE, 20,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addGap(16, 16, 16))));
        jPanel17Layout
                .setVerticalGroup(jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel17Layout.createSequentialGroup().addContainerGap().addGroup(
                                jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(clientIdTxtF2, javax.swing.GroupLayout.PREFERRED_SIZE, 21,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jLabel36))
                                .addGap(10, 10, 10)
                                .addGroup(jPanel17Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addGroup(jPanel17Layout
                                                .createSequentialGroup().addComponent(jLabel37).addGap(18, 18, 18)
                                                .addComponent(jLabel39))
                                        .addGroup(jPanel17Layout.createSequentialGroup()
                                                .addComponent(nameTxtF, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(
                                                        javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        64, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addGap(18, 18, 18)
                                .addGroup(jPanel17Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(jLabel35)
                                        .addComponent(mobileTxtF, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jLabel43))
                                .addGap(24, 24, 24)
                                .addGroup(jPanel17Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(jLabel38)
                                        .addComponent(telephoneTxtF, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jLabel1))
                                .addGap(18, 18, 18)
                                .addGroup(jPanel17Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(jLabel40)
                                        .addComponent(faxTxtF, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jLabel44))
                                .addGap(18, 18, 18)
                                .addGroup(jPanel17Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(jLabel10)
                                        .addComponent(emailTxtF, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jLabel45))
                                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addGroup(jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel17Layout.createSequentialGroup().addGap(16, 16, 16)
                                        .addComponent(jLabel18).addContainerGap(299, Short.MAX_VALUE))));

        jPanel8.add(jPanel17, new org.netbeans.lib.awtextra.AbsoluteConstraints(6, 6, 460, 360));

        registerBtn.setFont(new java.awt.Font("Lucida Grande", 1, 14)); // NOI18N
        registerBtn.setText("Register Client");
        registerBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                registerBtnActionPerformed(evt);
            }
        });
        jPanel8.add(registerBtn, new org.netbeans.lib.awtextra.AbsoluteConstraints(480, 330, 140, 35));

        removeBtn.setFont(new java.awt.Font("Lucida Grande", 1, 14)); // NOI18N
        removeBtn.setText("Remove Client");
        removeBtn.setEnabled(false);
        removeBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                removeBtnActionPerformed(evt);
            }
        });
        jPanel8.add(removeBtn, new org.netbeans.lib.awtextra.AbsoluteConstraints(790, 330, 140, 35));

        tableSearchField1.setPrompt("Client Name/ClientID");
        tableSearchField1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tableSearchField1ActionPerformed(evt);
            }
        });
        tableSearchField1.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                tableSearchField1KeyReleased(evt);
            }
        });
        jPanel8.add(tableSearchField1, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 370, 206, -1));

        jTabbedPane2.addTab("Client Management", jPanel8);

        resetBtn.setFont(new java.awt.Font("Lucida Grande", 1, 14)); // NOI18N
        resetBtn.setText("Reset");
        resetBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                resetBtnActionPerformed(evt);
            }
        });

        renewAgreementBtn.setFont(new java.awt.Font("Lucida Grande", 1, 14)); // NOI18N
        renewAgreementBtn.setText("Renew Agreement");
        renewAgreementBtn.setEnabled(false);
        renewAgreementBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                renewAgreementBtnActionPerformed(evt);
            }
        });

        jPanel15.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        jPanel15.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel4.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel4.setText("Agreement Type");
        jPanel15.add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 80, -1, -1));

        toDateChooser.setDateFormatString("yyyy-MM-d ");
        jPanel15.add(toDateChooser, new org.netbeans.lib.awtextra.AbsoluteConstraints(810, 250, 160, -1));
        //toDateChooser.setEditable(false);

        jLabel7.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel7.setText("From");
        jPanel15.add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(460, 260, -1, 20));

        jLabel6.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel6.setText("Renew Agreement");
        jPanel15.add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 260, -1, -1));

        jLabel5.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel5.setText("Asests ");
        jPanel15.add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 110, -1, -1));

        jLabel8.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel8.setText("To");
        jPanel15.add(jLabel8, new org.netbeans.lib.awtextra.AbsoluteConstraints(740, 250, -1, 30));

        jLabel2.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel2.setText("Agreement ID");
        jPanel15.add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 10, -1, -1));

        fromDateChooser.setDateFormatString("yyyy-MM-d ");
        jPanel15.add(fromDateChooser, new org.netbeans.lib.awtextra.AbsoluteConstraints(530, 250, 160, -1));
        //fromDateChooser.setEditable(false);

        fromDateChooser.setDate(new Date());//set current Date

        agTypeComboBox
                .setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Platinum", "Gold", "Silver" }));
        jPanel15.add(agTypeComboBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(460, 80, 500, -1));

        agreementIdTxtF.setPrompt("ItemCode/Type");
        agreementIdTxtF.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseExited(java.awt.event.MouseEvent evt) {
                agreementIdTxtFMouseExited(evt);
            }
        });
        agreementIdTxtF.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                agreementIdTxtFActionPerformed(evt);
            }
        });
        agreementIdTxtF.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                agreementIdTxtFKeyReleased(evt);
            }
        });
        jPanel15.add(agreementIdTxtF, new org.netbeans.lib.awtextra.AbsoluteConstraints(460, 110, 250, -1));

        jLabel63.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel63.setText("Client Name");
        jPanel15.add(jLabel63, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 40, -1, -1));

        agreementIdTxtF1.setPrompt("AXXXX");
        agreementIdTxtF1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseExited(java.awt.event.MouseEvent evt) {
                agreementIdTxtF1MouseExited(evt);
            }
        });
        agreementIdTxtF1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                agreementIdTxtF1ActionPerformed(evt);
            }
        });
        agreementIdTxtF1.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                agreementIdTxtF1KeyReleased(evt);
            }
        });
        jPanel15.add(agreementIdTxtF1, new org.netbeans.lib.awtextra.AbsoluteConstraints(460, 10, 500, -1));

        jButton1.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jButton1.setText("Remove");
        jButton1.setEnabled(false);
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        jPanel15.add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(840, 110, 120, -1));

        jButton2.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jButton2.setText("Add");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });
        jPanel15.add(jButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(720, 110, 120, -1));

        jList1.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                jList1ValueChanged(evt);
            }
        });
        jScrollPane13.setViewportView(jList1);

        jPanel15.add(jScrollPane13, new org.netbeans.lib.awtextra.AbsoluteConstraints(460, 150, 500, 90));

        jTextField1.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                jTextField1FocusLost(evt);
            }
        });
        jTextField1.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jTextField1KeyReleased(evt);
            }
        });
        jPanel15.add(jTextField1, new org.netbeans.lib.awtextra.AbsoluteConstraints(460, 40, 330, -1));

        jLabel67.setFont(new java.awt.Font("Lucida Grande", 1, 18)); // NOI18N
        jLabel67.setForeground(new java.awt.Color(255, 0, 51));
        jLabel67.setText("*");
        jPanel15.add(jLabel67, new org.netbeans.lib.awtextra.AbsoluteConstraints(980, 250, 30, -1));

        jLabel71.setFont(new java.awt.Font("Lucida Grande", 1, 18)); // NOI18N
        jLabel71.setForeground(new java.awt.Color(255, 0, 51));
        jLabel71.setText("*");
        jPanel15.add(jLabel71, new org.netbeans.lib.awtextra.AbsoluteConstraints(970, 10, 30, -1));

        jLabel74.setFont(new java.awt.Font("Lucida Grande", 1, 18)); // NOI18N
        jLabel74.setForeground(new java.awt.Color(255, 0, 51));
        jLabel74.setText("*");
        jPanel15.add(jLabel74, new org.netbeans.lib.awtextra.AbsoluteConstraints(970, 110, 30, -1));

        jLabel75.setFont(new java.awt.Font("Lucida Grande", 1, 18)); // NOI18N
        jLabel75.setForeground(new java.awt.Color(255, 0, 51));
        jLabel75.setText("*");
        jPanel15.add(jLabel75, new org.netbeans.lib.awtextra.AbsoluteConstraints(700, 250, 30, -1));

        jLabel76.setFont(new java.awt.Font("Lucida Grande", 1, 18)); // NOI18N
        jLabel76.setForeground(new java.awt.Color(255, 0, 51));
        jLabel76.setText("*");
        jPanel15.add(jLabel76, new org.netbeans.lib.awtextra.AbsoluteConstraints(970, 40, 30, -1));

        clientIdTxtF4.setPrompt("CXXXX");
        clientIdTxtF4.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseExited(java.awt.event.MouseEvent evt) {
                clientIdTxtF4MouseExited(evt);
            }
        });
        clientIdTxtF4.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                clientIdTxtF4KeyReleased(evt);
            }
        });
        jPanel15.add(clientIdTxtF4, new org.netbeans.lib.awtextra.AbsoluteConstraints(800, 40, 160, -1));

        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, null, null }, { null, null, null, null, null, null } },
                new String[] { "AgreementID", "ClientID", "Agreement Type", "Assest", "Last Modified Date",
                        "Expire Date" }) {
            Class[] types = new Class[] { java.lang.String.class, java.lang.String.class, java.lang.String.class,
                    java.lang.String.class, java.lang.String.class, java.lang.String.class };

            public Class getColumnClass(int columnIndex) {
                return types[columnIndex];
            }
        });
        jTable1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTable1MouseClicked(evt);
            }
        });
        jScrollPane7.setViewportView(jTable1);

        cancelAgreementBtn.setFont(new java.awt.Font("Lucida Grande", 1, 14)); // NOI18N
        cancelAgreementBtn.setText("Cancel Agreement ");
        cancelAgreementBtn.setEnabled(false);
        cancelAgreementBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cancelAgreementBtnActionPerformed(evt);
            }
        });

        addAgreementBtn.setFont(new java.awt.Font("Lucida Grande", 1, 14)); // NOI18N
        addAgreementBtn.setText("Add Agreement");
        addAgreementBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addAgreementBtnActionPerformed(evt);
            }
        });

        jLabel9.setFont(new java.awt.Font("Lucida Grande", 1, 14)); // NOI18N
        jLabel9.setText("Expired Agreements");

        jPanel22.setBorder(javax.swing.BorderFactory.createTitledBorder("Detailed Report"));

        clientIdTxtF5.setPrompt("agreement type");
        clientIdTxtF5.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseExited(java.awt.event.MouseEvent evt) {
                clientIdTxtF5MouseExited(evt);
            }
        });
        clientIdTxtF5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                clientIdTxtF5ActionPerformed(evt);
            }
        });
        clientIdTxtF5.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                clientIdTxtF5KeyReleased(evt);
            }
        });

        jButton3.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jButton3.setText("Show");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel22Layout = new javax.swing.GroupLayout(jPanel22);
        jPanel22.setLayout(jPanel22Layout);
        jPanel22Layout
                .setHorizontalGroup(jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel22Layout.createSequentialGroup()
                                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(clientIdTxtF5, javax.swing.GroupLayout.PREFERRED_SIZE, 130,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jButton3).addGap(25, 25, 25)));
        jPanel22Layout.setVerticalGroup(jPanel22Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel22Layout.createSequentialGroup()
                        .addGroup(jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(clientIdTxtF5, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jButton3))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
                jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(jPanel7Layout
                        .createSequentialGroup().addGroup(jPanel7Layout.createParallelGroup(
                                javax.swing.GroupLayout.Alignment.LEADING).addGroup(
                                        jPanel7Layout.createSequentialGroup().addGap(460, 460, 460).addComponent(
                                                jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 174,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel7Layout.createSequentialGroup().addGap(40, 40,
                                        40).addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 1020,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel7Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                        .addGroup(
                                                jPanel7Layout.createSequentialGroup().addGap(50, 50, 50)
                                                        .addComponent(addAgreementBtn,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE, 151,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addGap(18, 18, 18)
                                                        .addComponent(renewAgreementBtn,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE, 165,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addGap(18, 18, 18)
                                                        .addComponent(cancelAgreementBtn,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE, 177,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addGap(18, 18, 18)
                                                        .addComponent(resetBtn,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE, 170,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addPreferredGap(
                                                                javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                Short.MAX_VALUE)
                                                        .addComponent(jPanel22,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE, 229,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addGroup(jPanel7Layout.createSequentialGroup().addGap(47, 47, 47)
                                                .addComponent(jPanel15, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE))))
                        .addContainerGap(42, Short.MAX_VALUE)));
        jPanel7Layout.setVerticalGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel7Layout.createSequentialGroup()
                        .addComponent(jPanel15, javax.swing.GroupLayout.PREFERRED_SIZE, 290,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel7Layout.createSequentialGroup().addGap(20, 20, 20)
                                        .addGroup(jPanel7Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                                .addComponent(addAgreementBtn,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE, 40,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(renewAgreementBtn,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE, 37,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(cancelAgreementBtn,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE, 37,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(resetBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 40,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                        jPanel7Layout.createSequentialGroup()
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(jPanel22, javax.swing.GroupLayout.PREFERRED_SIZE, 55,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(9, 9, 9)
                        .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 40,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, 0).addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 170,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(131, 131, 131)));

        jTabbedPane2.addTab("Add/Renew Agreements", jPanel7);

        jPanel5.setLayout(null);

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Select Items"));

        addToCartBtn.setFont(new java.awt.Font("Lucida Grande", 1, 14)); // NOI18N
        addToCartBtn.setText("Add to Cart");
        addToCartBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addToCartBtnActionPerformed(evt);
            }
        });

        saleQtyTxtF.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseExited(java.awt.event.MouseEvent evt) {
                saleQtyTxtFMouseExited(evt);
            }
        });
        saleQtyTxtF.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                saleQtyTxtFActionPerformed(evt);
            }
        });

        jLabel14.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel14.setText("Sale Qty");

        jLabel13.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel13.setText("Search by");

        selectItemsTable.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[] { "ItemCode", "Item Name", "Remarks", "Unit Price" }) {
            Class[] types = new Class[] { java.lang.String.class, java.lang.String.class, java.lang.String.class,
                    java.lang.Double.class };

            public Class getColumnClass(int columnIndex) {
                return types[columnIndex];
            }
        });
        jScrollPane3.setViewportView(selectItemsTable);

        searchTxtF.setPrompt("ItemCode/Type");
        searchTxtF.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseExited(java.awt.event.MouseEvent evt) {
                searchTxtFMouseExited(evt);
            }
        });
        searchTxtF.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                searchTxtFKeyReleased(evt);
            }
        });

        jLabel80.setFont(new java.awt.Font("Lucida Grande", 1, 18)); // NOI18N
        jLabel80.setForeground(new java.awt.Color(255, 0, 51));
        jLabel80.setText("*");

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(jPanel3Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel3Layout.createSequentialGroup().addGroup(jPanel3Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel3Layout.createSequentialGroup().addGap(5, 5, 5).addGroup(jPanel3Layout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel3Layout.createSequentialGroup().addGap(6, 6, 6)
                                        .addComponent(jLabel13).addGap(18, 18, 18).addComponent(searchTxtF,
                                                javax.swing.GroupLayout.PREFERRED_SIZE, 197,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel3Layout.createSequentialGroup().addGap(12, 12, 12)
                                        .addComponent(jLabel14).addGap(24, 24, 24)
                                        .addComponent(saleQtyTxtF, javax.swing.GroupLayout.PREFERRED_SIZE, 200,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(17, 17, 17).addComponent(jLabel80,
                                                javax.swing.GroupLayout.PREFERRED_SIZE, 30,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))))
                        .addGroup(jPanel3Layout.createSequentialGroup().addGap(11, 11, 11).addComponent(
                                jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 581,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                jPanel3Layout.createSequentialGroup().addContainerGap().addComponent(addToCartBtn,
                                        javax.swing.GroupLayout.PREFERRED_SIZE, 586,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
        jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel3Layout.createSequentialGroup().addGap(6, 6, 6).addGroup(jPanel3Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel3Layout.createSequentialGroup().addGap(6, 6, 6).addComponent(jLabel13))
                        .addComponent(searchTxtF, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(6, 6, 6)
                        .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 122,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(7, 7, 7)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel3Layout.createSequentialGroup().addGap(6, 6, 6)
                                        .addComponent(jLabel14))
                                .addComponent(saleQtyTxtF, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGroup(jPanel3Layout.createSequentialGroup().addGap(3, 3, 3)
                                        .addComponent(jLabel80)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(addToCartBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 37,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap()));

        jPanel5.add(jPanel3);
        jPanel3.setBounds(470, 10, 620, 270);

        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Client Cart"));

        removeSelectedBtn.setFont(new java.awt.Font("Lucida Grande", 1, 14)); // NOI18N
        removeSelectedBtn.setText("Remove Selected");
        removeSelectedBtn.setEnabled(false);
        removeSelectedBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                removeSelectedBtnActionPerformed(evt);
            }
        });

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

        }, new String[] { "ItemCode", "Item Name", "Unit Price", "SaleQty", "Total Amount" }) {
            Class[] types = new Class[] { java.lang.String.class, java.lang.String.class, java.lang.Double.class,
                    java.lang.Integer.class, java.lang.Double.class };

            public Class getColumnClass(int columnIndex) {
                return types[columnIndex];
            }
        });
        jScrollPane2.setViewportView(clientCartTable);

        ClearCartBtn.setFont(new java.awt.Font("Lucida Grande", 1, 14)); // NOI18N
        ClearCartBtn.setText("Clear Cart");
        ClearCartBtn.setEnabled(false);
        ClearCartBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ClearCartBtnActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(jPanel4Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel4Layout.createSequentialGroup().addContainerGap()
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel4Layout.createSequentialGroup()
                                        .addComponent(removeSelectedBtn, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                291, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(ClearCartBtn, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 586,
                                        Short.MAX_VALUE))
                        .addContainerGap()));
        jPanel4Layout.setVerticalGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel4Layout.createSequentialGroup().addContainerGap()
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 166, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(
                                jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addComponent(ClearCartBtn, javax.swing.GroupLayout.DEFAULT_SIZE, 42,
                                                Short.MAX_VALUE)
                                        .addComponent(removeSelectedBtn, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addContainerGap()));

        jPanel5.add(jPanel4);
        jPanel4.setBounds(470, 300, 610, 250);

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Billing"));
        jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel11.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel11.setText("Remarks");
        jPanel1.add(jLabel11, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 200, 70, -1));

        jLabel12.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel12.setText("Client Name");
        jPanel1.add(jLabel12, new org.netbeans.lib.awtextra.AbsoluteConstraints(16, 97, 90, -1));

        jLabel15.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel15.setText("Invoice#");
        jPanel1.add(jLabel15, new org.netbeans.lib.awtextra.AbsoluteConstraints(16, 30, 90, -1));

        jLabel16.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel16.setText("Invoice Date");
        jPanel1.add(jLabel16, new org.netbeans.lib.awtextra.AbsoluteConstraints(16, 68, 100, -1));

        invoiceDateTxtF.setEnabled(false);
        invoiceDateTxtF.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                invoiceDateTxtFActionPerformed(evt);
            }
        });
        jPanel1.add(invoiceDateTxtF, new org.netbeans.lib.awtextra.AbsoluteConstraints(174, 60, 240, 30));
        new Thread(new Runnable() {
            @Override
            public void run() {
                for (;;) {
                    DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
                    Date date = new Date();
                    invoiceDateTxtF.setText(dateFormat.format(date));
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException ex) {
                        Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex);
                    }
                }
            }
        }).start();

        clientIdTxtF.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseExited(java.awt.event.MouseEvent evt) {
                clientIdTxtFMouseExited(evt);
            }
        });
        clientIdTxtF.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                clientIdTxtFFocusLost(evt);
            }
        });
        jPanel1.add(clientIdTxtF, new org.netbeans.lib.awtextra.AbsoluteConstraints(173, 91, 244, -1));

        remarksTxtF.setColumns(20);
        remarksTxtF.setRows(5);
        jScrollPane4.setViewportView(remarksTxtF);

        jPanel1.add(jScrollPane4, new org.netbeans.lib.awtextra.AbsoluteConstraints(176, 200, 240, 60));

        invoiceNoTxtF.setEditable(false);
        invoiceNoTxtF.setEnabled(false);
        invoiceNoTxtF.setPrompt("IXXXX");
        invoiceNoTxtF.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseExited(java.awt.event.MouseEvent evt) {
                invoiceNoTxtFMouseExited(evt);
            }
        });
        invoiceNoTxtF.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                invoiceNoTxtFActionPerformed(evt);
            }
        });
        invoiceNoTxtF.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                invoiceNoTxtFKeyReleased(evt);
            }
        });
        jPanel1.add(invoiceNoTxtF, new org.netbeans.lib.awtextra.AbsoluteConstraints(173, 27, 244, -1));

        jLabel24.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel24.setText("Payment Type");
        jPanel1.add(jLabel24, new org.netbeans.lib.awtextra.AbsoluteConstraints(16, 170, 120, -1));

        clientIdTxtF1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseExited(java.awt.event.MouseEvent evt) {
                clientIdTxtF1MouseExited(evt);
            }
        });
        jPanel1.add(clientIdTxtF1, new org.netbeans.lib.awtextra.AbsoluteConstraints(173, 129, 244, -1));

        jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Cash", "Cheque" }));
        jPanel1.add(jComboBox1, new org.netbeans.lib.awtextra.AbsoluteConstraints(173, 167, 244, -1));

        jLabel25.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel25.setText("Order Id");
        jPanel1.add(jLabel25, new org.netbeans.lib.awtextra.AbsoluteConstraints(16, 135, 90, -1));

        jLabel77.setFont(new java.awt.Font("Lucida Grande", 1, 18)); // NOI18N
        jLabel77.setForeground(new java.awt.Color(255, 0, 51));
        jLabel77.setText("*");
        jPanel1.add(jLabel77, new org.netbeans.lib.awtextra.AbsoluteConstraints(420, 30, 20, -1));

        jLabel78.setFont(new java.awt.Font("Lucida Grande", 1, 18)); // NOI18N
        jLabel78.setForeground(new java.awt.Color(255, 0, 51));
        jLabel78.setText("*");
        jPanel1.add(jLabel78, new org.netbeans.lib.awtextra.AbsoluteConstraints(420, 90, 20, -1));

        jLabel81.setFont(new java.awt.Font("Lucida Grande", 1, 18)); // NOI18N
        jLabel81.setForeground(new java.awt.Color(255, 0, 51));
        jLabel81.setText("*");
        jPanel1.add(jLabel81, new org.netbeans.lib.awtextra.AbsoluteConstraints(420, 130, 20, -1));

        jPanel5.add(jPanel1);
        jPanel1.setBounds(10, 11, 450, 270);

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Payment Info."));
        jPanel2.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        duePaymentTxtF.setEditable(false);
        duePaymentTxtF.setFont(new java.awt.Font("Lucida Grande", 0, 14)); // NOI18N
        duePaymentTxtF.setEnabled(false);
        duePaymentTxtF.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseExited(java.awt.event.MouseEvent evt) {
                duePaymentTxtFMouseExited(evt);
            }
        });
        jPanel2.add(duePaymentTxtF, new org.netbeans.lib.awtextra.AbsoluteConstraints(175, 162, 241, -1));

        jLabel19.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel19.setText("Total Payment");
        jPanel2.add(jLabel19, new org.netbeans.lib.awtextra.AbsoluteConstraints(12, 128, -1, -1));

        totAmountLbl1.setBackground(new java.awt.Color(0, 0, 0));
        totAmountLbl1.setFont(new java.awt.Font("Lucida Grande", 1, 24)); // NOI18N
        totAmountLbl1.setForeground(new java.awt.Color(0, 153, 0));
        totAmountLbl1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        totAmountLbl1.setText("00.00");
        totAmountLbl1.setOpaque(true);
        jPanel2.add(totAmountLbl1, new org.netbeans.lib.awtextra.AbsoluteConstraints(222, 40, 220, -1));

        jLabel20.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel20.setText("Discount");
        jPanel2.add(jLabel20, new org.netbeans.lib.awtextra.AbsoluteConstraints(12, 94, -1, -1));

        discountTxtF.setFont(new java.awt.Font("Lucida Grande", 0, 14)); // NOI18N
        discountTxtF.setText("0");
        discountTxtF.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseExited(java.awt.event.MouseEvent evt) {
                discountTxtFMouseExited(evt);
            }
        });
        discountTxtF.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                discountTxtFKeyReleased(evt);
            }
        });
        jPanel2.add(discountTxtF, new org.netbeans.lib.awtextra.AbsoluteConstraints(175, 82, 196, -1));

        jLabel21.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel21.setText("Due Payment");
        jPanel2.add(jLabel21, new org.netbeans.lib.awtextra.AbsoluteConstraints(12, 168, -1, -1));

        totalPaymentTxtF.setFont(new java.awt.Font("Lucida Grande", 0, 14)); // NOI18N
        totalPaymentTxtF.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseExited(java.awt.event.MouseEvent evt) {
                totalPaymentTxtFMouseExited(evt);
            }
        });
        totalPaymentTxtF.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                totalPaymentTxtFKeyReleased(evt);
            }
        });
        jPanel2.add(totalPaymentTxtF, new org.netbeans.lib.awtextra.AbsoluteConstraints(175, 128, 241, -1));

        createInvoiceBtn.setFont(new java.awt.Font("Lucida Grande", 1, 14)); // NOI18N
        createInvoiceBtn.setText("Create Invoice");
        createInvoiceBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                createInvoiceBtnActionPerformed(evt);
            }
        });
        jPanel2.add(createInvoiceBtn, new org.netbeans.lib.awtextra.AbsoluteConstraints(12, 196, 430, 47));

        jLabel22.setFont(new java.awt.Font("Lucida Grande", 1, 16)); // NOI18N
        jLabel22.setText("%");
        jPanel2.add(jLabel22, new org.netbeans.lib.awtextra.AbsoluteConstraints(389, 85, -1, -1));

        grandTotalLbl1.setBackground(new java.awt.Color(0, 0, 0));
        grandTotalLbl1.setFont(new java.awt.Font("Lucida Grande", 1, 24)); // NOI18N
        grandTotalLbl1.setForeground(new java.awt.Color(0, 153, 0));
        grandTotalLbl1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        grandTotalLbl1.setText("00.00");
        grandTotalLbl1.setOpaque(true);
        jPanel2.add(grandTotalLbl1, new org.netbeans.lib.awtextra.AbsoluteConstraints(12, 40, 198, -1));

        jLabel64.setFont(new java.awt.Font("Lucida Grande", 3, 13)); // NOI18N
        jLabel64.setText("Grand Total");
        jPanel2.add(jLabel64, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 20, 103, -1));

        jLabel65.setFont(new java.awt.Font("Lucida Grande", 3, 13)); // NOI18N
        jLabel65.setText("Total Amount");
        jPanel2.add(jLabel65, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 20, 103, -1));

        jLabel79.setFont(new java.awt.Font("Lucida Grande", 1, 18)); // NOI18N
        jLabel79.setForeground(new java.awt.Color(255, 0, 51));
        jLabel79.setText("*");
        jPanel2.add(jLabel79, new org.netbeans.lib.awtextra.AbsoluteConstraints(410, 80, 30, -1));

        jLabel82.setFont(new java.awt.Font("Lucida Grande", 1, 18)); // NOI18N
        jLabel82.setForeground(new java.awt.Color(255, 0, 51));
        jLabel82.setText("*");
        jPanel2.add(jLabel82, new org.netbeans.lib.awtextra.AbsoluteConstraints(420, 170, 20, -1));

        jLabel83.setFont(new java.awt.Font("Lucida Grande", 1, 18)); // NOI18N
        jLabel83.setForeground(new java.awt.Color(255, 0, 51));
        jLabel83.setText("*");
        jPanel2.add(jLabel83, new org.netbeans.lib.awtextra.AbsoluteConstraints(420, 130, 20, -1));

        jPanel5.add(jPanel2);
        jPanel2.setBounds(10, 300, 450, 250);

        jTabbedPane2.addTab("Sales Management", jPanel5);

        jPanel6.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jTabbedPane3.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTabbedPane3MouseClicked(evt);
            }
        });
        jTabbedPane3.addComponentListener(new java.awt.event.ComponentAdapter() {
            public void componentShown(java.awt.event.ComponentEvent evt) {
                jTabbedPane3ComponentShown(evt);
            }
        });

        jPanel9.setLayout(null);

        jLabel23.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel23.setText("Client Name");
        jPanel9.add(jLabel23);
        jLabel23.setBounds(18, 6, 78, 18);

        exportExcelBtn1.setFont(new java.awt.Font("Lucida Grande", 1, 14)); // NOI18N
        exportExcelBtn1.setText("Report");
        exportExcelBtn1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                exportExcelBtn1ActionPerformed(evt);
            }
        });
        jPanel9.add(exportExcelBtn1);
        exportExcelBtn1.setBounds(700, 430, 370, 49);

        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 },
                        { null, null, null, null, null, null, null, null },
                        { null, null, null, null, null, null, null, null },
                        { null, null, null, null, null, null, null, null },
                        { null, null, null, null, null, null, null, null },
                        { null, null, null, null, null, null, null, null },
                        { null, null, null, null, null, null, null, null },
                        { null, null, null, null, null, null, null, null },
                        { null, null, null, null, null, null, null, null },
                        { null, null, null, null, null, null, null, null },
                        { null, null, null, null, null, null, null, null },
                        { null, null, null, null, null, null, null, null },
                        { null, null, null, null, null, null, null, null },
                        { null, null, null, null, null, null, null, null },
                        { null, null, null, null, null, null, null, null },
                        { null, null, null, null, null, null, null, null },
                        { null, null, null, null, null, null, null, null },
                        { null, null, null, null, null, null, null, null },
                        { null, null, null, null, null, null, null, null },
                        { null, null, null, null, null, null, null, null },
                        { null, null, null, null, null, null, null, null },
                        { null, null, null, null, null, null, null, null },
                        { null, null, null, null, null, null, null, null },
                        { null, null, null, null, null, null, null, null } },
                new String[] { "Invoice#", "Order#", "Invoice Date", "Client ID", "Client Name", "Grand Total",
                        "Total Payment", "Due Payment" }) {
            Class[] types = new Class[] { java.lang.String.class, java.lang.String.class, java.lang.String.class,
                    java.lang.String.class, java.lang.String.class, java.lang.Double.class, java.lang.Double.class,
                    java.lang.Double.class };

            public Class getColumnClass(int columnIndex) {
                return types[columnIndex];
            }
        });
        jScrollPane5.setViewportView(jTable2);

        jPanel9.add(jScrollPane5);
        jScrollPane5.setBounds(28, 80, 660, 434);

        clientNSearchTextF.setPrompt("Client Name/ClientID");
        clientNSearchTextF.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                clientNSearchTextFActionPerformed(evt);
            }
        });
        clientNSearchTextF.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                clientNSearchTextFKeyReleased(evt);
            }
        });
        jPanel9.add(clientNSearchTextF);
        clientNSearchTextF.setBounds(24, 28, 268, 20);

        jPanel23.setBorder(javax.swing.BorderFactory.createTitledBorder("Total Sales"));

        amountTxtF1.setEditable(false);
        amountTxtF1.setFont(new java.awt.Font("Lucida Grande", 0, 14)); // NOI18N
        amountTxtF1.setEnabled(false);

        totPayTxtF1.setEditable(false);
        totPayTxtF1.setFont(new java.awt.Font("Lucida Grande", 0, 14)); // NOI18N
        totPayTxtF1.setEnabled(false);

        duePayTxtF1.setEditable(false);
        duePayTxtF1.setFont(new java.awt.Font("Lucida Grande", 0, 14)); // NOI18N
        duePayTxtF1.setEnabled(false);

        jLabel30.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel30.setText("Due Payment");

        jLabel28.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel28.setText("Total Payment");

        jLabel29.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel29.setText("Grand Total");

        javax.swing.GroupLayout jPanel23Layout = new javax.swing.GroupLayout(jPanel23);
        jPanel23.setLayout(jPanel23Layout);
        jPanel23Layout.setHorizontalGroup(jPanel23Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 355, Short.MAX_VALUE)
                .addGroup(jPanel23Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel23Layout.createSequentialGroup().addContainerGap().addGroup(jPanel23Layout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addGroup(jPanel23Layout.createSequentialGroup().addComponent(jLabel30)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(duePayTxtF1, javax.swing.GroupLayout.PREFERRED_SIZE, 212,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel23Layout.createSequentialGroup()
                                        .addGroup(jPanel23Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(jLabel28).addComponent(jLabel29))
                                        .addGap(34, 34, 34)
                                        .addGroup(jPanel23Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                                .addComponent(totPayTxtF1, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        212, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(amountTxtF1, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        212, javax.swing.GroupLayout.PREFERRED_SIZE))))
                                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))));
        jPanel23Layout.setVerticalGroup(jPanel23Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 146, Short.MAX_VALUE)
                .addGroup(jPanel23Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel23Layout.createSequentialGroup().addContainerGap()
                                .addGroup(jPanel23Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jLabel29).addComponent(amountTxtF1,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(26, 26, 26)
                                .addGroup(jPanel23Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addGroup(jPanel23Layout.createSequentialGroup().addComponent(jLabel28)
                                                .addGap(28, 28, 28)
                                                .addGroup(jPanel23Layout
                                                        .createParallelGroup(
                                                                javax.swing.GroupLayout.Alignment.BASELINE)
                                                        .addComponent(jLabel30).addComponent(duePayTxtF1,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE)))
                                        .addComponent(totPayTxtF1, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))));

        jPanel9.add(jPanel23);
        jPanel23.setBounds(700, 210, 370, 170);

        jTabbedPane3.addTab("Sales by Clients", jPanel9);

        exportExcelBtn2.setText("Report");
        exportExcelBtn2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                exportExcelBtn2ActionPerformed(evt);
            }
        });

        jTable4.setModel(new javax.swing.table.DefaultTableModel(
                new Object[][] { { null, null, null, null, null }, { null, null, null, null, null },
                        { null, null, null, null, null }, { null, null, null, null, null } },
                new String[] { "Item Code", "Item Name", "Item Price", "Description", "Total Payment" }) {
            Class[] types = new Class[] { java.lang.String.class, java.lang.String.class, java.lang.Double.class,
                    java.lang.String.class, java.lang.Integer.class };

            public Class getColumnClass(int columnIndex) {
                return types[columnIndex];
            }
        });
        jScrollPane9.setViewportView(jTable4);

        jLabel47.setText("Item Code");

        invoiceSearchTextF.setPrompt("ItemCode/Name");
        invoiceSearchTextF.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                invoiceSearchTextFKeyReleased(evt);
            }
        });

        invoiceSearchTextF1.setPrompt("IXXXX");
        invoiceSearchTextF1.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                invoiceSearchTextF1KeyReleased(evt);
            }
        });

        jLabel69.setText("Invoice#");

        jPanel11.setPreferredSize(new java.awt.Dimension(490, 3));
        jPanel11.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                jPanel11FocusGained(evt);
            }
        });

        javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11);
        jPanel11.setLayout(jPanel11Layout);
        jPanel11Layout.setHorizontalGroup(jPanel11Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 490, Short.MAX_VALUE));
        jPanel11Layout.setVerticalGroup(jPanel11Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 376, Short.MAX_VALUE));

        javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
        jPanel10.setLayout(jPanel10Layout);
        jPanel10Layout.setHorizontalGroup(jPanel10Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel10Layout.createSequentialGroup().addGroup(jPanel10Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel10Layout.createSequentialGroup().addGap(18, 18, 18).addGroup(jPanel10Layout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel10Layout.createSequentialGroup().addComponent(jLabel47)
                                        .addGap(175, 175, 175).addComponent(jLabel69))
                                .addGroup(jPanel10Layout.createSequentialGroup()
                                        .addComponent(invoiceSearchTextF, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                202, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(37, 37, 37).addComponent(invoiceSearchTextF1,
                                                javax.swing.GroupLayout.PREFERRED_SIZE, 202,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel10Layout.createSequentialGroup()
                                        .addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(26, 26, 26).addComponent(jScrollPane9,
                                                javax.swing.GroupLayout.PREFERRED_SIZE, 506,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))))
                        .addGroup(jPanel10Layout.createSequentialGroup().addGap(390, 390, 390).addComponent(
                                exportExcelBtn2, javax.swing.GroupLayout.PREFERRED_SIZE, 248,
                                javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addContainerGap(244, Short.MAX_VALUE)));
        jPanel10Layout.setVerticalGroup(jPanel10Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel10Layout.createSequentialGroup().addGap(6, 6, 6)
                        .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabel47).addComponent(jLabel69))
                        .addGap(6, 6, 6)
                        .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(invoiceSearchTextF, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(invoiceSearchTextF1, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, 376,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jScrollPane9, javax.swing.GroupLayout.PREFERRED_SIZE, 376,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18).addComponent(exportExcelBtn2, javax.swing.GroupLayout.PREFERRED_SIZE,
                                49, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(139, Short.MAX_VALUE)));

        jTabbedPane3.addTab("Sales per Item", jPanel10);

        fromDateChooser4.setDateFormatString("yyyy-MM");

        ToDateChooser4.setDateFormatString("yyyy-MM");

        jTable6.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[] { "Month", "Grand Total", "Total Payment", "Tot. Payment Due" }) {
            Class[] types = new Class[] { java.lang.String.class, java.lang.Double.class, java.lang.Double.class,
                    java.lang.Double.class };

            public Class getColumnClass(int columnIndex) {
                return types[columnIndex];
            }
        });
        jScrollPane11.setViewportView(jTable6);

        jLabel54.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel54.setText("From");

        jLabel55.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel55.setText("To");

        jButton6.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jButton6.setText("Search");
        jButton6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton6ActionPerformed(evt);
            }
        });

        jPanel20.setBorder(javax.swing.BorderFactory.createTitledBorder("Total"));

        jLabel53.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel53.setText("Due Payment");

        duePayTxtF3.setEditable(false);
        duePayTxtF3.setFont(new java.awt.Font("Lucida Grande", 0, 14)); // NOI18N
        duePayTxtF3.setEnabled(false);
        duePayTxtF3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                duePayTxtF3ActionPerformed(evt);
            }
        });

        totPayTxtF3.setEditable(false);
        totPayTxtF3.setFont(new java.awt.Font("Lucida Grande", 0, 14)); // NOI18N
        totPayTxtF3.setEnabled(false);

        jLabel56.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel56.setText("Total Payment");

        jLabel51.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel51.setText("Grand Total");

        amountTxtF3.setEditable(false);
        amountTxtF3.setFont(new java.awt.Font("Lucida Grande", 0, 14)); // NOI18N
        amountTxtF3.setEnabled(false);

        javax.swing.GroupLayout jPanel20Layout = new javax.swing.GroupLayout(jPanel20);
        jPanel20.setLayout(jPanel20Layout);
        jPanel20Layout.setHorizontalGroup(jPanel20Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel20Layout.createSequentialGroup().addContainerGap()
                        .addGroup(jPanel20Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                        jPanel20Layout.createSequentialGroup().addComponent(jLabel53)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                .addComponent(duePayTxtF3, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        256, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel20Layout.createSequentialGroup().addComponent(jLabel56)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(totPayTxtF3, javax.swing.GroupLayout.PREFERRED_SIZE, 256,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel20Layout.createSequentialGroup().addComponent(jLabel51)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(amountTxtF3, javax.swing.GroupLayout.PREFERRED_SIZE, 256,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addContainerGap()));
        jPanel20Layout.setVerticalGroup(jPanel20Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel20Layout.createSequentialGroup()
                        .addGroup(jPanel20Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(amountTxtF3, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel51))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel20Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(totPayTxtF3, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel56))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel20Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(duePayTxtF3, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel53))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

        javax.swing.GroupLayout jPanel21Layout = new javax.swing.GroupLayout(jPanel21);
        jPanel21.setLayout(jPanel21Layout);
        jPanel21Layout.setHorizontalGroup(jPanel21Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 480, Short.MAX_VALUE));
        jPanel21Layout.setVerticalGroup(jPanel21Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 431, Short.MAX_VALUE));

        javax.swing.GroupLayout jPanel13Layout = new javax.swing.GroupLayout(jPanel13);
        jPanel13.setLayout(jPanel13Layout);
        jPanel13Layout.setHorizontalGroup(jPanel13Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel13Layout.createSequentialGroup().addGroup(jPanel13Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel13Layout.createSequentialGroup().addGap(6, 6, 6).addGroup(jPanel13Layout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel13Layout.createSequentialGroup().addComponent(jLabel54)
                                        .addGap(230, 230, 230).addComponent(jLabel55))
                                .addGroup(jPanel13Layout.createSequentialGroup().addGap(6, 6, 6)
                                        .addComponent(fromDateChooser4, javax.swing.GroupLayout.PREFERRED_SIZE, 216,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(46, 46, 46)
                                        .addComponent(ToDateChooser4, javax.swing.GroupLayout.PREFERRED_SIZE, 210,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18).addComponent(jButton6,
                                                javax.swing.GroupLayout.PREFERRED_SIZE, 124,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))))
                        .addGroup(jPanel13Layout.createSequentialGroup().addGap(11, 11, 11)
                                .addComponent(jPanel21, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(jPanel13Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addComponent(jScrollPane11, javax.swing.GroupLayout.DEFAULT_SIZE, 541,
                                                Short.MAX_VALUE)
                                        .addComponent(jPanel20, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                        .addContainerGap(240, Short.MAX_VALUE)));
        jPanel13Layout.setVerticalGroup(jPanel13Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel13Layout.createSequentialGroup().addGap(6, 6, 6)
                        .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabel54).addComponent(jLabel55))
                        .addGap(6, 6, 6)
                        .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(fromDateChooser4, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(ToDateChooser4, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jButton6))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(
                                jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addGroup(jPanel13Layout.createSequentialGroup()
                                                .addComponent(jScrollPane11, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        272, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(jPanel20, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                        .addComponent(jPanel21, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap(144, Short.MAX_VALUE)));

        jTabbedPane3.addTab("Sales per Month", jPanel13);

        jPanel14.setLayout(null);

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

        }, new String[] { "Year", "Grand Total", "Total Payment", "Tot. Payment Due" }) {
            Class[] types = new Class[] { java.lang.String.class, java.lang.Double.class, java.lang.Double.class,
                    java.lang.Double.class };

            public Class getColumnClass(int columnIndex) {
                return types[columnIndex];
            }
        });
        jScrollPane12.setViewportView(jTable7);

        jPanel14.add(jScrollPane12);
        jScrollPane12.setBounds(520, 90, 540, 270);

        jLabel60.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel60.setText("From");
        jPanel14.add(jLabel60);
        jLabel60.setBounds(10, 11, 33, 18);

        jLabel61.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel61.setText("To");
        jPanel14.add(jLabel61);
        jLabel61.setBounds(272, 11, 40, 18);

        toSearchTextF1.setPrompt("yyyy");
        toSearchTextF1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseExited(java.awt.event.MouseEvent evt) {
                toSearchTextF1MouseExited(evt);
            }
        });
        jPanel14.add(toSearchTextF1);
        toSearchTextF1.setBounds(272, 31, 202, 20);

        fromSearchTextF1.setPrompt("yyyy");
        fromSearchTextF1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseExited(java.awt.event.MouseEvent evt) {
                fromSearchTextF1MouseExited(evt);
            }
        });
        jPanel14.add(fromSearchTextF1);
        fromSearchTextF1.setBounds(10, 31, 202, 20);

        jButton5.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jButton5.setText("Search");
        jButton5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton5ActionPerformed(evt);
            }
        });
        jPanel14.add(jButton5);
        jButton5.setBounds(540, 30, 130, 27);

        jLabel84.setFont(new java.awt.Font("Lucida Grande", 1, 18)); // NOI18N
        jLabel84.setForeground(new java.awt.Color(255, 0, 51));
        jLabel84.setText("*");
        jPanel14.add(jLabel84);
        jLabel84.setBounds(480, 30, 30, 24);

        jLabel85.setFont(new java.awt.Font("Lucida Grande", 1, 18)); // NOI18N
        jLabel85.setForeground(new java.awt.Color(255, 0, 51));
        jLabel85.setText("*");
        jPanel14.add(jLabel85);
        jLabel85.setBounds(220, 30, 30, 24);

        javax.swing.GroupLayout jPanel18Layout = new javax.swing.GroupLayout(jPanel18);
        jPanel18.setLayout(jPanel18Layout);
        jPanel18Layout.setHorizontalGroup(jPanel18Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 480, Short.MAX_VALUE));
        jPanel18Layout.setVerticalGroup(jPanel18Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 420, Short.MAX_VALUE));

        jPanel14.add(jPanel18);
        jPanel18.setBounds(20, 90, 480, 420);

        jPanel19.setBorder(javax.swing.BorderFactory.createTitledBorder("Total"));

        jLabel57.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel57.setText("Grand Total");

        jLabel62.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel62.setText("Total Payment");

        jLabel59.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel59.setText("Due Payment");

        duePayTxtF4.setEditable(false);
        duePayTxtF4.setFont(new java.awt.Font("Lucida Grande", 0, 14)); // NOI18N
        duePayTxtF4.setEnabled(false);

        totPayTxtF4.setEditable(false);
        totPayTxtF4.setFont(new java.awt.Font("Lucida Grande", 0, 14)); // NOI18N
        totPayTxtF4.setEnabled(false);

        amountTxtF4.setEditable(false);
        amountTxtF4.setFont(new java.awt.Font("Lucida Grande", 0, 14)); // NOI18N
        amountTxtF4.setEnabled(false);

        javax.swing.GroupLayout jPanel19Layout = new javax.swing.GroupLayout(jPanel19);
        jPanel19.setLayout(jPanel19Layout);
        jPanel19Layout.setHorizontalGroup(jPanel19Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel19Layout.createSequentialGroup().addContainerGap().addGroup(jPanel19Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel19Layout.createSequentialGroup().addGap(2, 2, 2).addComponent(jLabel57,
                                javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addComponent(jLabel62).addComponent(jLabel59))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 181, Short.MAX_VALUE)
                        .addGroup(jPanel19Layout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(amountTxtF4, javax.swing.GroupLayout.DEFAULT_SIZE, 248,
                                        Short.MAX_VALUE)
                                .addComponent(totPayTxtF4).addComponent(duePayTxtF4))
                        .addContainerGap()));
        jPanel19Layout.setVerticalGroup(jPanel19Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel19Layout.createSequentialGroup()
                        .addGroup(jPanel19Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(amountTxtF4, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel57))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel19Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabel62).addComponent(totPayTxtF4,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(12, 12, 12)
                        .addGroup(jPanel19Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabel59).addComponent(duePayTxtF4,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

        jPanel14.add(jPanel19);
        jPanel19.setBounds(520, 370, 550, 140);

        jTabbedPane3.addTab("Sales per Year", jPanel14);

        jLabel46.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel46.setText("From");

        jTable5.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[] { "Date", "Grand Total", "Total Payment", "Tot. Payment Due" }) {
            Class[] types = new Class[] { java.lang.String.class, java.lang.Double.class, java.lang.Double.class,
                    java.lang.Double.class };

            public Class getColumnClass(int columnIndex) {
                return types[columnIndex];
            }
        });
        jScrollPane10.setViewportView(jTable5);

        jLabel48.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel48.setText("To");

        fromDateChooser3.setDateFormatString("yyyy-MM-d");

        ToDateChooser3.setDateFormatString("yyyy-MM-d");

        jButton7.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jButton7.setText("Search");
        jButton7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton7ActionPerformed(evt);
            }
        });

        jPanel24.setBorder(javax.swing.BorderFactory.createTitledBorder("Total"));

        jLabel52.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel52.setText("Due Payment");

        jLabel42.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel42.setText("Total Payment");

        jLabel50.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel50.setText("Grand Total");

        amountTxtF2.setEditable(false);
        amountTxtF2.setEnabled(false);

        totPayTxtF2.setEditable(false);
        totPayTxtF2.setEnabled(false);

        duePayTxtF2.setEditable(false);
        duePayTxtF2.setEnabled(false);
        duePayTxtF2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                duePayTxtF2ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel24Layout = new javax.swing.GroupLayout(jPanel24);
        jPanel24.setLayout(jPanel24Layout);
        jPanel24Layout
                .setHorizontalGroup(jPanel24Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel24Layout.createSequentialGroup().addContainerGap(333, Short.MAX_VALUE)
                                .addGroup(jPanel24Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addComponent(amountTxtF2, javax.swing.GroupLayout.Alignment.TRAILING,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, 203, Short.MAX_VALUE)
                                        .addComponent(totPayTxtF2, javax.swing.GroupLayout.Alignment.TRAILING)
                                        .addComponent(duePayTxtF2, javax.swing.GroupLayout.Alignment.TRAILING))
                                .addContainerGap())
                        .addGroup(jPanel24Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel24Layout.createSequentialGroup().addContainerGap()
                                        .addGroup(jPanel24Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(jLabel52).addComponent(jLabel42)
                                                .addComponent(jLabel50))
                                        .addContainerGap(439, Short.MAX_VALUE))));
        jPanel24Layout.setVerticalGroup(jPanel24Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel24Layout.createSequentialGroup()
                        .addComponent(amountTxtF2, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(totPayTxtF2, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(duePayTxtF2, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 54, Short.MAX_VALUE))
                .addGroup(jPanel24Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel24Layout.createSequentialGroup().addContainerGap().addComponent(jLabel50)
                                .addGap(33, 33, 33).addComponent(jLabel42).addGap(34, 34, 34).addComponent(jLabel52)
                                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))));

        javax.swing.GroupLayout jPanel25Layout = new javax.swing.GroupLayout(jPanel25);
        jPanel25.setLayout(jPanel25Layout);
        jPanel25Layout.setHorizontalGroup(jPanel25Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 480, Short.MAX_VALUE));
        jPanel25Layout.setVerticalGroup(jPanel25Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 431, Short.MAX_VALUE));

        javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12);
        jPanel12.setLayout(jPanel12Layout);
        jPanel12Layout.setHorizontalGroup(jPanel12Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel12Layout.createSequentialGroup().addContainerGap().addGroup(jPanel12Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel12Layout.createSequentialGroup().addGroup(jPanel12Layout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabel46)
                                .addGroup(jPanel12Layout.createSequentialGroup().addGap(6, 6, 6).addComponent(
                                        fromDateChooser3, javax.swing.GroupLayout.PREFERRED_SIZE, 216,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addGap(40, 40, 40)
                                .addGroup(jPanel12Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addGroup(jPanel12Layout.createSequentialGroup().addComponent(jLabel48)
                                                .addGap(0, 0, Short.MAX_VALUE))
                                        .addGroup(jPanel12Layout.createSequentialGroup().addGap(6, 6, 6)
                                                .addComponent(ToDateChooser3,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE, 210,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addGap(44, 44, 44)
                                                .addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 112,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        Short.MAX_VALUE))))
                        .addGroup(jPanel12Layout.createSequentialGroup().addGap(6, 6, 6)
                                .addComponent(jPanel25, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(23, 23, 23)
                                .addGroup(jPanel12Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jPanel24, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jScrollPane10, javax.swing.GroupLayout.PREFERRED_SIZE, 554,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(0, 215, Short.MAX_VALUE)))));
        jPanel12Layout.setVerticalGroup(jPanel12Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel12Layout.createSequentialGroup().addGroup(jPanel12Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel12Layout.createSequentialGroup().addContainerGap().addGroup(jPanel12Layout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel12Layout.createSequentialGroup().addComponent(jLabel46)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(fromDateChooser3, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel12Layout.createSequentialGroup().addComponent(jLabel48)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(ToDateChooser3, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))))
                        .addGroup(jPanel12Layout.createSequentialGroup().addGap(26, 26, 26).addComponent(jButton7)))
                        .addGroup(jPanel12Layout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                        jPanel12Layout.createSequentialGroup().addGap(11, 11, 11)
                                                .addComponent(jScrollPane10, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        0, Short.MAX_VALUE)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(jPanel24, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel12Layout.createSequentialGroup()
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(jPanel25, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addContainerGap(145, Short.MAX_VALUE)));

        jTabbedPane3.addTab("Sales per Day", jPanel12);

        jPanel6.add(jTabbedPane3, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, -1, 690));

        jTabbedPane2.addTab("Sales Performance", jPanel6);

        jButton4.setText("Demo");
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(layout.createSequentialGroup().addGap(10, 10, 10).addComponent(
                                        jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 1090,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addComponent(
                                        jTabbedPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 1123,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGroup(layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                        .addGroup(layout.createSequentialGroup().addGap(840, 840, 840)
                                                .addGroup(layout
                                                        .createParallelGroup(
                                                                javax.swing.GroupLayout.Alignment.LEADING)
                                                        .addComponent(jLabel3).addComponent(homeBtn))
                                                .addGroup(layout
                                                        .createParallelGroup(
                                                                javax.swing.GroupLayout.Alignment.LEADING)
                                                        .addGroup(layout.createSequentialGroup().addGap(30, 30, 30)
                                                                .addComponent(loggedUserNamelbl))
                                                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout
                                                                .createSequentialGroup()
                                                                .addPreferredGap(
                                                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                        Short.MAX_VALUE)
                                                                .addComponent(logoutBtn)
                                                                .addPreferredGap(
                                                                        javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                                .addComponent(jButton4))))
                                        .addGroup(layout.createSequentialGroup().addGap(10, 10, 10).addComponent(
                                                jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 1090,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))))
                        .addContainerGap()));
        layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup().addGap(2, 2, 2)
                        .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(34, 34, 34)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(layout.createSequentialGroup().addComponent(jLabel3).addGap(15, 15, 15)
                                        .addGroup(layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                                .addComponent(homeBtn).addComponent(logoutBtn)))
                                .addGroup(layout.createSequentialGroup().addComponent(loggedUserNamelbl)
                                        .addGap(15, 15, 15).addComponent(jButton4)))
                        .addGap(13, 13, 13)
                        .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 0,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTabbedPane2, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)));

        jTabbedPane2.getAccessibleContext().setAccessibleDescription("");

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

    private void invoiceDateTxtFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_invoiceDateTxtFActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_invoiceDateTxtFActionPerformed

    private void coEmailTxtFMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_coEmailTxtFMouseExited

    }//GEN-LAST:event_coEmailTxtFMouseExited

    private void coMobileTxtFMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_coMobileTxtFMouseExited

    }//GEN-LAST:event_coMobileTxtFMouseExited

    private void mobileTxtFMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mobileTxtFMouseExited

    }//GEN-LAST:event_mobileTxtFMouseExited

    private void telephoneTxtFMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_telephoneTxtFMouseExited

    }//GEN-LAST:event_telephoneTxtFMouseExited

    private void emailTxtFMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_emailTxtFMouseExited

    }//GEN-LAST:event_emailTxtFMouseExited

    private void emailTxtFInputMethodTextChanged(java.awt.event.InputMethodEvent evt) {//GEN-FIRST:event_emailTxtFInputMethodTextChanged

    }//GEN-LAST:event_emailTxtFInputMethodTextChanged

    private void emailTxtFKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_emailTxtFKeyReleased
        // TODO add your handling code here:
    }//GEN-LAST:event_emailTxtFKeyReleased

    private void registerBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_registerBtnActionPerformed

        //Getting
        if (Validate.isValidClientId(clientIdTxtF2.getText())) {
            if (Validate.isValidPhone(mobileTxtF.getText())) {
                if (Validate.isValidPhone(telephoneTxtF.getText())) {
                    if (Validate.isValidPhone(faxTxtF.getText())) {
                        if (Validate.isValidEmailAddress(emailTxtF.getText())) {
                            if (Validate.isValidCordinatorId(coIdF.getText())) {
                                if (Validate.isValidPhone(coMobileTxtF.getText())) {
                                    if (Validate.isValidEmailAddress(coEmailTxtF.getText())) {
                                        OOClient.setADDRESS(addrTxtF.getText());
                                        OOClient.setCEMAIL(coEmailTxtF.getText());
                                        OOClient.setCLIENTID(clientIdTxtF2.getText());
                                        OOClient.setCMOBILE(coMobileTxtF.getText());
                                        OOClient.setCNAME(coNameTxtF.getText());
                                        OOClient.setEMAIL(emailTxtF.getText());
                                        OOClient.setFAX(faxTxtF.getText());
                                        OOClient.setMOBILE(mobileTxtF.getText());
                                        OOClient.setNAME(nameTxtF.getText());
                                        OOClient.setTELEPHONE(telephoneTxtF.getText());
                                        OOClient.setCOID(coIdF.getText());

                                        try {
                                            //insert
                                            if (OOClient.insert()) {//row count (0,1,2..) or (0) for nothing
                                                jTable3.setModel(
                                                        DbUtils.resultSetToTableModel(refreshTableClient()));

                                                JOptionPane.showMessageDialog(null,
                                                        "Client Registraion Successfull");
                                                resetClientFields();
                                            } else {
                                                JOptionPane.showMessageDialog(null,
                                                        "Error: Hit reset and try again..");
                                            }
                                        } catch (ClassNotFoundException ex) {
                                            Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null,
                                                    ex);//Logiing errors
                                            System.err.println(ex.getMessage());
                                            JOptionPane.showMessageDialog(null, ex.getMessage(), "Unkown Error",
                                                    JOptionPane.ERROR_MESSAGE);//if needed show in clients interface
                                        } catch (Exception ex) {
                                            Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null,
                                                    ex);
                                        }
                                    } else {
                                        jLabel72.setVisible(true);
                                        JOptionPane.showMessageDialog(null, "Enter valid Cordinator email...");
                                    }
                                } else {
                                    jLabel73.setVisible(true);
                                    JOptionPane.showMessageDialog(null, "Enter valid Cordinator Mobile ...");
                                }
                            } else {
                                jLabel70.setVisible(true);
                                JOptionPane.showMessageDialog(null, "Enter Exsisting CordinatorId ...");
                            }
                        } else {
                            jLabel45.setVisible(true);
                            JOptionPane.showMessageDialog(null, "Enter valid email ...");
                        }
                    } else {
                        jLabel44.setVisible(true);
                        JOptionPane.showMessageDialog(null, "Enter valid fax ...");
                    }
                } else {
                    jLabel1.setVisible(true);
                    JOptionPane.showMessageDialog(null, "Enter valid telephone ...");
                }
            } else {
                jLabel43.setVisible(true);
                JOptionPane.showMessageDialog(null, "Enter valid mobile ...");
            }
        } else {
            jLabel18.setVisible(true);
            JOptionPane.showMessageDialog(null, "Enter ClientID in given form...");
        }

        jLabel45.setVisible(false);
        jLabel70.setVisible(false);
        jLabel73.setVisible(false);
        jLabel72.setVisible(false);
        jLabel18.setVisible(false);
        jLabel43.setVisible(false);
        jLabel1.setVisible(false);
        jLabel44.setVisible(false);

    }//GEN-LAST:event_registerBtnActionPerformed

    private void homeBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_homeBtnActionPerformed
        this.dispose();
        //        new MainWindow().setVisible(true);
    }//GEN-LAST:event_homeBtnActionPerformed

    private void duePaymentTxtFMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_duePaymentTxtFMouseExited

    }//GEN-LAST:event_duePaymentTxtFMouseExited

    private void totalPaymentTxtFMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_totalPaymentTxtFMouseExited

    }//GEN-LAST:event_totalPaymentTxtFMouseExited

    private void discountTxtFMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_discountTxtFMouseExited

    }//GEN-LAST:event_discountTxtFMouseExited

    private void saleQtyTxtFMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_saleQtyTxtFMouseExited

    }//GEN-LAST:event_saleQtyTxtFMouseExited

    private void searchTxtFMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_searchTxtFMouseExited

    }//GEN-LAST:event_searchTxtFMouseExited

    private void clientIdTxtFMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_clientIdTxtFMouseExited

    }//GEN-LAST:event_clientIdTxtFMouseExited

    private void saleQtyTxtFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saleQtyTxtFActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_saleQtyTxtFActionPerformed

    private void faxTxtFMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_faxTxtFMouseExited

    }//GEN-LAST:event_faxTxtFMouseExited

    private void removeBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeBtnActionPerformed

        if (Validate.isValidClientId(clientIdTxtF2.getText())) {
            try {
                String ClientID = clientIdTxtF2.getText();
                OOClient.setCLIENTID(ClientID);

                if (OOClient.delete()) {//row count (0,1,2..) or (0) for nothing
                    jTable3.setModel(DbUtils.resultSetToTableModel(refreshTableClient()));
                    JOptionPane.showMessageDialog(null, "ID " + ClientID + " deletion Successfull");
                    resetClientFields();
                } else {
                    JOptionPane.showMessageDialog(null, "Error: ClientID not found..");
                }

            } catch (ClassNotFoundException ex) {
                Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);//Logiing errors
                System.err.println(ex.getMessage());
                JOptionPane.showMessageDialog(null, ex.getMessage(), "Unkown Error", JOptionPane.ERROR_MESSAGE);//if needed show in clients interface        
            } catch (Exception ex) {
                Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
            }
        } else {
            jLabel18.setVisible(true);

            JOptionPane.showMessageDialog(null, "Enter ClientID in given form...");
        }

        jLabel18.setVisible(false);

    }//GEN-LAST:event_removeBtnActionPerformed

    private void resetBtn2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_resetBtn2ActionPerformed
        try {
            registerBtn.setEnabled(true);

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

    private void modifyRecBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_modifyRecBtnActionPerformed

        if (Validate.isValidClientId(clientIdTxtF2.getText())) {
            if (Validate.isValidPhone(mobileTxtF.getText())) {
                if (Validate.isValidPhone(telephoneTxtF.getText())) {
                    if (Validate.isValidPhone(faxTxtF.getText())) {
                        if (Validate.isValidEmailAddress(emailTxtF.getText())) {
                            if (Validate.isValidCordinatorId(coIdF.getText())) {
                                if (Validate.isValidPhone(coMobileTxtF.getText())) {
                                    if (Validate.isValidEmailAddress(coEmailTxtF.getText())) {
                                        try {
                                            //Getting
                                            OOClient.setADDRESS(addrTxtF.getText());
                                            OOClient.setCEMAIL(coEmailTxtF.getText());
                                            OOClient.setCLIENTID(clientIdTxtF2.getText());
                                            OOClient.setCMOBILE(coMobileTxtF.getText());
                                            OOClient.setCNAME(coNameTxtF.getText());
                                            OOClient.setEMAIL(emailTxtF.getText());
                                            OOClient.setFAX(faxTxtF.getText());
                                            OOClient.setMOBILE(mobileTxtF.getText());
                                            OOClient.setNAME(nameTxtF.getText());
                                            OOClient.setTELEPHONE(telephoneTxtF.getText());
                                            OOClient.setCOID(coIdF.getText());

                                            if (OOClient.update()) {//row count (0,1,2..) or (0) for nothing
                                                jTable3.setModel(
                                                        DbUtils.resultSetToTableModel(refreshTableClient()));
                                                JOptionPane.showMessageDialog(null, "Record Updation Successfull");
                                                resetClientFields();
                                            } else {
                                                JOptionPane.showMessageDialog(null, "Error: ClientID not found..");
                                            }
                                        } catch (ClassNotFoundException ex) {
                                            Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null,
                                                    ex);//Logiing errors
                                            System.err.println(ex.getMessage());
                                            JOptionPane.showMessageDialog(null, ex.getMessage(), "Unkown Error",
                                                    JOptionPane.ERROR_MESSAGE);//if needed show in clients interface
                                        } catch (Exception ex) {
                                            Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null,
                                                    ex);
                                        }

                                    } else {

                                        jLabel72.setVisible(true);

                                        JOptionPane.showMessageDialog(null, "Enter valid Cordinator email...");

                                    }
                                } else {
                                    jLabel73.setVisible(true);

                                    JOptionPane.showMessageDialog(null, "Enter valid Cordinator Mobile ...");
                                }
                            } else {
                                jLabel70.setVisible(true);

                                JOptionPane.showMessageDialog(null, "Enter Exsisting CordinatorId ...");
                            }
                        } else {
                            jLabel45.setVisible(true);

                            JOptionPane.showMessageDialog(null, "Enter valid email ...");
                        }
                    } else {
                        jLabel44.setVisible(true);

                        JOptionPane.showMessageDialog(null, "Enter valid fax ...");
                    }
                } else {
                    jLabel1.setVisible(true);

                    JOptionPane.showMessageDialog(null, "Enter valid telephone ...");
                }
            } else {
                jLabel43.setVisible(true);

                JOptionPane.showMessageDialog(null, "Enter valid mobile ...");
            }
        } else {
            jLabel18.setVisible(true);

            JOptionPane.showMessageDialog(null, "Enter ClientID in given form...");
        }

        jLabel45.setVisible(false);
        jLabel70.setVisible(false);
        jLabel73.setVisible(false);
        jLabel72.setVisible(false);
        jLabel18.setVisible(false);
        jLabel43.setVisible(false);
        jLabel1.setVisible(false);
        jLabel44.setVisible(false);
    }//GEN-LAST:event_modifyRecBtnActionPerformed

    private void tableSearchField1KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tableSearchField1KeyReleased
        String searchField = tableSearchField1.getText();

        if (searchField.startsWith("C")) {//client id side
            try {
                OOClient.setCLIENTID(searchField);
                jTable3.setModel(DbUtils.resultSetToTableModel(OOClient.searchTableClientId()));
            } catch (ClassNotFoundException ex) {
                Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);//Logiing errors
                System.err.println(ex.getMessage());
                JOptionPane.showMessageDialog(null, ex.getMessage(), "Unknown Error", JOptionPane.ERROR_MESSAGE);
            } catch (Exception ex) {
                Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
            }
        } else { //client Nmae
            try {
                OOClient.setNAME(searchField);
                jTable3.setModel(DbUtils.resultSetToTableModel(searchTableClientName()));
            } catch (ClassNotFoundException ex) {
                Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);//Logiing errors
                System.err.println(ex.getMessage());
                JOptionPane.showMessageDialog(null, ex.getMessage(), "Unknown Error", JOptionPane.ERROR_MESSAGE);
            } catch (Exception ex) {
                Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
            }
        }

        if (searchField.isEmpty()) {
            try {
                jTable3.setModel(DbUtils.resultSetToTableModel(refreshTableClient()));
            } catch (ClassNotFoundException ex) {
                Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
            } catch (Exception ex) {
                Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }//GEN-LAST:event_tableSearchField1KeyReleased

    private void clientIdTxtF2KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_clientIdTxtF2KeyReleased
        //enable 2 Buttons
        if (!clientIdTxtF2.getText().isEmpty()) {
            removeBtn.setEnabled(true);
            modifyRecBtn.setEnabled(true);
        } else {
            removeBtn.setEnabled(false);
            modifyRecBtn.setEnabled(false);
        }
    }//GEN-LAST:event_clientIdTxtF2KeyReleased

    private void clientIdTxtF2MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_clientIdTxtF2MouseExited

    }//GEN-LAST:event_clientIdTxtF2MouseExited

    private void agreementIdTxtFMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_agreementIdTxtFMouseExited
        // TODO add your handling code here:
    }//GEN-LAST:event_agreementIdTxtFMouseExited

    private void agreementIdTxtFKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_agreementIdTxtFKeyReleased
        if (!agreementIdTxtF.getText().isEmpty()) {
            jButton1.setEnabled(true);
        } else {
            jButton1.setEnabled(false);
        }

    }//GEN-LAST:event_agreementIdTxtFKeyReleased

    private void clientIdTxtF4MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_clientIdTxtF4MouseExited
        // TODO add your handling code here:
    }//GEN-LAST:event_clientIdTxtF4MouseExited

    private void clientIdTxtF4KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_clientIdTxtF4KeyReleased
        // TODO add your handling code here:
    }//GEN-LAST:event_clientIdTxtF4KeyReleased

    private void agreementIdTxtFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_agreementIdTxtFActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_agreementIdTxtFActionPerformed

    private void addAgreementBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addAgreementBtnActionPerformed
        ListModel lModel = jList1.getModel();
        String[] arr = new String[lModel.getSize()];

        if (Validate.isValidClientId(clientIdTxtF4.getText())) {
            if (Validate.isValidAgreementId(agreementIdTxtF1.getText())) {
                if (true) {
                    if (true) {

                        try {
                            OOAgreement.setAGREEMENTID(agreementIdTxtF1.getText());
                            OOAgreement.setCLIENTID(clientIdTxtF4.getText());
                            OOAgreement.setFROM(
                                    ((JTextField) fromDateChooser.getDateEditor().getUiComponent()).getText());//downcasting UI-> hierachy
                            OOAgreement
                                    .setTO(((JTextField) toDateChooser.getDateEditor().getUiComponent()).getText());
                            OOAgreement.setTYPE(agTypeComboBox.getSelectedItem().toString());

                            for (int i = 0; i < lModel.getSize(); i++) {
                                arr[i] = (String) lModel.getElementAt(i);
                            }

                            OOAgreement.setASESTS(arr);
                            //insert
                            if (OOAgreement.insert(lModel.getSize())) {//row count (0,1,2..) or (0) for nothing,,,,,,Getting model size and passing to insert model for futher op

                                JOptionPane.showMessageDialog(null, "Adding Agreement Successfull");
                                jTable1.setModel(DbUtils.resultSetToTableModel(dispalyTableExpiary()));

                                resetAgreementFields();
                            } else {
                                JOptionPane.showMessageDialog(null, "Error: Use existing ClientID..");
                            }
                        } catch (ClassNotFoundException ex) {
                            Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);//Logiing errors
                            System.err.println(ex.getMessage());
                            JOptionPane.showMessageDialog(null, ex.getMessage(), "Unkown Error",
                                    JOptionPane.ERROR_MESSAGE);//if needed show in clients interface
                        } catch (Exception ex) {
                            Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
                        }

                    } else {
                        jLabel67.setVisible(true);

                        JOptionPane.showMessageDialog(null, "Enter valid Renew Date ...");

                    }
                } else {
                    jLabel75.setVisible(true);

                    JOptionPane.showMessageDialog(null, "Enter valid current Date or Reset ...");

                }
            } else {
                jLabel71.setVisible(true);

                JOptionPane.showMessageDialog(null, "Enter AgreeementId in given form...");

            }
        } else {
            jLabel76.setVisible(true);

            JOptionPane.showMessageDialog(null, "Enter ClientID in given form...");

        }

        jLabel71.setVisible(false);
        jLabel74.setVisible(false);
        jLabel75.setVisible(false);
        jLabel67.setVisible(false);
        jLabel76.setVisible(false);

    }//GEN-LAST:event_addAgreementBtnActionPerformed

    private void resetBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_resetBtnActionPerformed
        try {
            addAgreementBtn.setEnabled(true);
            resetAgreementFields();
        } catch (Exception ex) {
            Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_resetBtnActionPerformed

    private void renewAgreementBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_renewAgreementBtnActionPerformed
        ListModel lModel = jList1.getModel();
        String[] arr = new String[lModel.getSize()];

        String AgreementID = agreementIdTxtF1.getText();
        String ClientID = clientIdTxtF4.getText();

        //Getting
        OOAgreement.setAGREEMENTID(AgreementID);
        OOAgreement.setCLIENTID(ClientID);
        OOAgreement.setFROM(((JTextField) fromDateChooser.getDateEditor().getUiComponent()).getText());//downcasting UI-> hierachy
        OOAgreement.setTO(((JTextField) toDateChooser.getDateEditor().getUiComponent()).getText());
        OOAgreement.setTYPE(agTypeComboBox.getSelectedItem().toString());
        for (int i = 0; i < lModel.getSize(); i++) {
            arr[i] = (String) lModel.getElementAt(i);
        }

        OOAgreement.setASESTS(arr);

        if (Validate.isValidClientId(clientIdTxtF4.getText())) {
            if (Validate.isValidAgreementId(agreementIdTxtF1.getText())) {
                try {
                    if (Validate.isValidCurrentDate(
                            ((JTextField) fromDateChooser.getDateEditor().getUiComponent()).getText())) {
                        if (Validate.isValidCurrentDate(
                                ((JTextField) toDateChooser.getDateEditor().getUiComponent()).getText())) {
                            try {
                                if (OOAgreement.update(lModel.getSize())) {//row count (0,1,2..) or (0) for nothing
                                    jTable1.setModel(DbUtils.resultSetToTableModel(dispalyTableExpiary()));
                                    JOptionPane.showMessageDialog(null, "Agreement " + AgreementID + " With Client "
                                            + ClientID + " Renewal Successfull");

                                    resetAgreementFields();

                                } else {
                                    JOptionPane.showMessageDialog(null, "Error: AgreementID not found..");
                                }
                            } catch (Exception ex) {
                                Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
                            }
                        } else {
                            jLabel67.setVisible(true);

                            JOptionPane.showMessageDialog(null, "Enter valid Renew Date ...");

                        }
                    } else {
                        jLabel75.setVisible(true);

                        JOptionPane.showMessageDialog(null, "Enter valid current Date or Reset ...");

                    }
                } catch (ParseException ex) {
                    Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
                }
            } else {
                jLabel71.setVisible(true);

                JOptionPane.showMessageDialog(null, "Enter AgreeementId in given form...");

            }
        } else {
            jLabel74.setVisible(true);

            JOptionPane.showMessageDialog(null, "Enter ClientID in given form...");

        }

        jLabel74.setVisible(false);
        jLabel75.setVisible(false);
        jLabel67.setVisible(false);
        jLabel76.setVisible(false);

    }//GEN-LAST:event_renewAgreementBtnActionPerformed

    private void cancelAgreementBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelAgreementBtnActionPerformed

        if (Validate.isValidAgreementId(agreementIdTxtF1.getText())) {

            String AgreementID = agreementIdTxtF1.getText();
            String ClientID = clientIdTxtF4.getText();
            OOAgreement.setAGREEMENTID(AgreementID);

            try {
                if (OOAgreement.delete()) {//row count (0,1,2..) or (0) for nothing
                    jTable1.setModel(DbUtils.resultSetToTableModel(dispalyTableExpiary()));
                    JOptionPane.showMessageDialog(null,
                            "Agreement " + AgreementID + " With Client " + ClientID + " Cancellation Successfull");
                    agreementIdTxtF1.setText("");//setting fiels empty after op
                    clientIdTxtF4.setText("");
                } else {
                    JOptionPane.showMessageDialog(null, "Error: AgreementID not found..");
                }
            } catch (Exception ex) {
                Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
            }

        } else {
            jLabel71.setVisible(true);

            JOptionPane.showMessageDialog(null, "Enter AgreeementId in given form...");

        }

        jLabel71.setVisible(false);

    }//GEN-LAST:event_cancelAgreementBtnActionPerformed

    private void searchTxtFKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_searchTxtFKeyReleased
        String searchField = searchTxtF.getText();

        if (searchField.startsWith("I")) {//client id side
            try {
                String arr[] = { searchField };
                OOInvoice.setITEMCODE(arr);
                selectItemsTable.setModel(DbUtils.resultSetToTableModel(OOInvoice.searchTableItemCode()));
            } catch (ClassNotFoundException ex) {
                Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);//Logiing errors
                System.err.println(ex.getMessage());
                JOptionPane.showMessageDialog(null, ex.getMessage(), "Unknown Error", JOptionPane.ERROR_MESSAGE);
            } catch (Exception ex) {
                Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
            }
        } else { //client Nmae
            try {
                OOInvoice.setITEMNAME(searchField);
                selectItemsTable.setModel(DbUtils.resultSetToTableModel(searchTableItemName()));
            } catch (ClassNotFoundException ex) {
                Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);//Logiing errors
                System.err.println(ex.getMessage());
                JOptionPane.showMessageDialog(null, ex.getMessage(), "Unknown Error", JOptionPane.ERROR_MESSAGE);
            } catch (Exception ex) {
                Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
            }
        }

        if (searchField.isEmpty()) {
            try {
                selectItemsTable.setModel(DbUtils.resultSetToTableModel(OOInvoice.refreshTableInvoice()));
            } catch (ClassNotFoundException ex) {
                Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
            } catch (Exception ex) {
                Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
            }
        }

    }//GEN-LAST:event_searchTxtFKeyReleased

    private void addToCartBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addToCartBtnActionPerformed
        String itemCode = null, itemName;
        double unitPrice, totalAmount;
        int saleQty = 0;

        try {
            itemCode = selectItemsTable.getValueAt(selectItemsTable.getSelectedRow(), 0).toString();
        } catch (ArrayIndexOutOfBoundsException e) {
            JOptionPane.showMessageDialog(null, "Error: Select a row..");
        }

        if (selectItemsTable.getSelectedRow() != -1) {

            itemCode = selectItemsTable.getValueAt(selectItemsTable.getSelectedRow(), 0).toString();
            itemName = selectItemsTable.getValueAt(selectItemsTable.getSelectedRow(), 1).toString();
            unitPrice = Double
                    .parseDouble(selectItemsTable.getValueAt(selectItemsTable.getSelectedRow(), 3).toString());

            try {
                saleQty = Integer.parseInt(saleQtyTxtF.getText());
            } catch (NumberFormatException e) {

            }

            if (Validate.isValidSaleAmount(saleQty)) {

                saleQtyTxtF.setText("");
                totalAmount = (unitPrice * saleQty);

                //adding row to client cart
                DefaultTableModel model = (DefaultTableModel) clientCartTable.getModel();
                model.addRow(new Object[] { itemCode, itemName, unitPrice, saleQty, totalAmount });

                totalAmount = Double.valueOf(totAmountLbl1.getText()) + totalAmount;

                totAmountLbl1.setText(Double.toString(totalAmount));
                grandTotalLbl1.setText(totAmountLbl1.getText());

                //visibleing Jbuttons
                if (clientCartTable.getRowCount() == 0) {
                    removeSelectedBtn.setEnabled(false);
                    ClearCartBtn.setEnabled(false);
                } else {
                    removeSelectedBtn.setEnabled(true);
                    ClearCartBtn.setEnabled(true);
                }

            } else {
                jLabel80.setVisible(true);
                JOptionPane.showMessageDialog(null, "Enter Valid Sale Qty...");
            }

        } else {
            JOptionPane.showMessageDialog(null, "Error: Select a row From Selected Items Table..");
        }
        jLabel80.setVisible(false);
    }//GEN-LAST:event_addToCartBtnActionPerformed

    private void invoiceNoTxtFMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_invoiceNoTxtFMouseExited
        // TODO add your handling code here:
    }//GEN-LAST:event_invoiceNoTxtFMouseExited

    private void invoiceNoTxtFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_invoiceNoTxtFActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_invoiceNoTxtFActionPerformed

    private void invoiceNoTxtFKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_invoiceNoTxtFKeyReleased
        // TODO add your handling code here:
    }//GEN-LAST:event_invoiceNoTxtFKeyReleased

    private void removeSelectedBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeSelectedBtnActionPerformed
        //checking selected row is avalible 0,1,23, 
        if (clientCartTable.getSelectedRow() != -1) {

            double totalAmount = Double
                    .parseDouble(clientCartTable.getValueAt(clientCartTable.getSelectedRow(), 4).toString());

            totalAmount = Double.valueOf(totAmountLbl1.getText()) - totalAmount;

            totAmountLbl1.setText(Double.toString(totalAmount));

            DefaultTableModel model = (DefaultTableModel) clientCartTable.getModel();
            model.removeRow(clientCartTable.getSelectedRow());

            //visibleing Jbuttons
            if (clientCartTable.getRowCount() == 0) {//0 cuz its after remonivug row else 1
                removeSelectedBtn.setEnabled(false);
                ClearCartBtn.setEnabled(false);
            } else {
                removeSelectedBtn.setEnabled(true);
                ClearCartBtn.setEnabled(true);
            }
        } else {
            JOptionPane.showMessageDialog(null, "Error: Select a row From Client Cart Table to Remove..");
        }

    }//GEN-LAST:event_removeSelectedBtnActionPerformed

    private void ClearCartBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ClearCartBtnActionPerformed
        DefaultTableModel model = (DefaultTableModel) clientCartTable.getModel();

        //removing all rows in the dynamic model
        model.setRowCount(0);
        totAmountLbl1.setText("00.00");

        //visibleing Jbuttons
        if (clientCartTable.getRowCount() == 0) {
            removeSelectedBtn.setEnabled(false);
            ClearCartBtn.setEnabled(false);
        } else {
            removeSelectedBtn.setEnabled(true);
            ClearCartBtn.setEnabled(true);
        }
    }//GEN-LAST:event_ClearCartBtnActionPerformed

    private void discountTxtFKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_discountTxtFKeyReleased
        double totalAmount = Double.parseDouble(totAmountLbl1.getText());
        double discount = Integer.parseInt(discountTxtF.getText()) / 100.0;
        String discountedPrice = Double.toString(totalAmount - (discount * totalAmount));
        grandTotalLbl1.setText(discountedPrice);
    }//GEN-LAST:event_discountTxtFKeyReleased

    private void totalPaymentTxtFKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_totalPaymentTxtFKeyReleased
        double grandTotal = Double.parseDouble(grandTotalLbl1.getText());
        double totalPayment = Double.parseDouble(totalPaymentTxtF.getText());
        String duePayment = Double.toString((grandTotal - totalPayment));
        duePaymentTxtF.setText(duePayment);
    }//GEN-LAST:event_totalPaymentTxtFKeyReleased

    private void createInvoiceBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_createInvoiceBtnActionPerformed
        DefaultTableModel model = (DefaultTableModel) clientCartTable.getModel();
        String[] itemCode = new String[model.getRowCount()];
        int[] saleQty = new int[model.getRowCount()];

        if (Validate.isValidInvoiceId(invoiceNoTxtF.getText())) {
            if (Validate.isValidClientId(clientIdTxtF.getText())) {
                if (Validate.isValidOrderId(clientIdTxtF1.getText())) {
                    if (Validate.isValidDiscount(discountTxtF.getText())) {
                        if (Validate.isValidPrice(totalPaymentTxtF.getText())) {
                            if (Validate.isValidPrice(duePaymentTxtF.getText())) {

                                OOInvoice.setINVOICENO(invoiceNoTxtF.getText());
                                OOInvoice.setINVOICEDATE(invoiceDateTxtF.getText());
                                OOInvoice.setCLIENTIDFK(clientIdTxtF.getText());
                                OOInvoice.setREMARKS(remarksTxtF.getText());
                                OOInvoice.setDUEPAYMENT(Double.parseDouble(duePaymentTxtF.getText()));
                                OOInvoice.setTOTALPAYMENT(Double.parseDouble(totalPaymentTxtF.getText()));
                                OOInvoice.setDISCOUNT(Double.parseDouble(discountTxtF.getText()));
                                OOInvoice.setGRANDTOTAL(Double.parseDouble(grandTotalLbl1.getText()));
                                OOInvoice.setTOTALAMOUNT(Double.parseDouble(totAmountLbl1.getText()));
                                OOInvoice.setORDERID(clientIdTxtF1.getText());
                                OOInvoice.setPAYMENTTYPE(jComboBox1.getSelectedItem().toString());

                                for (int i = 0; i < model.getRowCount(); i++) {
                                    itemCode[i] = clientCartTable.getModel().getValueAt(i, 0).toString();
                                }

                                for (int i = 0; i < model.getRowCount(); i++) {
                                    saleQty[i] = (int) clientCartTable.getModel().getValueAt(i, 3);
                                }

                                OOInvoice.setITEMCODE(itemCode);
                                OOInvoice.setSALEQTY(saleQty);

                                try {
                                    //insert
                                    if (OOInvoice.insertInvoice(model.getRowCount())) {//row count (0,1,2..) or (0) for nothing
                                        JOptionPane.showMessageDialog(null, "Invoice Creation Successfull");

                                        resetInvoiceFields();
                                    } else {
                                        JOptionPane.showMessageDialog(null, "Error: Use existing ClientID..");
                                    }
                                } catch (Exception ex) {
                                    System.out.println(ex.getMessage());
                                }

                            } else {
                                jLabel82.setVisible(true);
                                JOptionPane.showMessageDialog(null, "Enter valid Due Payment ...");
                            }
                        } else {
                            jLabel83.setVisible(true);
                            JOptionPane.showMessageDialog(null, "Enter valid Total Payment ...");
                        }
                    } else {
                        jLabel79.setVisible(true);
                        JOptionPane.showMessageDialog(null, "Enter valid discount ...");
                    }
                } else {
                    jLabel81.setVisible(true);
                    JOptionPane.showMessageDialog(null, "Enter valid OrderId ...");
                }
            } else {
                jLabel78.setVisible(true);
                JOptionPane.showMessageDialog(null, "Enter valid ClientID ...");
            }
        } else {
            jLabel77.setVisible(true);
            JOptionPane.showMessageDialog(null, "Enter valid InvoiceID ...");
        }

        jLabel79.setVisible(false);
        jLabel82.setVisible(false);
        jLabel77.setVisible(false);
        jLabel78.setVisible(false);
        jLabel81.setVisible(false);
        jLabel83.setVisible(false);

    }//GEN-LAST:event_createInvoiceBtnActionPerformed

    private void agreementIdTxtF1MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_agreementIdTxtF1MouseExited
        // TODO add your handling code here:
    }//GEN-LAST:event_agreementIdTxtF1MouseExited

    private void agreementIdTxtF1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_agreementIdTxtF1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_agreementIdTxtF1ActionPerformed

    private void agreementIdTxtF1KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_agreementIdTxtF1KeyReleased
        //enable 2 Buttons
        if (!agreementIdTxtF1.getText().isEmpty()) {
            renewAgreementBtn.setEnabled(true);
            cancelAgreementBtn.setEnabled(true);
        } else {
            renewAgreementBtn.setEnabled(false);
            cancelAgreementBtn.setEnabled(false);
        }
    }//GEN-LAST:event_agreementIdTxtF1KeyReleased

    private void clientIdTxtF2KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_clientIdTxtF2KeyTyped
        // TODO add your handling code here:
    }//GEN-LAST:event_clientIdTxtF2KeyTyped

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        String addItemF = agreementIdTxtF.getText();

        if (addItemF.startsWith("I")) {
            try {
                if (Validate.isValidItemCode(addItemF)) {
                    add(addItemF);
                    agreementIdTxtF.setText("");
                } else {
                    jLabel74.setVisible(true);
                    JOptionPane.showMessageDialog(null, "Error: ItemID does not exist...");
                }
            } catch (Exception ex) {
                Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
            }
        } else {
            JOptionPane.showMessageDialog(null, "Error: Wrong ItemCode...");
        }
        /*else{
        if(Validate.isValidItemName(addItemF)){
            add(addItemF);
            agreementIdTxtF.setText("");
        }else
            JOptionPane.showMessageDialog(null, "Error: ItemName does not exist...");
        }*/

        if (jList1.getModel().getSize() != 0) {
            jButton1.setEnabled(true);
        } else {
            jButton1.setEnabled(false);
        }

        jLabel74.setVisible(false);

    }//GEN-LAST:event_jButton2ActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed

        int index = jList1.getSelectedIndex();
        dlm.removeElementAt(index);
        agreementIdTxtF.setText("");
        if (!agreementIdTxtF.getText().isEmpty()) {
            renewAgreementBtn.setEnabled(true);
            cancelAgreementBtn.setEnabled(true);
        } else {
            renewAgreementBtn.setEnabled(false);
            cancelAgreementBtn.setEnabled(false);
        }

        if (jList1.getModel().getSize() != 0) {
            jButton1.setEnabled(true);
        } else {
            jButton1.setEnabled(false);
        }
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jTable1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable1MouseClicked

        int row = jTable1.getSelectedRow();
        addAgreementBtn.setEnabled(false);

        Date date = null;
        ResultSet rs = null;

        agreementIdTxtF1.setText(jTable1.getModel().getValueAt(row, 0).toString());
        clientIdTxtF4.setText(jTable1.getModel().getValueAt(row, 4).toString());
        agTypeComboBox.setSelectedItem(jTable1.getModel().getValueAt(row, 1).toString());

        try {
            date = new SimpleDateFormat("yyyy-MM-d").parse(jTable1.getModel().getValueAt(row, 2).toString());
            fromDateChooser.setDate(date);
            date = new SimpleDateFormat("yyyy-MM-d").parse(jTable1.getModel().getValueAt(row, 3).toString());
            toDateChooser.setDate(date);
        } catch (ParseException ex) {
            Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
        }

        //Adding Items ToJlist
        dlm.clear();
        Connection con;
        try {
            con = DBAccess.getConnection();
            Statement st = con.createStatement();
            rs = st.executeQuery(
                    "select distinct assest from Agreement_Assest,Agreement where Agreement_Assest.agreementIdFk = '"
                            + jTable1.getModel().getValueAt(row, 0).toString() + "'");
            while (rs.next()) {
                dlm.addElement(rs.getString("assest"));
            }
            jList1.setModel(dlm);
        } catch (SQLException ex) {
            Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
        } catch (Exception ex) {
            Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
        }

        if (!agreementIdTxtF1.getText().isEmpty()) {
            renewAgreementBtn.setEnabled(true);
            cancelAgreementBtn.setEnabled(true);
        } else {
            renewAgreementBtn.setEnabled(false);
            cancelAgreementBtn.setEnabled(false);
        }
    }//GEN-LAST:event_jTable1MouseClicked

    private void fromSearchTextF1MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_fromSearchTextF1MouseExited

    }//GEN-LAST:event_fromSearchTextF1MouseExited

    private void toSearchTextF1MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_toSearchTextF1MouseExited
        // TODO add your handling code here:
    }//GEN-LAST:event_toSearchTextF1MouseExited

    private void jList1ValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_jList1ValueChanged

    }//GEN-LAST:event_jList1ValueChanged

    private void coNameTxtFKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_coNameTxtFKeyReleased
        String coName = coNameTxtF.getText();

        try {
            Connection con = DBAccess.getConnection();
            Statement st = con.createStatement();
            ResultSet rs = st.executeQuery("SELECT * FROM employee WHERE ename ='" + coName + "'");

            while (rs.next()) {
                coIdF.setText(rs.getString("emp_id"));
                coMobileTxtF.setText(rs.getString("phone"));
                coEmailTxtF.setText(rs.getString("email"));
            }

        } catch (SQLException e) {
            System.err.println(e.getMessage());
        } catch (Exception ex) {
            Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_coNameTxtFKeyReleased

    private void coIdFKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_coIdFKeyReleased
        String coId = coIdF.getText();

        try {
            Connection con = DBAccess.getConnection();
            Statement st = con.createStatement();
            ResultSet rs = st.executeQuery("SELECT * FROM employee WHERE emp_Id ='" + coId + "'");

            while (rs.next()) {
                coNameTxtF.setText(rs.getString("ename"));
                coMobileTxtF.setText(rs.getString("phone"));
                coEmailTxtF.setText(rs.getString("email"));
            }

        } catch (SQLException e) {
            System.err.println(e.getMessage());
        } catch (Exception ex) {
            Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_coIdFKeyReleased

    private void jTable3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable3MouseClicked
        int row = jTable3.getSelectedRow();

        registerBtn.setEnabled(false);

        clientIdTxtF2.setText(jTable3.getModel().getValueAt(row, 0).toString());
        nameTxtF.setText(jTable3.getModel().getValueAt(row, 1).toString());
        addrTxtF.setText(jTable3.getModel().getValueAt(row, 2).toString());
        mobileTxtF.setText(jTable3.getModel().getValueAt(row, 3).toString());
        telephoneTxtF.setText(jTable3.getModel().getValueAt(row, 4).toString());
        faxTxtF.setText(jTable3.getModel().getValueAt(row, 5).toString());
        emailTxtF.setText(jTable3.getModel().getValueAt(row, 6).toString());
        coNameTxtF.setText(jTable3.getModel().getValueAt(row, 7).toString());
        coMobileTxtF.setText(jTable3.getModel().getValueAt(row, 8).toString());
        coEmailTxtF.setText(jTable3.getModel().getValueAt(row, 9).toString());

        //getting Coid for Client
        try {
            Connection con = DBAccess.getConnection();
            Statement st = con.createStatement();
            ResultSet rs = st.executeQuery("select coidFk FROM Client_Cordi where clientIdFk = '"
                    + jTable3.getModel().getValueAt(row, 0).toString() + "'");

            while (rs.next()) {
                coIdF.setText(rs.getString("coidFk"));
            }

        } catch (SQLException e) {
            System.err.println(e.getMessage());
        } catch (Exception ex) {
            Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
        }

        if (!clientIdTxtF2.getText().isEmpty()) {
            removeBtn.setEnabled(true);
            modifyRecBtn.setEnabled(true);
        } else {
            removeBtn.setEnabled(false);
            modifyRecBtn.setEnabled(false);
        }
    }//GEN-LAST:event_jTable3MouseClicked

    private void duePayTxtF3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_duePayTxtF3ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_duePayTxtF3ActionPerformed

    private void clientNSearchTextFKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_clientNSearchTextFKeyReleased
        String searchField = clientNSearchTextF.getText();
        int rowCount = 0;
        double totalPayment = 0, grandTotal = 0, duePayment = 0;

        if (searchField.startsWith("C")) {
            OOSalesPerformance.setCLIENTCODE(searchField);
            try {
                jTable2.setModel(DbUtils.resultSetToTableModel(
                        OOSalesPerformance.searchSalesByClientId(OOSalesPerformance.getCLIENTCODE())));
            } catch (Exception ex) {
                Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
            }

            rowCount = jTable2.getRowCount();
            for (int i = 0; i < rowCount; i++) {
                totalPayment = Double.parseDouble(jTable2.getModel().getValueAt(i, 6).toString()) + totalPayment;
                grandTotal = Double.parseDouble(jTable2.getModel().getValueAt(i, 5).toString()) + grandTotal;
                duePayment = Double.parseDouble(jTable2.getModel().getValueAt(i, 7).toString()) + duePayment;
            }

            amountTxtF1.setText(Double.toString(grandTotal));
            totPayTxtF1.setText(Double.toString(totalPayment));
            duePayTxtF1.setText(Double.toString(duePayment));
        } else {
            OOSalesPerformance.setCLIENTNAME(searchField);
            try {
                jTable2.setModel(DbUtils.resultSetToTableModel(
                        OOSalesPerformance.searchSalesByClientName(OOSalesPerformance.getCLIENTNAME())));
            } catch (Exception ex) {
                Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
            }

            rowCount = jTable2.getRowCount();
            for (int i = 0; i < rowCount; i++) {
                totalPayment = Double.parseDouble(jTable2.getModel().getValueAt(i, 6).toString()) + totalPayment;
                grandTotal = Double.parseDouble(jTable2.getModel().getValueAt(i, 5).toString()) + grandTotal;
                duePayment = Double.parseDouble(jTable2.getModel().getValueAt(i, 7).toString()) + duePayment;
            }

            amountTxtF1.setText(Double.toString(grandTotal));
            totPayTxtF1.setText(Double.toString(totalPayment));
            duePayTxtF1.setText(Double.toString(duePayment));
        }

    }//GEN-LAST:event_clientNSearchTextFKeyReleased

    private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
        int rowCount = 0;
        double totalPayment = 0, grandTotal = 0, duePayment = 0;

        if (Validate.isValidYear(fromSearchTextF1.getText())) {
            if (Validate.isValidYear(toSearchTextF1.getText())) {
                OOSalesPerformance.setFROM(fromSearchTextF1.getText());
                OOSalesPerformance.setTO(toSearchTextF1.getText());
                try {
                    jTable7.setModel(DbUtils.resultSetToTableModel(OOSalesPerformance
                            .searchSalesPerYear(OOSalesPerformance.getFROM(), OOSalesPerformance.getTO())));
                } catch (Exception ex) {
                    Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
                }

                rowCount = jTable7.getRowCount();
                for (int i = 0; i < rowCount; i++) {
                    totalPayment = Double.parseDouble(jTable7.getModel().getValueAt(i, 7).toString())
                            + totalPayment;
                    grandTotal = Double.parseDouble(jTable7.getModel().getValueAt(i, 6).toString()) + grandTotal;
                    duePayment = Double.parseDouble(jTable7.getModel().getValueAt(i, 8).toString()) + duePayment;
                }

                amountTxtF4.setText(Double.toString(grandTotal));
                totPayTxtF4.setText(Double.toString(totalPayment));
                duePayTxtF4.setText(Double.toString(duePayment));
            } else {
                jLabel84.setVisible(true);

                JOptionPane.showMessageDialog(null, "Enter valid To date...");
            }
        } else {
            jLabel85.setVisible(true);

            JOptionPane.showMessageDialog(null, "Enter valid From date...");
        }

        jLabel85.setVisible(false);
        jLabel84.setVisible(false);

    }//GEN-LAST:event_jButton5ActionPerformed

    private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
        int rowCount = 0;
        double totalPayment = 0, grandTotal = 0, duePayment = 0;

        OOSalesPerformance.setTO(((JTextField) ToDateChooser4.getDateEditor().getUiComponent()).getText());
        OOSalesPerformance.setFROM(((JTextField) fromDateChooser4.getDateEditor().getUiComponent()).getText());
        try {
            jTable6.setModel(DbUtils.resultSetToTableModel(OOSalesPerformance
                    .searchSalesPerMonth(OOSalesPerformance.getFROM(), OOSalesPerformance.getTO())));
        } catch (Exception ex) {
            Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
        }

        rowCount = jTable6.getRowCount();
        for (int i = 0; i < rowCount; i++) {
            totalPayment = Double.parseDouble(jTable6.getModel().getValueAt(i, 7).toString()) + totalPayment;
            grandTotal = Double.parseDouble(jTable6.getModel().getValueAt(i, 6).toString()) + grandTotal;
            duePayment = Double.parseDouble(jTable6.getModel().getValueAt(i, 8).toString()) + duePayment;
        }

        amountTxtF3.setText(Double.toString(grandTotal));
        totPayTxtF3.setText(Double.toString(totalPayment));
        duePayTxtF3.setText(Double.toString(duePayment));
    }//GEN-LAST:event_jButton6ActionPerformed

    private void jTextField1KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField1KeyReleased
        try {
            Connection con = DBAccess.getConnection();
            Statement st = con.createStatement();
            ResultSet rs = st
                    .executeQuery("select clientId FROM Client where name = '" + jTextField1.getText() + "'");

            while (rs.next()) {
                clientIdTxtF4.setText(rs.getString("clientId"));
            }

        } catch (SQLException e) {
            System.err.println(e.getMessage());
        } catch (Exception ex) {
            Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jTextField1KeyReleased

    private void invoiceSearchTextFKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_invoiceSearchTextFKeyReleased

        String searchField = invoiceSearchTextF.getText();

        if (searchField.startsWith("I")) {//client id side
            String arr[] = { searchField };
            OOSalesPerformance.setITEMCODE(arr[0]);
            try {
                jTable4.setModel(DbUtils.resultSetToTableModel(
                        OOSalesPerformance.searchTableItemCode(OOSalesPerformance.getITEMCODE())));
            } catch (Exception ex) {
                Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
            }

        } else {
            OOInvoice.setITEMNAME(searchField);

            try {
                jTable4.setModel(DbUtils.resultSetToTableModel(
                        OOSalesPerformance.searchTableItemName(OOSalesPerformance.getITEMNAME())));
            } catch (Exception ex) {
                Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
            }
        }

    }//GEN-LAST:event_invoiceSearchTextFKeyReleased

    private void jTextField1FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextField1FocusLost

    }//GEN-LAST:event_jTextField1FocusLost

    private void clientIdTxtF1MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_clientIdTxtF1MouseExited
        // TODO add your handling code here:
    }//GEN-LAST:event_clientIdTxtF1MouseExited

    private void logoutBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_logoutBtnActionPerformed
        // TODO add your handling code here
        /*this.dispose();
        Login l = new Login();
        l.setVisible(true);*/
        new Login().setVisible(true);
        this.dispose();
    }//GEN-LAST:event_logoutBtnActionPerformed

    private void tableSearchField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tableSearchField1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_tableSearchField1ActionPerformed

    private void clientIdTxtFFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_clientIdTxtFFocusLost
        try {
            Connection con = DBAccess.getConnection();
            Statement st = con.createStatement();
            ResultSet rs = st
                    .executeQuery("select clientId FROM Client where name = '" + clientIdTxtF.getText() + "'");

            while (rs.next()) {
                clientIdTxtF.setText(rs.getString("clientId"));
            }

        } catch (SQLException e) {
            System.err.println(e.getMessage());
        } catch (Exception ex) {
            Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_clientIdTxtFFocusLost

    private void clientNSearchTextFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clientNSearchTextFActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_clientNSearchTextFActionPerformed

    private void invoiceSearchTextF1KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_invoiceSearchTextF1KeyReleased
        String itemField = invoiceSearchTextF.getText();
        String[] invoiceNo = { invoiceSearchTextF1.getText() };

        if (itemField.isEmpty()) {
            JOptionPane.showMessageDialog(null, "Enter ItemId in order to serch by..", "Error",
                    JOptionPane.ERROR_MESSAGE);
        } else if (itemField.startsWith("I")) {
            OOSalesPerformance.setITEMCODE(itemField);
            OOSalesPerformance.setINVOICENO(invoiceNo);
            try {
                jTable4.setModel(DbUtils.resultSetToTableModel(OOSalesPerformance.searchSalesByInvoiceNoItemCode(
                        OOSalesPerformance.getINVOICENO(), OOSalesPerformance.getITEMCODE())));
            } catch (Exception ex) {
                Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
            }

        }
    }//GEN-LAST:event_invoiceSearchTextF1KeyReleased

    private void exportExcelBtn2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exportExcelBtn2ActionPerformed
        String searchField = invoiceSearchTextF.getText();
        HashMap param;
        ReportView viewer;

        if (searchField.startsWith("I")) {
            param = new HashMap();

            try {
                param.put("itemCode", invoiceSearchTextF.getText());
                viewer = new ReportView("src\\Sales\\salesByItemCode.jasper", param);//change the path accordingly
                viewer.setVisible(true);
            } catch (Exception e) {
                System.err.println(e.getMessage());
                JOptionPane.showMessageDialog(null, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
            }
        } else if (searchField.isEmpty()) {
            JOptionPane.showMessageDialog(null, "Error: Enter ItemCode/Name..");
        } else {
            /*param = new HashMap();
                
            try {
            param.put("ClientName", clientNSearchTextF.getText());
            viewer = new ReportView("/Users/harithaperera/Desktop/8ware_TotalManagementSystem/src/reportsHaritha/SalesByClientID.jasper", param);//change the path accordingly
            viewer.setVisible(true);
            } catch (Exception e) {
            System.err.println(e.getMessage());
            JOptionPane.showMessageDialog(null, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
            }*/
        }
    }//GEN-LAST:event_exportExcelBtn2ActionPerformed

    private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
        int rowCount = 0;
        double totalPayment = 0, grandTotal = 0, duePayment = 0;

        OOSalesPerformance.setTO(((JTextField) ToDateChooser3.getDateEditor().getUiComponent()).getText());
        OOSalesPerformance.setFROM(((JTextField) fromDateChooser3.getDateEditor().getUiComponent()).getText());
        try {
            jTable5.setModel(DbUtils.resultSetToTableModel(OOSalesPerformance
                    .searchSalesPerDay(OOSalesPerformance.getFROM(), OOSalesPerformance.getTO())));
        } catch (Exception ex) {
            Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
        }

        rowCount = jTable5.getRowCount();
        for (int i = 0; i < rowCount; i++) {
            totalPayment = Double.parseDouble(jTable5.getModel().getValueAt(i, 7).toString()) + totalPayment;
            grandTotal = Double.parseDouble(jTable5.getModel().getValueAt(i, 6).toString()) + grandTotal;
            duePayment = Double.parseDouble(jTable5.getModel().getValueAt(i, 8).toString()) + duePayment;
        }

        amountTxtF2.setText(Double.toString(grandTotal));
        totPayTxtF2.setText(Double.toString(totalPayment));
        duePayTxtF2.setText(Double.toString(duePayment));
    }//GEN-LAST:event_jButton7ActionPerformed

    private void clientIdTxtF5MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_clientIdTxtF5MouseExited
        // TODO add your handling code here:
    }//GEN-LAST:event_clientIdTxtF5MouseExited

    private void clientIdTxtF5KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_clientIdTxtF5KeyReleased
        // TODO add your handling code here:
    }//GEN-LAST:event_clientIdTxtF5KeyReleased

    private void clientIdTxtF5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clientIdTxtF5ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_clientIdTxtF5ActionPerformed

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed

        try {
            String str = clientIdTxtF5.getText();

            Map parametersMap = new HashMap();
            parametersMap.put("agreementType", str);

            String report1;
            report1 = "src\\Sales\\agreementType.jrxml";
            JasperReport JR = JasperCompileManager.compileReport(report1);
            JasperPrint JP = JasperFillManager.fillReport(JR, parametersMap, DBAccess.getConnection());

            JasperViewer.viewReport(JP);

            //        if (clientIdTxtF5.getText().isEmpty()) {
            //            System.out.println("000");
            //            JOptionPane.showMessageDialog(null, "Error: Enter Agreement type..");
            //        } else {
            //            System.out.println("111");
            //            Map param = new HashMap();
            //
            //            try {
            //           String report1= "src\\Sales\\agreementType.jrxml";
            ////            JasperReport JR = JasperCompileManager.compileReport(report1);
            ////            JasperPrint JP = JasperFillManager.fillReport(JR, null, db.getConnection());
            ////            
            ////            JasperViewer.viewReport(JP);
            ////
            //
            //
            //                
            //                //*/System.out.println("222");
            //                param.put("agreementType", clientIdTxtF5.getText());
            //                System.out.println("333");
            //                ReportView viewer = new ReportView(report1, param);//change the path accordingly
            //               
            //                viewer.setVisible(true);
            //               
            //            } catch (Exception e) {
            //                System.err.println(e.getMessage());
            //                JOptionPane.showMessageDialog(null, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
            //            }
            //        }
        } catch (JRException ex) {
            Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
        } catch (Exception ex) {
            Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jButton3ActionPerformed

    private void jTabbedPane2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTabbedPane2MouseClicked
        jPanel11.removeAll();
        jPanel11.setVisible(true);

        jPanel25.removeAll();
        jPanel25.setVisible(true);

        jPanel21.removeAll();
        jPanel21.setVisible(true);

        jPanel18.removeAll();
        jPanel18.setVisible(true);
        try {
            initCustom();
        } catch (Exception ex) {
            Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
        }

    }//GEN-LAST:event_jTabbedPane2MouseClicked

    private void jTabbedPane3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTabbedPane3MouseClicked
        jPanel11.removeAll();
        jPanel11.setVisible(true);

        jPanel25.removeAll();
        jPanel25.setVisible(true);

        jPanel21.removeAll();
        jPanel21.setVisible(true);

        jPanel18.removeAll();
        jPanel18.setVisible(true);
        try {
            initCustom();
        } catch (Exception ex) {
            Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jTabbedPane3MouseClicked

    private void jTabbedPane3ComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_jTabbedPane3ComponentShown
        // TODO add your handling code here:

    }//GEN-LAST:event_jTabbedPane3ComponentShown

    private void jPanel11FocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jPanel11FocusGained

    }//GEN-LAST:event_jPanel11FocusGained

    private void formMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseClicked
        // TODO add your handling code here:

    }//GEN-LAST:event_formMouseClicked

    private void exportExcelBtn1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exportExcelBtn1ActionPerformed
        String searchField = clientNSearchTextF.getText();

        //        if (searchField.startsWith("C")) {
        //        
        //            try {
        //                Map parametersMap = new HashMap();
        //                parametersMap.put("ClientID",searchField);
        //                
        //                String report1;
        //                report1= "src\\Sales\\SalesByClientName.jasper";
        //                JasperReport JR = JasperCompileManager.compileReport(report1);
        //                JasperPrint JP = JasperFillManager.fillReport(JR, parametersMap, DBAccess.getConnection());
        //                
        //                JasperViewer.viewReport(JP);
        //            } catch (JRException ex) {
        //                Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
        //            } catch (Exception ex) {
        //                Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
        //            }
        //            
        //        }
        //        
        //        else if (searchField.isEmpty()) {
        //            JOptionPane.showMessageDialog(null, "Error: Enter ClientName/Id..");
        //        } 
        //        
        //        else {
        //            
        //            try {
        //                Map parametersMap = new HashMap();
        //                parametersMap.put("ClientName",searchField);
        //                
        //                String report2;
        //                report2= "src\\Sales\\SalesByClientID.jasper";
        //                JasperReport JR = JasperCompileManager.compileReport(report2);
        //                JasperPrint JP = JasperFillManager.fillReport(JR, parametersMap, DBAccess.getConnection());
        //                
        //                JasperViewer.viewReport(JP);
        //            } catch (JRException ex) {
        //                Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
        //            } catch (Exception ex) {
        //                Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
        //            }
        //        }
        HashMap param;
        ReportView viewer;

        if (searchField.startsWith("C")) {
            param = new HashMap();

            try {
                param.put("ClientID", clientNSearchTextF.getText());
                viewer = new ReportView("src\\Sales\\SalesByClientName.jasper", param);//change the path accordingly
                viewer.setVisible(true);
            } catch (Exception e) {
                System.err.println(e.getMessage());
                JOptionPane.showMessageDialog(null, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
            }
        } else if (searchField.isEmpty()) {
            JOptionPane.showMessageDialog(null, "Error: Enter ClientName/Id..");
        } else {
            param = new HashMap();

            try {
                param.put("ClientName", clientNSearchTextF.getText());
                viewer = new ReportView("src\\Sales\\SalesByClientID.jasper", param);//change the path accordingly
                viewer.setVisible(true);
            } catch (Exception e) {
                System.err.println(e.getMessage());
                JOptionPane.showMessageDialog(null, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
            }
        }
    }//GEN-LAST:event_exportExcelBtn1ActionPerformed

    private void duePayTxtF2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_duePayTxtF2ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_duePayTxtF2ActionPerformed

    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
        if (jPanel8.isShowing()) {
            nameTxtF.setText("Haritha");
            addrTxtF.setText("402/23, Colombo.");
            mobileTxtF.setText("0713209423");
            telephoneTxtF.setText("0112891574");
            faxTxtF.setText("0112745892");
            emailTxtF.setText("hari@gmail.com");
        }
    }//GEN-LAST:event_jButton4ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(TabbedPaneWin.class.getName()).log(java.util.logging.Level.SEVERE,
                    null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(TabbedPaneWin.class.getName()).log(java.util.logging.Level.SEVERE,
                    null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(TabbedPaneWin.class.getName()).log(java.util.logging.Level.SEVERE,
                    null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(TabbedPaneWin.class.getName()).log(java.util.logging.Level.SEVERE,
                    null, ex);
        }
        //</editor-fold>
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                try {
                    new TabbedPaneWin().setVisible(true);
                } catch (Exception ex) {
                    Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton ClearCartBtn;
    private com.toedter.calendar.JDateChooser ToDateChooser3;
    private com.toedter.calendar.JDateChooser ToDateChooser4;
    private javax.swing.JButton addAgreementBtn;
    private javax.swing.JButton addToCartBtn;
    private javax.swing.JTextArea addrTxtF;
    private javax.swing.JComboBox<String> agTypeComboBox;
    private org.jdesktop.swingx.JXTextField agreementIdTxtF;
    private org.jdesktop.swingx.JXTextField agreementIdTxtF1;
    private javax.swing.JTextField amountTxtF1;
    private javax.swing.JTextField amountTxtF2;
    private javax.swing.JTextField amountTxtF3;
    private javax.swing.JTextField amountTxtF4;
    private javax.swing.JButton cancelAgreementBtn;
    private javax.swing.JTable clientCartTable;
    private javax.swing.JTextField clientIdTxtF;
    private javax.swing.JTextField clientIdTxtF1;
    private org.jdesktop.swingx.JXTextField clientIdTxtF2;
    private org.jdesktop.swingx.JXTextField clientIdTxtF4;
    private org.jdesktop.swingx.JXTextField clientIdTxtF5;
    private org.jdesktop.swingx.JXTextField clientNSearchTextF;
    private javax.swing.JTextField coEmailTxtF;
    private javax.swing.JTextField coIdF;
    private javax.swing.JTextField coMobileTxtF;
    private javax.swing.JTextField coNameTxtF;
    private javax.swing.JButton createInvoiceBtn;
    private javax.swing.JTextField discountTxtF;
    private javax.swing.JTextField duePayTxtF1;
    private javax.swing.JTextField duePayTxtF2;
    private javax.swing.JTextField duePayTxtF3;
    private javax.swing.JTextField duePayTxtF4;
    private javax.swing.JTextField duePaymentTxtF;
    private javax.swing.JTextField emailTxtF;
    private javax.swing.JButton exportExcelBtn1;
    private javax.swing.JButton exportExcelBtn2;
    private javax.swing.JTextField faxTxtF;
    private com.toedter.calendar.JDateChooser fromDateChooser;
    private com.toedter.calendar.JDateChooser fromDateChooser3;
    private com.toedter.calendar.JDateChooser fromDateChooser4;
    private org.jdesktop.swingx.JXTextField fromSearchTextF1;
    private javax.swing.JLabel grandTotalLbl1;
    private javax.swing.JButton homeBtn;
    private javax.swing.JTextField invoiceDateTxtF;
    private org.jdesktop.swingx.JXTextField invoiceNoTxtF;
    private org.jdesktop.swingx.JXTextField invoiceSearchTextF;
    private org.jdesktop.swingx.JXTextField invoiceSearchTextF1;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
    private javax.swing.JButton jButton6;
    private javax.swing.JButton jButton7;
    private javax.swing.JComboBox<String> jComboBox1;
    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 jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel30;
    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 jLabel39;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel40;
    private javax.swing.JLabel jLabel42;
    private javax.swing.JLabel jLabel43;
    private javax.swing.JLabel jLabel44;
    private javax.swing.JLabel jLabel45;
    private javax.swing.JLabel jLabel46;
    private javax.swing.JLabel jLabel47;
    private javax.swing.JLabel jLabel48;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel50;
    private javax.swing.JLabel jLabel51;
    private javax.swing.JLabel jLabel52;
    private javax.swing.JLabel jLabel53;
    private javax.swing.JLabel jLabel54;
    private javax.swing.JLabel jLabel55;
    private javax.swing.JLabel jLabel56;
    private javax.swing.JLabel jLabel57;
    private javax.swing.JLabel jLabel59;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel60;
    private javax.swing.JLabel jLabel61;
    private javax.swing.JLabel jLabel62;
    private javax.swing.JLabel jLabel63;
    private javax.swing.JLabel jLabel64;
    private javax.swing.JLabel jLabel65;
    private javax.swing.JLabel jLabel66;
    private javax.swing.JLabel jLabel67;
    private javax.swing.JLabel jLabel69;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel70;
    private javax.swing.JLabel jLabel71;
    private javax.swing.JLabel jLabel72;
    private javax.swing.JLabel jLabel73;
    private javax.swing.JLabel jLabel74;
    private javax.swing.JLabel jLabel75;
    private javax.swing.JLabel jLabel76;
    private javax.swing.JLabel jLabel77;
    private javax.swing.JLabel jLabel78;
    private javax.swing.JLabel jLabel79;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel80;
    private javax.swing.JLabel jLabel81;
    private javax.swing.JLabel jLabel82;
    private javax.swing.JLabel jLabel83;
    private javax.swing.JLabel jLabel84;
    private javax.swing.JLabel jLabel85;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JList<String> jList1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel12;
    private javax.swing.JPanel jPanel13;
    private javax.swing.JPanel jPanel14;
    private javax.swing.JPanel jPanel15;
    private javax.swing.JPanel jPanel16;
    private javax.swing.JPanel jPanel17;
    private javax.swing.JPanel jPanel18;
    private javax.swing.JPanel jPanel19;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel20;
    private javax.swing.JPanel jPanel21;
    private javax.swing.JPanel jPanel22;
    private javax.swing.JPanel jPanel23;
    private javax.swing.JPanel jPanel24;
    private javax.swing.JPanel jPanel25;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    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 jScrollPane10;
    private javax.swing.JScrollPane jScrollPane11;
    private javax.swing.JScrollPane jScrollPane12;
    private javax.swing.JScrollPane jScrollPane13;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane7;
    private javax.swing.JScrollPane jScrollPane8;
    private javax.swing.JScrollPane jScrollPane9;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    public static javax.swing.JTabbedPane jTabbedPane2;
    private javax.swing.JTabbedPane jTabbedPane3;
    private javax.swing.JTable jTable1;
    private javax.swing.JTable jTable2;
    private javax.swing.JTable jTable3;
    private javax.swing.JTable jTable4;
    private javax.swing.JTable jTable5;
    private javax.swing.JTable jTable6;
    private javax.swing.JTable jTable7;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JLabel loggedUserNamelbl;
    private javax.swing.JButton logoutBtn;
    private javax.swing.JTextField mobileTxtF;
    private javax.swing.JButton modifyRecBtn;
    private javax.swing.JTextField nameTxtF;
    private javax.swing.JButton registerBtn;
    private javax.swing.JTextArea remarksTxtF;
    private javax.swing.JButton removeBtn;
    private javax.swing.JButton removeSelectedBtn;
    private javax.swing.JButton renewAgreementBtn;
    private javax.swing.JButton resetBtn;
    private javax.swing.JButton resetBtn2;
    private javax.swing.JTextField saleQtyTxtF;
    private org.jdesktop.swingx.JXTextField searchTxtF;
    private javax.swing.JTable selectItemsTable;
    private org.jdesktop.swingx.JXTextField tableSearchField1;
    private javax.swing.JTextField telephoneTxtF;
    private com.toedter.calendar.JDateChooser toDateChooser;
    private org.jdesktop.swingx.JXTextField toSearchTextF1;
    private javax.swing.JLabel totAmountLbl1;
    private javax.swing.JTextField totPayTxtF1;
    private javax.swing.JTextField totPayTxtF2;
    private javax.swing.JTextField totPayTxtF3;
    private javax.swing.JTextField totPayTxtF4;
    private javax.swing.JTextField totalPaymentTxtF;
    // End of variables declaration//GEN-END:variables

    private void add(String text) {
        jList1.setModel(dlm);
        dlm.addElement(text);
    }

    private void resetAgreementFields() throws Exception {
        nextAgreementId();
        agreementIdTxtF1.setText(getNextAgreementIdStr());

        agreementIdTxtF.setText("");
        clientIdTxtF4.setText("");
        agTypeComboBox.setSelectedIndex(0);
        fromDateChooser.setDate(new Date());
        ((JTextField) toDateChooser.getDateEditor().getUiComponent()).setText("");
        dlm.clear();
        jTextField1.setText("");
    }

    private void resetClientFields() throws Exception {
        addrTxtF.setText("");//set text emty 
        coEmailTxtF.setText("");

        nextClientId();
        clientIdTxtF2.setText(getNextClientIdStr());

        coMobileTxtF.setText("");
        coNameTxtF.setText("");
        emailTxtF.setText("");
        faxTxtF.setText("");
        mobileTxtF.setText("");
        nameTxtF.setText("");
        telephoneTxtF.setText("");
        coIdF.setText("");
    }

    private void resetInvoiceFields() throws Exception {
        nextInvoiceId();
        incrementations.nextOrderId();
        clientIdTxtF1.setText(incrementations.getNextOrderIdStr());
        invoiceNoTxtF.setText(getNextInvoiceIdStr());

        invoiceDateTxtF.setText(new Date().toString());
        clientIdTxtF.setText("");
        remarksTxtF.setText("");
        //needTechCheckBox.setSelected(false);
        duePaymentTxtF.setText("");
        totalPaymentTxtF.setText("");
        discountTxtF.setText("");
        grandTotalLbl1.setText("00.00");
        totAmountLbl1.setText("00.00");
    }

    private void initCustom() throws Exception {
        ///Client
        //setting next CleientID
        nextClientId();
        clientIdTxtF2.setText(getNextClientIdStr());
        //refreshing Table
        try {
            jTable3.setModel(DbUtils.resultSetToTableModel(refreshTableClient()));
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
        }
        ////

        ///Agreemnrt
        nextAgreementId();
        agreementIdTxtF1.setText(getNextAgreementIdStr());

        try {
            jTable1.setModel(DbUtils.resultSetToTableModel(OOAgreement.dispalyTableExpiary()));
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);//Logiing errors
            System.err.println(ex.getMessage());
            JOptionPane.showMessageDialog(null, ex.getMessage(), "Unknown Error", JOptionPane.ERROR_MESSAGE);
        }
        ///////

        ///Invoice
        nextInvoiceId();
        invoiceNoTxtF.setText(getNextInvoiceIdStr());

        incrementations.nextOrderId();
        clientIdTxtF1.setText(incrementations.getNextOrderIdStr());

        try {
            selectItemsTable.setModel(DbUtils.resultSetToTableModel(refreshTableInvoice()));
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);
        }
        ///

        jLabel45.setVisible(false);
        jLabel70.setVisible(false);
        jLabel73.setVisible(false);
        jLabel72.setVisible(false);
        jLabel18.setVisible(false);
        jLabel43.setVisible(false);
        jLabel1.setVisible(false);
        jLabel44.setVisible(false);
        jLabel71.setVisible(false);
        jLabel74.setVisible(false);
        jLabel75.setVisible(false);
        jLabel67.setVisible(false);
        jLabel74.setVisible(false);
        jLabel76.setVisible(false);

        jLabel80.setVisible(false);
        jLabel79.setVisible(false);
        jLabel82.setVisible(false);
        jLabel77.setVisible(false);
        jLabel78.setVisible(false);
        jLabel81.setVisible(false);
        jLabel83.setVisible(false);
        jLabel85.setVisible(false);
        jLabel84.setVisible(false);

        //Item PIe Chart
        DefaultPieDataset dataSet = new DefaultPieDataset();

        try {
            Connection con = DBAccess.getConnection();
            Statement st = con.createStatement();

            ResultSet rs = st.executeQuery(
                    "Select distinct citem.item_code,citem.`type`,Sum(Invoice_Detail.saleQty) as 'Sum QTy'\n"
                            + "from citem,Invoice_Detail\n" + "where Invoice_Detail.itemCode = citem.item_code \n"
                            + "group by citem.item_code,citem.`type`");

            while (rs.next()) {
                dataSet.setValue(rs.getString("type"), rs.getInt("Sum QTy"));
            }

        } catch (SQLException e) {
            System.err.println(e.getMessage());
        }

        JFreeChart chart = ChartFactory.createPieChart("Products Sold by Brand", dataSet, true, true, true);

        ChartPanel chartPanel = new ChartPanel(chart);
        chartPanel.setSize(490, 376);

        jPanel11.add(chartPanel);
        jPanel11.setVisible(true);

        //Year Bar chart
        DefaultCategoryDataset dataset2 = new DefaultCategoryDataset();

        try {
            Connection con = DBAccess.getConnection();
            Statement st = con.createStatement();

            ResultSet rs = st.executeQuery(
                    "select distinct DATE_FORMAT(Invoice.`date`,'%Y')as 'Year',SUM(invoice.grandTotal)\n"
                            + "from invoice\n" + "group by DATE_FORMAT(Invoice.`date`,'%Y')\n" + "");

            while (rs.next()) {
                if (rs.getString("Year") != null) {
                    dataset2.setValue(rs.getInt("SUM(invoice.grandTotal)"), rs.getString("Year"),
                            rs.getString("Year"));
                }
            }

        } catch (SQLException e) {
            System.err.println(e.getMessage());
        }

        JFreeChart chart2 = ChartFactory.createBarChart("Yearly Sales", "Year", "Total Sales(Rs)", dataset2,
                PlotOrientation.VERTICAL, true, true, true);

        ChartPanel chartPanel2 = new ChartPanel(chart2);
        chartPanel2.setSize(480, 420);

        jPanel18.add(chartPanel2);
        jPanel18.setVisible(true);

        //Month Bar Chart
        DefaultCategoryDataset dataset3 = new DefaultCategoryDataset();

        try {
            Connection con = DBAccess.getConnection();
            Statement st = con.createStatement();

            ResultSet rs = st.executeQuery(
                    "select distinct DATE_FORMAT(Invoice.`date`,'%Y-%m')as 'Month',SUM(invoice.grandTotal)\n"
                            + "from invoice\n" + "group by DATE_FORMAT(Invoice.`date`,'%Y-%m')");

            while (rs.next()) {

                String month = rs.getString("Month");
                if (month != null) {//if no data
                    if (String.valueOf(Calendar.getInstance().get(Calendar.YEAR)).equals(month.substring(0, 4))) { //for sum up to curet year only
                        if ("01".equals(month.substring(5, 7))) {
                            dataset3.setValue(rs.getInt("SUM(invoice.grandTotal)"), "Jan", "Jan");
                        } else if ("02".equals(month.substring(5, 7))) {
                            dataset3.setValue(rs.getInt("SUM(invoice.grandTotal)"), "Feb", "Feb");
                        } else if ("03".equals(month.substring(5, 7))) {
                            dataset3.setValue(rs.getInt("SUM(invoice.grandTotal)"), "Mar", "Mar");
                        } else if ("04".equals(month.substring(5, 7))) {
                            dataset3.setValue(rs.getInt("SUM(invoice.grandTotal)"), "Apr", "Apr");
                        } else if ("05".equals(month.substring(5, 7))) {
                            dataset3.setValue(rs.getInt("SUM(invoice.grandTotal)"), "May", "May");
                        } else if ("06".equals(month.substring(5, 7))) {
                            dataset3.setValue(rs.getInt("SUM(invoice.grandTotal)"), "Jun", "Jun");
                        } else if ("07".equals(month.substring(5, 7))) {
                            dataset3.setValue(rs.getInt("SUM(invoice.grandTotal)"), "Jul", "Jul");
                        } else if ("08".equals(month.substring(5, 7))) {
                            dataset3.setValue(rs.getInt("SUM(invoice.grandTotal)"), "Aug", "Aug");
                        } else if ("09".equals(month.substring(5, 7))) {
                            dataset3.setValue(rs.getInt("SUM(invoice.grandTotal)"), "Sep", "Sep");
                        } else if ("10".equals(month.substring(5, 7))) {
                            dataset3.setValue(rs.getInt("SUM(invoice.grandTotal)"), "Oct", "Oct");
                        } else if ("11".equals(month.substring(5, 7))) {
                            dataset3.setValue(rs.getInt("SUM(invoice.grandTotal)"), "Nov", "Nov");
                        } else if ("12".equals(month.substring(5, 7))) {
                            dataset3.setValue(rs.getInt("SUM(invoice.grandTotal)"), "Dec", "Dec");
                        }
                    }
                }
            }

        } catch (SQLException e) {
            System.err.println(e.getMessage());
        }

        JFreeChart chart3 = ChartFactory.createBarChart(
                "Monthly Sales of " + String.valueOf(Calendar.getInstance().get(Calendar.YEAR)), "Month",
                "Total Sales(Rs)", dataset3, PlotOrientation.VERTICAL, true, true, true);

        ChartPanel chartPanel3 = new ChartPanel(chart3);
        chartPanel3.setSize(480, 431);

        jPanel21.add(chartPanel3);
        jPanel21.setVisible(true);

        //Daily Bar Chart
        DefaultCategoryDataset dataset4 = new DefaultCategoryDataset();
        int weekNo = 1;

        try {
            Connection con = DBAccess.getConnection();
            Statement st = con.createStatement();
            SimpleDateFormat newDateFormat = new SimpleDateFormat("yyyy-MM-dd");
            Date date = null;

            ResultSet rs = st.executeQuery(
                    "select distinct DATE_FORMAT(Invoice.`date`,'%Y-%m-%d')as 'Day',SUM(invoice.grandTotal)\n"
                            + "from invoice\n" + "group by DATE_FORMAT(Invoice.`date`,'%Y-%m-%d')");

            while (rs.next()) {
                String day = rs.getString("Day");

                if (day != null) {
                    if (String.valueOf(Calendar.getInstance().get(Calendar.YEAR)).equals(day.substring(0, 4))) { //for sum up to curet year only

                        date = newDateFormat.parse(day);
                        day = date.toString().substring(0, 3);

                        if (day.equals("Mon")) {
                            dataset4.setValue(rs.getInt("SUM(invoice.grandTotal)"), "Mon", "Mon");
                        } else if (day.equals("Tue")) {
                            dataset4.setValue(rs.getInt("SUM(invoice.grandTotal)"), "Tue", "Tue");
                        } else if (day.equals("Wed")) {
                            dataset4.setValue(rs.getInt("SUM(invoice.grandTotal)"), "Wed", "Wed");
                        } else if (day.equals("Thu")) {
                            dataset4.setValue(rs.getInt("SUM(invoice.grandTotal)"), "Thu", "Thu");
                        } else if (day.equals("Fri")) {
                            dataset4.setValue(rs.getInt("SUM(invoice.grandTotal)"), "Fri", "Fri");
                        } else if (day.equals("Sat")) {
                            dataset4.setValue(rs.getInt("SUM(invoice.grandTotal)"), "Sat", "Sat");
                        } else if (day.equals("Sun")) {
                            dataset4.setValue(rs.getInt("SUM(invoice.grandTotal)"), "Sun", "Sun");
                        }
                    }
                }
            }

        } catch (SQLException e) {
            System.err.println(e.getMessage());
        }

        Calendar cal = Calendar.getInstance();
        JFreeChart chart4 = ChartFactory.createBarChart(
                "Daily Sales of " + new SimpleDateFormat("MMM").format(cal.getTime()) + " Week " + weekNo, "Day",
                "Total Sales(Rs)", dataset4, PlotOrientation.VERTICAL, true, true, true);

        ChartPanel chartPanel4 = new ChartPanel(chart4);
        chartPanel4.setSize(480, 431);

        jPanel25.add(chartPanel4);
        jPanel25.setVisible(true);
    }
}