protected void btnRemPay_Click(object sender, EventArgs e)
    {
        String clientName = lbPayNames.SelectedValue;

        GlobalClientList.removePayable(clientName);

        populateListBox(lbPayNames, GlobalClientList.payList);
    }
    protected void btnRemRec_Click(object sender, EventArgs e)
    {
        String clientName = lbRecNames.SelectedValue;

        GlobalClientList.removeReceivable(clientName);

        populateListBox(lbRecNames, GlobalClientList.recList);
    }
    protected void btnAddRec_Click(object sender, EventArgs e)
    {
        Client receivable = new Client(txtRecName.Text,
                                       Convert.ToDouble(txtRecAmount.Text),
                                       txtRecComment.Text,
                                       cbxRecPaid.Checked);

        GlobalClientList.addReceivable(receivable);
        populateListBox(lbRecNames, GlobalClientList.recList);

        txtRecName.Text    = "";
        txtRecAmount.Text  = "";
        txtRecComment.Text = "";
        cbxRecPaid.Checked = false;
    }
    protected void btnAddPay_Click(object sender, EventArgs e)
    {
        Client payable = new Client(txtPayName.Text,
                                    Convert.ToDouble(txtPayAmount.Text),
                                    txtPayComment.Text,
                                    cbxPayPaid.Checked);

        GlobalClientList.addPayable(payable);
        populateListBox(lbPayNames, GlobalClientList.payList);

        txtPayName.Text    = "";
        txtPayAmount.Text  = "";
        txtPayComment.Text = "";
        cbxPayPaid.Checked = false;
    }
    protected void InsertButton_Click(object sender, EventArgs e)
    {
        //make TReport entry
        insertTReport();

        //make agginvclient entry for each receivable
        HashSet <Client> recList = GlobalClientList.recList;

        foreach (Client client in recList)
        {
            addClientToInvoice(client, true);
        }

        //make agginvclient entry for each payable
        HashSet <Client> payList = GlobalClientList.payList;

        foreach (Client client in payList)
        {
            addClientToInvoice(client, false);
        }



        GlobalClientList.clear();
        populateListBox(lbRecNames, GlobalClientList.recList);
        populateListBox(lbPayNames, GlobalClientList.payList);

        DoneMsg.Text = "Entry " + txtInvoice.Text + " has been added";

        txtAP.Text        = "";
        txtAR.Text        = "";
        txtBSP.Text       = "";
        txtCC.Text        = "";
        txtCommAgent.Text = "";
        txtCommAir.Text   = "";
        txtGSTC.Text      = "";
        txtGSTP.Text      = "";
        txtNetRemit.Text  = "";
        txtInvoice.Text   = "";
        txtTransDate.Text = "";
        txtRebate.Text    = "";
    }