private void PostTransaction()
    {
        string custref    = txtcode.Text.Trim();
        string custname   = txtname.Text.Trim();
        string phone      = txtPhone.Text.Trim();
        string amount     = txtAmount.Text.Trim();
        string bal        = txtbal.Text.Trim();
        string custtype   = txtCustType.Text.Trim();
        string paymode    = GetPayTypeSelected();
        string payType    = cboPayType.SelectedValue.ToString();
        string teller     = Session["Username"].ToString();
        string vendorcode = cboVendor.SelectedValue.ToString();
        string agentref   = txtagentRef.Text.Trim();
        bool   sms        = chkSendSms.Checked;

        if (custref.Equals(""))
        {
            ShowMessage("Customer Ref is Required", true);
        }
        else if (custname.Equals(""))
        {
            ShowMessage("Customer Name is Required", true);
        }
        else if (vendorcode.Equals("0"))
        {
            ShowMessage("Please Select Agent", true);
        }
        else if (agentref.Equals(""))
        {
            ShowMessage("Agent Ref is Required", true);
            txtagentRef.Focus();
        }
        else if (payType.Equals("0"))
        {
            ShowMessage("Please Select Payment Type", true);
        }
        else if (amount.Equals(""))
        {
            ShowMessage("Please Enter Amount to pay", true);
            txtAmount.Focus();
        }
        else if (amount.Equals("0"))
        {
            ShowMessage("Amount to post cannot be zero", true);
            txtAmount.Focus();
        }
        else if (bal.Equals(""))
        {
            ShowMessage("Customer Balance is Required", true);
        }
        else if (phone.Equals("") && sms)
        {
            ShowMessage("Please Provide Phone Number or Uncheck Send SMS", true);
            txtPhone.Focus();
        }
        else if (paymode.Equals("NONE"))
        {
            ShowMessage("Please Select Payment Mode, Cash or Cheque", true);
        }
        else
        {
            PhoneValidator pv = new PhoneValidator();
            if (pv.PhoneNumbersOk(phone))
            {
                Responseobj res = new Responseobj();
                Transaction t   = new Transaction();
                t.TranAmount   = amount.Replace(",", "");
                t.CustomerRef  = custref;
                t.CustomerType = custtype;
                t.CustomerName = custname;
                t.TranType     = paymode;
                t.PaymentType  = payType;
                t.CustomerTel  = phone;
                t.Reversal     = "0";
                t.Teller       = teller;
                t.VendorCode   = vendorcode;
                t.VendorTranId = agentref;
                t.PaymentDate  = DateTime.Now.ToString("dd/MM/yyyy");
                res            = bll.PostInternalPayment(t, sms);
                if (res.Errorcode.Equals("0"))
                {
                    //DisplayReceipt(res);
                    ShowMessage(res.Message, false);
                    ClearContrls();
                }
                else
                {
                    ShowMessage(res.Message, true);
                }
            }
            else
            {
                ShowMessage("Please Enter a valid phone number", true);
                txtPhone.Focus();
            }
        }
    }