protected void TXTCNO_TextChanged(object sender, EventArgs e)
 {
     try
     {
         if (TXTCNO.Text.Length == 0)
         {
             WebMsgBox.Show("Enter Customer No First", this.Page);
             return;
         }
         dt = fedSub.GetCustomerDetails(ddlMemberType.SelectedValue.ToString(), TXTCNO.Text);
         if (dt == null || dt.Rows.Count == 0)
         {
             WebMsgBox.Show("No Records found with Customer No " + TXTCNO.Text, this.Page);
             TXTCNO.Text = String.Empty;
             TXTCNO.Focus();
         }
         else
         {
             TXTCNAME.Text = dt.Rows[0]["CustName"].ToString();
             DataTable dtR = new DataTable();
             dtR = fedSub.GetBalance(ddlMemberType.SelectedValue.ToString(), TXTCNO.Text);
             if (dtR != null && dtR.Rows.Count > 0)
             {
                 LBLBAL.Text  = Convert.ToString(dtR.Rows[0]["LBLBAL"].ToString());
                 TXTBAL3.Text = Convert.ToString(dtR.Rows[0]["BALANCE"].ToString());
             }
             BindStatement();
             ddlPaymentMode.Focus();
         }
     }
     catch (Exception ex)
     {
         ExceptionLogging.SendErrorToText(ex);
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["UserName"] == null)
     {
         Response.Redirect("FrmLogin.aspx");
     }
     if (!IsPostBack)
     {
         TXTCNO.Focus();
         //instrumentDetails.Style.Add("display", "none");
         instrumentDetails1.Visible = false;
         instrumentDetails2.Visible = false;
         getDefaulValue();
     }
 }
    protected void BTNSUBMIT_Click(object sender, EventArgs e)
    {
        try
        {
            if (TXTCNO.Text.Length == 0)
            {
                WebMsgBox.Show("Enter customer no first", this.Page);
                TXTCNO.Focus();
                return;
            }
            if (ddlPaymentMode.SelectedValue == "5" && Txtchno.Text.Length == 0)
            {
                WebMsgBox.Show("Enter instrument no first", this.Page);
                Txtchno.Focus();
                return;
            }

            if (ddlPaymentMode.SelectedValue == "5" && txtChequeDate.Text.Length == 0)
            {
                WebMsgBox.Show("Enter instrument Date first", this.Page);
                txtChequeDate.Focus();
                return;
            }

            if (ddlPaymentMode.SelectedValue == "5" && txtBankCode.Text.Length == 0)
            {
                WebMsgBox.Show("Enter instrument Bank Code First", this.Page);
                txtBankCode.Focus();
                return;
            }

            if (ddlPaymentMode.SelectedValue == "5" && txtBranchCode.Text.Length == 0)
            {
                WebMsgBox.Show("Enter instrument Branch Code first", this.Page);
                txtBranchCode.Focus();
                return;
            }
            if (txtDSubGlCode.Text.Length == 0)
            {
                WebMsgBox.Show("Enter debit product code first", this.Page);
                txtDSubGlCode.Focus();
                return;
            }

            DataTable gstData = new DataTable();
            gstData = SetGstDataTable();
            var instrumentNo   = Txtchno.Text.Length == 0 ? "0" : Txtchno.Text;
            var instrumentDate = txtChequeDate.Text.Length == 0 ? "1900-01-01" : txtChequeDate.Text;



            int setNo = fedSub.SaveDetails(MemberType: ddlMemberType.SelectedValue.ToString(), MemberNo: TXTCNO.Text, brcd: Session["BRCD"].ToString(), entryDate: Session["EntryDate"].ToString(), FROMPERIOD: txtFromPeriod.Text, TOPERIOD: txtToPeriod.Text, mid: Session["MID"].ToString(),
                                           debitSubGlCode: txtDSubGlCode.Text, paymentMode: ddlPaymentMode.SelectedValue, narration: TXTNARR.Text, instrumentNo: instrumentNo, chequeDate: instrumentDate,
                                           bankCode: txtBankCode.Text, branchCode: txtBranchCode.Text, gstDetails: gstData);
            if (setNo > 0)
            {
                string redirectURL = "FrmRView.aspx?ID=" + setNo.ToString() + "&MEMTYPE=" + ddlMemberType.SelectedValue.ToString() + "&MEMNO=" + TXTCNO.Text.ToString() + "&rptname=RptOrdReceipt.rdlc";
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "popup", "window.open('" + redirectURL + "','_blank')", true);
                ClearDetails();
                TXTCNO.Focus();

                return;
            }
            else
            {
                WebMsgBox.Show("Error occured while adding data", this.Page);
                return;
            }
        }
        catch (Exception ex)
        {
            ExceptionLogging.SendErrorToText(ex);
        }
    }