com.afrisoftech.hospinventory.LpoLsoAdministrationIntFr.java Source code

Java tutorial

Introduction

Here is the source code for com.afrisoftech.hospinventory.LpoLsoAdministrationIntFr.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 com.afrisoftech.hospinventory;

import org.apache.commons.net.ftp.parser.EnterpriseUnixFTPEntryParser;

/**
 *
 * @author sytem partners
 */
public class LpoLsoAdministrationIntFr extends javax.swing.JInternalFrame {

    /**
     * Creates new form LpoLsoAdministrationIntFr
     */
    java.sql.Connection connectDB = null;
    org.netbeans.lib.sql.pool.PooledConnectionSource pConnDB = null;

    public LpoLsoAdministrationIntFr(java.sql.Connection connDb,
            org.netbeans.lib.sql.pool.PooledConnectionSource pconnDB) {

        connectDB = connDb;

        pConnDB = pconnDB;

        initComponents();
    }

    /**
     * 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() {
        java.awt.GridBagConstraints gridBagConstraints;

        jPanel1 = new javax.swing.JPanel();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel2 = new javax.swing.JPanel();
        jPanel4 = new javax.swing.JPanel();
        jPanel7 = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        ApprovalTbl = new com.afrisoftech.dbadmin.JTable();
        orderTxt = new javax.swing.JTextField();
        jPanel5 = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        jLabel111 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        reqDateTxt = new javax.swing.JTextField();
        reqDeptTxt = new javax.swing.JTextField();
        TransactionTypeTxt = new javax.swing.JTextField();
        datePicker2 = new com.afrisoftech.lib.DatePicker();
        jLabel112 = new javax.swing.JLabel();
        reqDateTxt1 = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        UserTxt = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        jTextField2 = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        jTextField3 = new javax.swing.JTextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        PurchaseItemsTbl = new com.afrisoftech.dbadmin.JTable();
        jPanel8 = new javax.swing.JPanel();
        Save = new javax.swing.JButton();
        cancelbtn = new javax.swing.JButton();
        exitbtn = new javax.swing.JButton();
        jPanel9 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        TotalPriceTxt = new javax.swing.JTextField();
        jPanel3 = new javax.swing.JPanel();
        jPanel6 = new javax.swing.JPanel();
        jPanel10 = new javax.swing.JPanel();
        jPanel11 = new javax.swing.JPanel();
        jScrollPane4 = new javax.swing.JScrollPane();
        ApprovalTbl1 = new com.afrisoftech.dbadmin.JTable();
        orderTxt1 = new javax.swing.JTextField();
        jPanel12 = new javax.swing.JPanel();
        jLabel12 = new javax.swing.JLabel();
        jLabel115 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jLabel24 = new javax.swing.JLabel();
        reqDateTxt4 = new javax.swing.JTextField();
        reqDeptTxt2 = new javax.swing.JTextField();
        TransactionTypeTxt2 = new javax.swing.JTextField();
        datePicker4 = new com.afrisoftech.lib.DatePicker();
        jLabel116 = new javax.swing.JLabel();
        reqDateTxt5 = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        UserTxt2 = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        jTextField4 = new javax.swing.JTextField();
        jLabel16 = new javax.swing.JLabel();
        Contract_noTxt = new javax.swing.JTextField();
        jScrollPane2 = new javax.swing.JScrollPane();
        PurchaseItemsTbl1 = new com.afrisoftech.dbadmin.JTable();
        jPanel13 = new javax.swing.JPanel();
        Save1 = new javax.swing.JButton();
        cancelbtn1 = new javax.swing.JButton();
        exitbtn1 = new javax.swing.JButton();
        jPanel14 = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        TotalPriceTxt1 = new javax.swing.JTextField();

        setClosable(true);
        setIconifiable(true);
        setMaximizable(true);
        setResizable(true);
        setPreferredSize(new java.awt.Dimension(1000, 500));
        getContentPane().setLayout(new java.awt.GridBagLayout());

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

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

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

        jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "LPOs/LSOs",
                javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
                javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 1, 11),
                new java.awt.Color(0, 0, 204))); // NOI18N
        jPanel7.setMinimumSize(new java.awt.Dimension(100, 250));
        jPanel7.setPreferredSize(new java.awt.Dimension(100, 250));
        jPanel7.setLayout(new java.awt.GridBagLayout());

        jScrollPane3.setMinimumSize(new java.awt.Dimension(250, 100));
        jScrollPane3.setPreferredSize(new java.awt.Dimension(250, 100));

        ApprovalTbl.setModel(com.afrisoftech.dbadmin.TableModel.createTableVectors(connectDB,
                "select distinct supplier,order_no from st_orders where order_no is not null and ordered=false and dispatch=false and miu_approval=true and approval_rejected is null"));
        ApprovalTbl.setMinimumSize(new java.awt.Dimension(90, 34));
        ApprovalTbl.setPreferredSize(new java.awt.Dimension(90, 750));
        ApprovalTbl.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                ApprovalTblMouseClicked(evt);
            }
        });
        jScrollPane3.setViewportView(ApprovalTbl);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.gridheight = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        jPanel7.add(jScrollPane3, gridBagConstraints);

        orderTxt.setText("Search LPO...");
        orderTxt.addCaretListener(new javax.swing.event.CaretListener() {
            public void caretUpdate(javax.swing.event.CaretEvent evt) {
                orderTxtCaretUpdate(evt);
            }
        });
        orderTxt.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                orderTxtMouseClicked(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        jPanel7.add(orderTxt, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.gridheight = 4;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 3.0;
        gridBagConstraints.weighty = 1.0;
        jPanel4.add(jPanel7, gridBagConstraints);

        /*        javax.swing.SpinnerDateModel spinerDate = new javax.swing.SpinnerDateModel();
        dateSpinner = new javax.swing.JSpinner(spinerDate);
            
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 30);
        jPanel1.add(dateSpinner, gridBagConstraints);
            
        */
        jPanel5.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jPanel5.setLayout(new java.awt.GridBagLayout());

        jLabel4.setText("Ordered By");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 0);
        jPanel5.add(jLabel4, gridBagConstraints);

        jLabel111.setText("Date Sent");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 0);
        jPanel5.add(jLabel111, gridBagConstraints);

        jLabel5.setText("Due Date");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.weightx = 1.0;
        jPanel5.add(jLabel5, gridBagConstraints);

        jLabel22.setText("Requisitioning Department");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 0);
        jPanel5.add(jLabel22, gridBagConstraints);

        reqDateTxt.setEditable(false);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 20);
        jPanel5.add(reqDateTxt, gridBagConstraints);

        reqDeptTxt.setEditable(false);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        jPanel5.add(reqDeptTxt, gridBagConstraints);

        TransactionTypeTxt.setEditable(false);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        jPanel5.add(TransactionTypeTxt, gridBagConstraints);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 80);
        jPanel5.add(datePicker2, gridBagConstraints);

        jLabel112.setText("LPO/LSO");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 0);
        jPanel5.add(jLabel112, gridBagConstraints);

        reqDateTxt1.setEditable(false);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        jPanel5.add(reqDateTxt1, gridBagConstraints);

        jLabel6.setText("Doc Type");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.weightx = 1.0;
        jPanel5.add(jLabel6, gridBagConstraints);

        UserTxt.setEditable(false);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 20);
        jPanel5.add(UserTxt, gridBagConstraints);

        jLabel10.setText("Supplier");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 0);
        jPanel5.add(jLabel10, gridBagConstraints);

        jTextField2.setEditable(false);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        jPanel5.add(jTextField2, gridBagConstraints);

        jLabel11.setText("Tender/Quotation");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 3;
        jPanel5.add(jLabel11, gridBagConstraints);

        jTextField3.setEditable(false);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 20);
        jPanel5.add(jTextField3, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 9.0;
        gridBagConstraints.weighty = 2.0;
        jPanel4.add(jPanel5, gridBagConstraints);

        jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
        jScrollPane1.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

        PurchaseItemsTbl.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, 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, 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[] { "Item Code", "Item Description", "Units", "Quantity", "Unit Price", "Value",
                        "Discount", "VAT", "Remarks" }) {
            Class[] types = new Class[] { java.lang.Object.class, java.lang.Object.class, java.lang.Object.class,
                    java.lang.Double.class, java.lang.Double.class, java.lang.Double.class, java.lang.Object.class,
                    java.lang.Object.class, java.lang.Object.class };
            boolean[] canEdit = new boolean[] { false, false, false, false, false, false, false, false, false };

            public Class getColumnClass(int columnIndex) {
                return types[columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit[columnIndex];
            }
        });
        /*java.lang.Object[] strCmb = {"Normal","Urgent",""};
            
        javax.swing.JComboBox cmBox = new javax.swing.JComboBox(strCmb);
            
        javax.swing.table.TableColumn teditor = this.jTable1.getColumn("Status");
            
        teditor.setCellEditor(new javax.swing.DefaultCellEditor(cmBox));
        */

        /*javax.swing.table.TableColumn column = null;
        for (int i = 0; i < 4; i++) {
        column = PurchaseItemsTbl.getColumnModel().getColumn(i);
        if (i == 0) {
            
            column.setPreferredWidth(300); //sport column is bigger
        } else {
            if (i == 1) {
                column.setPreferredWidth(200);
            } else {
                //if (i == 2) {
                    column.setPreferredWidth(200);
                    // }  else
                //column.setPreferredWidth(50);
            
            }
        }
        }
        */
        PurchaseItemsTbl.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                PurchaseItemsTblMouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(PurchaseItemsTbl);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 9.0;
        gridBagConstraints.weighty = 9.0;
        gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 2);
        jPanel4.add(jScrollPane1, gridBagConstraints);

        jPanel8.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jPanel8.setMinimumSize(new java.awt.Dimension(250, 27));
        jPanel8.setPreferredSize(new java.awt.Dimension(250, 27));
        jPanel8.setLayout(new java.awt.GridBagLayout());

        Save.setMnemonic('s');
        Save.setText("Save");
        Save.setEnabled(false);
        Save.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                SaveActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        jPanel8.add(Save, gridBagConstraints);

        cancelbtn.setMnemonic('l');
        cancelbtn.setText("Clear");
        cancelbtn.setEnabled(false);
        cancelbtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cancelbtnActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        jPanel8.add(cancelbtn, gridBagConstraints);

        exitbtn.setMnemonic('c');
        exitbtn.setText("Zoom Table");
        exitbtn.setEnabled(false);
        exitbtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                exitbtnActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 4;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        jPanel8.add(exitbtn, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 4;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        jPanel4.add(jPanel8, gridBagConstraints);

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

        jLabel2.setForeground(new java.awt.Color(255, 51, 0));
        jLabel2.setText("Total Price");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.weightx = 7.0;
        gridBagConstraints.insets = new java.awt.Insets(0, 100, 0, 0);
        jPanel9.add(jLabel2, gridBagConstraints);

        TotalPriceTxt.setEditable(false);
        TotalPriceTxt.setFont(new java.awt.Font("Garamond", 1, 14)); // NOI18N
        TotalPriceTxt.setForeground(new java.awt.Color(255, 0, 0));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 7.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(2, 0, 2, 50);
        jPanel9.add(TotalPriceTxt, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        jPanel4.add(jPanel9, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        jPanel2.add(jPanel4, gridBagConstraints);

        jTabbedPane1.addTab("View Sent LPOs/LSOs Awaiting Commitment", jPanel2);

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

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

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

        jPanel11.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "LPOs/LSOs",
                javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
                javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 1, 11),
                new java.awt.Color(0, 0, 204))); // NOI18N
        jPanel11.setMinimumSize(new java.awt.Dimension(100, 250));
        jPanel11.setPreferredSize(new java.awt.Dimension(100, 250));
        jPanel11.setLayout(new java.awt.GridBagLayout());

        jScrollPane4.setMinimumSize(new java.awt.Dimension(250, 100));
        jScrollPane4.setPreferredSize(new java.awt.Dimension(250, 100));

        ApprovalTbl1.setModel(com.afrisoftech.dbadmin.TableModel.createTableVectors(connectDB,
                "select distinct supplier,order_no from st_orders where ordered=true and dispatch=false  and order_no in (select order_no from ac_aie_commitment)"));
        ApprovalTbl1.setMinimumSize(new java.awt.Dimension(90, 34));
        ApprovalTbl1.setPreferredSize(new java.awt.Dimension(90, 750));
        ApprovalTbl1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                ApprovalTbl1MouseClicked(evt);
            }
        });
        jScrollPane4.setViewportView(ApprovalTbl1);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.gridheight = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        jPanel11.add(jScrollPane4, gridBagConstraints);

        orderTxt1.setText("Search LPO...");
        orderTxt1.addCaretListener(new javax.swing.event.CaretListener() {
            public void caretUpdate(javax.swing.event.CaretEvent evt) {
                orderTxt1CaretUpdate(evt);
            }
        });
        orderTxt1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                orderTxt1MouseClicked(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        jPanel11.add(orderTxt1, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.gridheight = 4;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 3.0;
        gridBagConstraints.weighty = 1.0;
        jPanel10.add(jPanel11, gridBagConstraints);

        /*        javax.swing.SpinnerDateModel spinerDate = new javax.swing.SpinnerDateModel();
        dateSpinner = new javax.swing.JSpinner(spinerDate);
            
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 30);
        jPanel1.add(dateSpinner, gridBagConstraints);
            
        */
        jPanel12.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jPanel12.setLayout(new java.awt.GridBagLayout());

        jLabel12.setText("Ordered By");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 0);
        jPanel12.add(jLabel12, gridBagConstraints);

        jLabel115.setText("Date Sent");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 0);
        jPanel12.add(jLabel115, gridBagConstraints);

        jLabel13.setText("Due Date");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.weightx = 1.0;
        jPanel12.add(jLabel13, gridBagConstraints);

        jLabel24.setText("Requisitioning Department");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 0);
        jPanel12.add(jLabel24, gridBagConstraints);

        reqDateTxt4.setEditable(false);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 20);
        jPanel12.add(reqDateTxt4, gridBagConstraints);

        reqDeptTxt2.setEditable(false);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        jPanel12.add(reqDeptTxt2, gridBagConstraints);

        TransactionTypeTxt2.setEditable(false);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        jPanel12.add(TransactionTypeTxt2, gridBagConstraints);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 80);
        jPanel12.add(datePicker4, gridBagConstraints);

        jLabel116.setText("LPO/LSO");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 0);
        jPanel12.add(jLabel116, gridBagConstraints);

        reqDateTxt5.setEditable(false);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        jPanel12.add(reqDateTxt5, gridBagConstraints);

        jLabel14.setText("Doc Type");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.weightx = 1.0;
        jPanel12.add(jLabel14, gridBagConstraints);

        UserTxt2.setEditable(false);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 20);
        jPanel12.add(UserTxt2, gridBagConstraints);

        jLabel15.setText("Supplier");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 0);
        jPanel12.add(jLabel15, gridBagConstraints);

        jTextField4.setEditable(false);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        jPanel12.add(jTextField4, gridBagConstraints);

        jLabel16.setText("Tender/Quotation");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 3;
        jPanel12.add(jLabel16, gridBagConstraints);

        Contract_noTxt.setEditable(false);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 20);
        jPanel12.add(Contract_noTxt, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 9.0;
        gridBagConstraints.weighty = 2.0;
        jPanel10.add(jPanel12, gridBagConstraints);

        jScrollPane2.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
        jScrollPane2.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

        PurchaseItemsTbl1.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, 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, 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[] { "Item Code", "Item Description", "Units", "Quantity", "Unit Price", "Value",
                        "Discount", "VAT", "Remarks" }) {
            Class[] types = new Class[] { java.lang.Object.class, java.lang.Object.class, java.lang.Object.class,
                    java.lang.Double.class, java.lang.Double.class, java.lang.Double.class, java.lang.Object.class,
                    java.lang.Object.class, java.lang.Object.class };
            boolean[] canEdit = new boolean[] { false, false, false, false, false, false, false, false, false };

            public Class getColumnClass(int columnIndex) {
                return types[columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit[columnIndex];
            }
        });
        /*java.lang.Object[] strCmb = {"Normal","Urgent",""};
            
        javax.swing.JComboBox cmBox = new javax.swing.JComboBox(strCmb);
            
        javax.swing.table.TableColumn teditor = this.jTable1.getColumn("Status");
            
        teditor.setCellEditor(new javax.swing.DefaultCellEditor(cmBox));
        */

        javax.swing.table.TableColumn column = null;
        for (int i = 0; i < 4; i++) {
            column = PurchaseItemsTbl.getColumnModel().getColumn(i);
            if (i == 0) {

                column.setPreferredWidth(300); //sport column is bigger
            } else {
                if (i == 1) {
                    column.setPreferredWidth(200);
                } else {
                    //if (i == 2) {
                    column.setPreferredWidth(200);
                    // }  else
                    //column.setPreferredWidth(50);

                }
            }
        }

        PurchaseItemsTbl1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                PurchaseItemsTbl1MouseClicked(evt);
            }
        });
        jScrollPane2.setViewportView(PurchaseItemsTbl1);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 9.0;
        gridBagConstraints.weighty = 9.0;
        gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 2);
        jPanel10.add(jScrollPane2, gridBagConstraints);

        jPanel13.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jPanel13.setMinimumSize(new java.awt.Dimension(250, 27));
        jPanel13.setPreferredSize(new java.awt.Dimension(250, 27));
        jPanel13.setLayout(new java.awt.GridBagLayout());

        Save1.setMnemonic('s');
        Save1.setText("Generate LPO/LSO");
        Save1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Save1ActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        jPanel13.add(Save1, gridBagConstraints);

        cancelbtn1.setMnemonic('l');
        cancelbtn1.setText("Clear");
        cancelbtn1.setEnabled(false);
        cancelbtn1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cancelbtn1ActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        jPanel13.add(cancelbtn1, gridBagConstraints);

        exitbtn1.setMnemonic('c');
        exitbtn1.setText("close");
        exitbtn1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                exitbtn1ActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 4;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        jPanel13.add(exitbtn1, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 4;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        jPanel10.add(jPanel13, gridBagConstraints);

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

        jLabel3.setForeground(new java.awt.Color(255, 51, 0));
        jLabel3.setText("Total Price");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.weightx = 7.0;
        gridBagConstraints.insets = new java.awt.Insets(0, 100, 0, 0);
        jPanel14.add(jLabel3, gridBagConstraints);

        TotalPriceTxt1.setEditable(false);
        TotalPriceTxt1.setFont(new java.awt.Font("Garamond", 1, 14)); // NOI18N
        TotalPriceTxt1.setForeground(new java.awt.Color(255, 0, 0));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 7.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(2, 0, 2, 50);
        jPanel14.add(TotalPriceTxt1, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        jPanel10.add(jPanel14, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        jPanel6.add(jPanel10, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        jPanel3.add(jPanel6, gridBagConstraints);

        jTabbedPane1.addTab("Generate LPOs/LSOs ", jPanel3);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        jPanel1.add(jTabbedPane1, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        getContentPane().add(jPanel1, gridBagConstraints);

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

    private void ApprovalTblMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_ApprovalTblMouseClicked
        TotalPriceTxt.setText(null);

        // ApprovalTbl.setModel(com.afrisoftech.dbadmin.TableModel.createTableVectors(connectDB, "SELECT   P.requisition_no as \"PR N0:\", P.type_of_pr as \"PR Type\" FROM st_receive_requisation as P,st_authorizations as S WHERE  P.requisition_no ILIKE '%PRQ%' and P.approval_status=TRUE and P.requisition_no=S.requisition_no and S.scm_forwading=TRUE and S.cso_forwading=FALSE GROUP BY P.requisition_no,P.type_of_pr"));
        ////clearing the products table
        for (int k = 0; k < PurchaseItemsTbl.getRowCount(); k++) {
            for (int r = 0; r < PurchaseItemsTbl.getColumnCount(); r++) {
                PurchaseItemsTbl.getModel().setValueAt(null, k, r);
            }
        }

        ///////////////////get the to total price  for the selected pr
        java.sql.Statement stmts;
        try {

            reqDateTxt1.setText(ApprovalTbl.getValueAt(ApprovalTbl.getSelectedRow(), 1).toString());
            jTextField2.setText(ApprovalTbl.getValueAt(ApprovalTbl.getSelectedRow(), 0).toString());
            stmts = connectDB.createStatement();

            java.sql.ResultSet rset = stmts
                    .executeQuery("SELECT supplier, item, units, quantity, unit_price, gross_value, discount, \n"
                            + "       vat, vat_amount, net_value, ordered, discount_value, order_no, \n"
                            + "       date_due, date, received, code, mileage, balance, item_strength, \n"
                            + "       ordering_store, ordered_by, quotation_no, days_to_deliver, brand, \n"
                            + "       country, remarks, doc_type, criteria, requisition_no, dispatch\n"
                            + "  FROM st_orders where order_no='"
                            + ApprovalTbl.getValueAt(ApprovalTbl.getSelectedRow(), 1)
                            + "' and ordered=false and dispatch=false and supplier='"
                            + ApprovalTbl.getValueAt(ApprovalTbl.getSelectedRow(), 0) + "'");
            int rows = 0;
            String date_due = null;
            String doc_type = null;
            String sent_by = null;
            String req_dept = null;
            String tender = null;
            while (rset.next()) {

                date_due = rset.getString("date_due");
                doc_type = rset.getString("doc_type");
                sent_by = rset.getString("ordered_by");
                req_dept = rset.getString("ordering_store");
                tender = rset.getString("quotation_no");
                PurchaseItemsTbl.getModel().setValueAt(rset.getString("code"), rows, 0);
                PurchaseItemsTbl.getModel().setValueAt(rset.getString("item"), rows, 1);
                PurchaseItemsTbl.getModel().setValueAt(rset.getString("units"), rows, 2);
                PurchaseItemsTbl.getModel().setValueAt(rset.getString("quantity"), rows, 3);
                PurchaseItemsTbl.getModel().setValueAt(rset.getString("unit_price"), rows, 4);
                PurchaseItemsTbl.getModel().setValueAt(rset.getString("net_value"), rows, 5);
                PurchaseItemsTbl.getModel().setValueAt(rset.getString("discount_value"), rows, 6);
                PurchaseItemsTbl.getModel().setValueAt(rset.getString("vat_amount"), rows, 7);
                PurchaseItemsTbl.getModel().setValueAt(rset.getString("remarks"), rows, 8);

                rows++;
            }

            reqDeptTxt.setText(req_dept);
            TransactionTypeTxt.setText(sent_by);
            reqDateTxt.setText(date_due);
            UserTxt.setText(doc_type);
            jTextField3.setText(tender);

        } catch (Exception esc) {
            esc.printStackTrace();
            System.out.println(esc.getMessage());
        }
    }//GEN-LAST:event_ApprovalTblMouseClicked

    private void PurchaseItemsTblMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_PurchaseItemsTblMouseClicked
        //////view more details  of a PR
        //        String Preq=null;
        //        Preq=PurchaseItemsTbl.getValueAt(PurchaseItemsTbl.getSelectedRow(),1).toString();
        //        JOptionPane.showMessageDialog(null,Preq);
        //           if(Preq==null){
        //
        //            String str="<html><center><font color=red>YOU NEED TO SELECT A PR TO VIEW ITS ITEMS</font></center></html>";
        //            JOptionPane.showMessageDialog(null,str,"ERROR MESSAGE",1,new javax.swing.ImageIcon(getClass().getResource("/Icons/32x32/Recycle Bin Full 1.png")));
        //        }
        //        else{
        //        ZoomBuyerPrDetailsTable m=new ZoomBuyerPrDetailsTable(null,true,connectDB,Preq);
        //        m.setVisible(true);
        //        }
    }//GEN-LAST:event_PurchaseItemsTblMouseClicked

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

    }//GEN-LAST:event_SaveActionPerformed

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

    }//GEN-LAST:event_cancelbtnActionPerformed

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

    }//GEN-LAST:event_exitbtnActionPerformed

    private void ApprovalTbl1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_ApprovalTbl1MouseClicked
        // TotalPriceTxt.setText(null);

        // ApprovalTbl.setModel(com.afrisoftech.dbadmin.TableModel.createTableVectors(connectDB, "SELECT   P.requisition_no as \"PR N0:\", P.type_of_pr as \"PR Type\" FROM st_receive_requisation as P,st_authorizations as S WHERE  P.requisition_no ILIKE '%PRQ%' and P.approval_status=TRUE and P.requisition_no=S.requisition_no and S.scm_forwading=TRUE and S.cso_forwading=FALSE GROUP BY P.requisition_no,P.type_of_pr"));
        ////clearing the products table
        for (int k = 0; k < PurchaseItemsTbl1.getRowCount(); k++) {
            for (int r = 0; r < PurchaseItemsTbl1.getColumnCount(); r++) {
                PurchaseItemsTbl1.getModel().setValueAt(null, k, r);
            }
        }

        ///////////////////get the to total price  for the selected pr
        java.sql.Statement stmts;
        try {

            reqDateTxt5.setText(ApprovalTbl1.getValueAt(ApprovalTbl1.getSelectedRow(), 1).toString());
            jTextField4.setText(ApprovalTbl1.getValueAt(ApprovalTbl1.getSelectedRow(), 0).toString());
            stmts = connectDB.createStatement();

            java.sql.ResultSet rset = stmts
                    .executeQuery("SELECT supplier, item, units, quantity, unit_price, gross_value, discount, \n"
                            + "       vat, vat_amount, net_value, ordered, discount_value, order_no, \n"
                            + "       date_due, date, received, code, mileage, balance, item_strength, \n"
                            + "       ordering_store, ordered_by, quotation_no, days_to_deliver, brand, \n"
                            + "       country, remarks, doc_type, criteria, requisition_no, dispatch\n"
                            + "  FROM st_orders where order_no='"
                            + ApprovalTbl1.getValueAt(ApprovalTbl1.getSelectedRow(), 1)
                            + "' and ordered=true and dispatch=false and supplier='"
                            + ApprovalTbl1.getValueAt(ApprovalTbl1.getSelectedRow(), 0) + "'");
            int rows = 0;
            String date_due = null;
            String doc_type = null;
            String sent_by = null;
            String req_dept = null;
            String tender = null;
            while (rset.next()) {

                date_due = rset.getString("date_due");
                doc_type = rset.getString("doc_type");
                sent_by = rset.getString("ordered_by");
                req_dept = rset.getString("ordering_store");
                tender = rset.getString("quotation_no");
                PurchaseItemsTbl1.getModel().setValueAt(rset.getString("code"), rows, 0);
                PurchaseItemsTbl1.getModel().setValueAt(rset.getString("item"), rows, 1);
                PurchaseItemsTbl1.getModel().setValueAt(rset.getString("units"), rows, 2);
                PurchaseItemsTbl1.getModel().setValueAt(rset.getString("quantity"), rows, 3);
                PurchaseItemsTbl1.getModel().setValueAt(rset.getString("unit_price"), rows, 4);
                PurchaseItemsTbl1.getModel().setValueAt(rset.getString("net_value"), rows, 5);
                PurchaseItemsTbl1.getModel().setValueAt(rset.getString("discount_value"), rows, 6);
                PurchaseItemsTbl1.getModel().setValueAt(rset.getString("vat_amount"), rows, 7);
                PurchaseItemsTbl1.getModel().setValueAt(rset.getString("remarks"), rows, 8);

                rows++;
            }

            reqDeptTxt2.setText(req_dept);
            TransactionTypeTxt2.setText(sent_by);
            reqDateTxt4.setText(date_due);
            UserTxt2.setText(doc_type);
            Contract_noTxt.setText(tender);

        } catch (Exception esc) {
            esc.printStackTrace();
            System.out.println(esc.getMessage());
        }
    }//GEN-LAST:event_ApprovalTbl1MouseClicked

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

    private void Save1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Save1ActionPerformed
        if (UserTxt2.getText().toString().equalsIgnoreCase("LSO")) {

            // policy.LsoPdf(connectDB, jTextField93.getText(), oder_no);
            try {
                java.sql.PreparedStatement pstmt3 = connectDB
                        .prepareStatement("UPDATE st_orders SET  dispatch=true where order_no='"
                                + ApprovalTbl1.getValueAt(ApprovalTbl1.getSelectedRow(), 1).toString()
                                + "' and supplier='"
                                + ApprovalTbl1.getValueAt(ApprovalTbl1.getSelectedRow(), 0).toString() + "'");
                pstmt3.executeUpdate();

                com.afrisoftech.hospinventory.mtrhreports.LsoMtrhReportPdf policy = new com.afrisoftech.hospinventory.mtrhreports.LsoMtrhReportPdf();

                policy.LsoMtrhReportPdf(connectDB,
                        ApprovalTbl1.getValueAt(ApprovalTbl1.getSelectedRow(), 0).toString(),
                        ApprovalTbl1.getValueAt(ApprovalTbl1.getSelectedRow(), 1).toString());
                // com.afrisoftech.hospinventory.LsoPdf policy = new com.afrisoftech.hospinventory.LsoPdf();

                String order = reqDateTxt5.getText();
                java.sql.PreparedStatement pr_progress = connectDB.prepareStatement(
                        "UPDATE st_pr_progress SET dispatch_lpo_lso=now() where   raise_lpo_lso ilike '%" + order
                                + "%' ");

                pr_progress.executeUpdate();
                clear();
            } catch (Exception esd) {
                esd.printStackTrace();
                System.out.println(esd.getMessage());
            }
        } else if (UserTxt2.getText().toString().equalsIgnoreCase("LPO")) {

            com.afrisoftech.hospinventory.mtrhreports.LpoKnhPdf policy = new com.afrisoftech.hospinventory.mtrhreports.LpoKnhPdf();

            policy.LpoKnhPdf(connectDB, ApprovalTbl1.getValueAt(ApprovalTbl1.getSelectedRow(), 0).toString(),
                    ApprovalTbl1.getValueAt(ApprovalTbl1.getSelectedRow(), 1).toString(),
                    Contract_noTxt.getText().toString());
            //com.afrisoftech.hospinventory.LpoPdf policy = new com.afrisoftech.hospinventory.LpoPdf();

            com.afrisoftech.hospinventory.mtrhreports.LpoKnhInternalPdf policys = new com.afrisoftech.hospinventory.mtrhreports.LpoKnhInternalPdf();

            policys.LpoKnhInternalPdf(connectDB,
                    ApprovalTbl1.getValueAt(ApprovalTbl1.getSelectedRow(), 0).toString(),
                    ApprovalTbl1.getValueAt(ApprovalTbl1.getSelectedRow(), 1).toString(),
                    Contract_noTxt.getText().toString());

            try {
                java.sql.PreparedStatement pstmt3 = connectDB
                        .prepareStatement("UPDATE st_orders SET dispatch=true where order_no='"
                                + ApprovalTbl1.getValueAt(ApprovalTbl1.getSelectedRow(), 1).toString()
                                + "' and supplier='"
                                + ApprovalTbl1.getValueAt(ApprovalTbl1.getSelectedRow(), 0).toString() + "'");
                pstmt3.executeUpdate();
                clear();
            } catch (Exception esd) {
                esd.printStackTrace();
                System.out.println(esd.getMessage());
            }
        }
    }//GEN-LAST:event_Save1ActionPerformed

    private void clear() {
        for (int k = 0; k < PurchaseItemsTbl.getRowCount(); k++) {
            for (int r = 0; r < PurchaseItemsTbl.getColumnCount(); r++) {
                PurchaseItemsTbl.getModel().setValueAt(null, k, r);
            }
        }

        reqDateTxt5.setText(null);
        jTextField4.setText(null);
        reqDeptTxt2.setText(null);
        TransactionTypeTxt2.setText(null);
        UserTxt2.setText(null);
        reqDateTxt4.setText(null);
        Contract_noTxt.setText(null);

    }

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

    private void exitbtn1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitbtn1ActionPerformed
        dispose();
    }//GEN-LAST:event_exitbtn1ActionPerformed

    private void orderTxtCaretUpdate(javax.swing.event.CaretEvent evt) {//GEN-FIRST:event_orderTxtCaretUpdate
        // TODO add your handling code here:
        //Search LPO...
        ApprovalTbl.setModel(com.afrisoftech.dbadmin.TableModel.createTableVectors(connectDB,
                "select distinct supplier,order_no from st_orders where order_no is not null and ordered=false and dispatch=false and miu_approval=true and approval_rejected is null and order_no ilike '%"
                        + orderTxt.getText() + "%'"));
    }//GEN-LAST:event_orderTxtCaretUpdate

    private void orderTxt1CaretUpdate(javax.swing.event.CaretEvent evt) {//GEN-FIRST:event_orderTxt1CaretUpdate
        // TODO add your handling code here:
        ApprovalTbl1.setModel(com.afrisoftech.dbadmin.TableModel.createTableVectors(connectDB,
                "select distinct supplier,order_no from st_orders where ordered=true and dispatch=false  and order_no in (select order_no from ac_aie_commitment) and order_no ilike '%"
                        + orderTxt1.getText() + "%'"));
        // ApprovalTbl1.setModel(com.afrisoftech.dbadmin.TableModel.createTableVectors(connectDB, "select distinct supplier,order_no from st_orders where order_no is not null and ordered=false and dispatch=false and miu_approval=true and approval_rejected is null "));
    }//GEN-LAST:event_orderTxt1CaretUpdate

    private void orderTxt1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_orderTxt1MouseClicked
        // TODO add your handling code here:
        if (orderTxt1.getText().contains("Search LPO...")) {
            orderTxt1.setText("");
        }
    }//GEN-LAST:event_orderTxt1MouseClicked

    private void orderTxtMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_orderTxtMouseClicked
        // TODO add your handling code here:
        if (orderTxt.getText().contains("Search LPO...")) {
            orderTxt.setText("");
        }
    }//GEN-LAST:event_orderTxtMouseClicked

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTable ApprovalTbl;
    private javax.swing.JTable ApprovalTbl1;
    private javax.swing.JTextField Contract_noTxt;
    private javax.swing.JTable PurchaseItemsTbl;
    private javax.swing.JTable PurchaseItemsTbl1;
    private javax.swing.JButton Save;
    private javax.swing.JButton Save1;
    private javax.swing.JTextField TotalPriceTxt;
    private javax.swing.JTextField TotalPriceTxt1;
    private javax.swing.JTextField TransactionTypeTxt;
    private javax.swing.JTextField TransactionTypeTxt2;
    private javax.swing.JTextField UserTxt;
    private javax.swing.JTextField UserTxt2;
    private javax.swing.JButton cancelbtn;
    private javax.swing.JButton cancelbtn1;
    private com.afrisoftech.lib.DatePicker datePicker2;
    private com.afrisoftech.lib.DatePicker datePicker4;
    public static javax.swing.JButton exitbtn;
    public static javax.swing.JButton exitbtn1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel111;
    private javax.swing.JLabel jLabel112;
    private javax.swing.JLabel jLabel115;
    private javax.swing.JLabel jLabel116;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    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 jPanel2;
    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 jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JTextField jTextField3;
    private javax.swing.JTextField jTextField4;
    private javax.swing.JTextField orderTxt;
    private javax.swing.JTextField orderTxt1;
    private javax.swing.JTextField reqDateTxt;
    private javax.swing.JTextField reqDateTxt1;
    private javax.swing.JTextField reqDateTxt4;
    private javax.swing.JTextField reqDateTxt5;
    private javax.swing.JTextField reqDeptTxt;
    private javax.swing.JTextField reqDeptTxt2;
    // End of variables declaration//GEN-END:variables
}