protected void GetBankChequeBookEntryByAutoRefNo(string autoRefNo)
        {
            BankChequeBookBLL bankChequeBook = new BankChequeBookBLL();

            try
            {
                DataTable dt = bankChequeBook.GetBankChequeBookEntryByAutoRefNo(autoRefNo);

                if (dt.Rows.Count > 0)
                {
                    bankAccountHeadLabel.Text = dt.Rows[0]["AccountHead"].ToString();
                    chequeBookRefNoLabel.Text = dt.Rows[0]["ChequeBookRefNo"].ToString();
                    startPageNoLabel.Text = dt.Rows[0]["StartPageNo"].ToString();
                    endPageNoLabel.Text = dt.Rows[0]["EndPageNo"].ToString();
                    entryDateLabel.Text = dt.Rows[0]["EntryDate"].ToString();
                    statusLabel.Text = dt.Rows[0]["Status"].ToString();
                }
                else
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Cheque Book Entry Data Not Found!!!"; msgDetailLabel.Text = "";
                    msgbox.Attributes.Add("class", "alert alert-warning");
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
            finally
            {
                bankChequeBook = null;
            }
        }
        protected void GetBankChequeBookPagesByAutoRefNo(string autoRefNo)
        {
            BankChequeBookBLL bankChequeBook = new BankChequeBookBLL();

            try
            {
                DataTable dt = bankChequeBook.GetBankChequeBookPagesByAutoRefNo(autoRefNo);

                if (dt.Rows.Count > 0)
                {
                    chequeBookPageListGridView.DataSource = dt;
                    chequeBookPageListGridView.DataBind();

                    if (chequeBookPageListGridView.Rows.Count > 0)
                    {
                        chequeBookPageListGridView.UseAccessibleHeader = true;
                        chequeBookPageListGridView.HeaderRow.TableSection = TableRowSection.TableHeader;
                    }
                }
                else
                {
                    //msgbox.Visible = true; msgTitleLabel.Text = "Data Not Found!!!"; msgDetailLabel.Text = "";
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
            finally
            {
                bankChequeBook = null;
            }
        }
        protected void approveLinkButton_Click(object sender, EventArgs e)
        {
            BankChequeBookBLL bankChequeBook = new BankChequeBookBLL();

            try
            {
                LinkButton lnkBtn = (LinkButton)sender;
                GridViewRow row = (GridViewRow)lnkBtn.NamingContainer;

                string[] accId = chequeBookEntryListGridView.Rows[row.RowIndex].Cells[1].Text.ToString().Split('-');

                bankChequeBook.AccountId = accId[0].ToString();
                bankChequeBook.ChequeBookRefNo = chequeBookEntryListGridView.Rows[row.RowIndex].Cells[2].Text.ToString();
                bankChequeBook.AutoRefNo = chequeBookEntryListGridView.Rows[row.RowIndex].Cells[3].Text.ToString();
                bankChequeBook.StartPageNo = chequeBookEntryListGridView.Rows[row.RowIndex].Cells[4].Text.ToString();
                bankChequeBook.EndPageNo = chequeBookEntryListGridView.Rows[row.RowIndex].Cells[5].Text.ToString();

                bankChequeBook.ApproveBankChequeBookEntryByAutoRefNo();

                GetApprovalList();
                string message = "Cheque Book Entry <span class='actionTopic'>Approved</span> Successfully.";
                MyAlertBox("SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", \"\");");
            }
            catch (Exception ex)
            {
                string message = "Somethings goes wrong in Approve";
                if (ex.InnerException != null) { message += " --> Somethings goes wrong in Approve" ; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
            finally
            {
                bankChequeBook = null;
            }
        }
        public DataTable SaveBankChequeBook(BankChequeBookBLL bankChequeBook, LumexDBPlayer db)
        {
            try
            {
                db.AddParameters("@AccountId", bankChequeBook.AccountId.Trim());
                db.AddParameters("@ChequeBookRefNo", bankChequeBook.ChequeBookRefNo.Trim());
                db.AddParameters("@StartPageNo", bankChequeBook.StartPageNo.Trim());
                db.AddParameters("@EndPageNo", bankChequeBook.EndPageNo.Trim());
                db.AddParameters("@OfficeBranchId", "");
                db.AddParameters("@CreatedBy", LumexSessionManager.Get("ActiveUserId").ToString());
                db.AddParameters("@CreatedFrom", LumexLibraryManager.GetTerminal());

                DataTable dt = db.ExecuteDataTable("INSERT_CHEQUE_BOOK_ENTRY", true);

                return dt;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                bankChequeBook = null;
            }
        }
        public bool CheckDuplicateBankChequeBook(BankChequeBookBLL bankChequeBook, LumexDBPlayer db)
        {
            bool status = false;

            try
            {
                db.AddParameters("@AccountId", bankChequeBook.AccountId.Trim());
                db.AddParameters("@StartPageNo", bankChequeBook.StartPageNo.Trim());
                db.AddParameters("@EndPageNo", bankChequeBook.EndPageNo.Trim());

                DataTable dt = db.ExecuteDataTable("CHECK_DUPLICATE_CHEQUE_BOOK_ENTRY", true);

                if (dt.Rows.Count > 0)
                {
                    status = true;
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                bankChequeBook = null;
            }

            return status;
        }
        protected void voidLinkButton_Click(object sender, EventArgs e)
        {
            BankChequeBookBLL bankChequeBook = new BankChequeBookBLL();

            try
            {
                LinkButton lnkBtn = (LinkButton)sender;
                GridViewRow row = (GridViewRow)lnkBtn.NamingContainer;

                TextBox voidNarrationTextBox = (TextBox)chequeBookPageListGridView.Rows[row.RowIndex].Cells[6].FindControl("voidNarrationTextBox");
                string voidNarration = voidNarrationTextBox.Text.Trim();
                string chequeNo = chequeBookPageListGridView.Rows[row.RowIndex].Cells[1].Text.Trim();
                string autoRefNo = numberLabel.Text.Trim();

                if (string.IsNullOrEmpty(voidNarration))
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Void Narration field is required at Cheque No. [" + chequeNo + "]";
                }
                else
                {
                    bankChequeBook.ChequeVoidByAutoRefNoAndChequeNo(autoRefNo, chequeNo, voidNarration);

                    GetBankChequeBookPagesByAutoRefNo(numberLabel.Text.Trim());
                    string message = "Cheque <span class='actionTopic'>Void</span> Successfully.";
                    MyAlertBox("SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", \"\");");
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
            finally
            {
                bankChequeBook = null;
                MyAlertBox("MyOverlayStop();");
            }
        }
        public DataTable GetBankChequeBookEntryListByAccountIdDateRangeAndStatus(BankChequeBookBLL bankChequeBook, LumexDBPlayer db)
        {
            try
            {
                db.AddParameters("@AccountId", bankChequeBook.AccountId.Trim());
                db.AddParameters("@FromDate", bankChequeBook.FromDate.Trim());
                db.AddParameters("@ToDate", bankChequeBook.ToDate.Trim());
                db.AddParameters("@Status", bankChequeBook.Status.Trim());

                DataTable dt = db.ExecuteDataTable("GET_CHEQUE_BOOK_ENTRY_BY_ACCOUNT_ID_DATE_RANGE_AND_STATUS", true);

                return dt;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                bankChequeBook = null;
            }
        }
        protected void GetChequeVoidListByDateRangeAndAll(string search)
        {
            BankChequeBookBLL bankChequeBook = new BankChequeBookBLL();

            try
            {
                bankChequeBook.FromDate = LumexLibraryManager.ParseAppDate(fromDateTextBox.Text.Trim());
                bankChequeBook.ToDate = LumexLibraryManager.ParseAppDate(toDateTextBox.Text.Trim());

                DataTable dt = bankChequeBook.GetChequeVoidListByDateRangeAndAll(bankChequeBook.FromDate, bankChequeBook.ToDate, search);

                chequeVoidListGridView.DataSource = dt;
                chequeVoidListGridView.DataBind();

                if (chequeVoidListGridView.Rows.Count > 0)
                {
                    chequeVoidListGridView.UseAccessibleHeader = true;
                    chequeVoidListGridView.HeaderRow.TableSection = TableRowSection.TableHeader;
                }
                else
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Cheque Void List Data Not Found!!!"; msgDetailLabel.Text = "";
                    msgbox.Attributes.Add("class", "alert alert-info");
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
            finally
            {
                bankChequeBook = null;
            }
        }
        protected void GetBankChequeBookPagesByAutoRefNo(string autoRefNo)
        {
            BankChequeBookBLL bankChequeBook = new BankChequeBookBLL();
            TextBox voidNarrationTextBox;
            LinkButton voidLinkButton;

            try
            {
                DataTable dt = bankChequeBook.GetBankChequeBookPagesByAutoRefNo(autoRefNo);

                if (dt.Rows.Count > 0)
                {
                    chequeBookPageListGridView.DataSource = dt;
                    chequeBookPageListGridView.DataBind();

                    for (int i = 0; i < chequeBookPageListGridView.Rows.Count; i++)
                    {
                        voidNarrationTextBox = (TextBox)chequeBookPageListGridView.Rows[i].Cells[6].FindControl("voidNarrationTextBox");
                        voidNarrationTextBox.Text = dt.Rows[i]["VoidNarration"].ToString();

                        if (chequeBookPageListGridView.Rows[i].Cells[2].Text.ToString() == "Void")
                        {
                            voidLinkButton = (LinkButton)chequeBookPageListGridView.Rows[i].Cells[7].FindControl("voidLinkButton");
                            voidLinkButton.Visible = false;

                            voidNarrationTextBox.ReadOnly = true;
                        }
                    }

                    if (chequeBookPageListGridView.Rows.Count > 0)
                    {
                        chequeBookPageListGridView.UseAccessibleHeader = true;
                        chequeBookPageListGridView.HeaderRow.TableSection = TableRowSection.TableHeader;

                        chequeBookEntry.Visible = true;
                    }
                    else
                    {
                        chequeBookEntry.Visible = false;
                    }
                }
                else
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Cheque Book Page List Data Not Found!!!"; msgDetailLabel.Text = "";
                    msgbox.Attributes.Add("class", "alert alert-warning");
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
            finally
            {
                bankChequeBook = null;
            }
        }
        protected void rejectLinkButton_Click(object sender, EventArgs e)
        {
            try
            {
                LinkButton lnkBtn = (LinkButton)sender;
                GridViewRow row = (GridViewRow)lnkBtn.NamingContainer;

                BankChequeBookBLL bankChequeBook = new BankChequeBookBLL();
                bankChequeBook.RejectBankChequeBookEntryByAutoRefNo(chequeBookEntryListGridView.Rows[row.RowIndex].Cells[3].Text.ToString());

                GetApprovalList();
                string message = "Cheque Book Entry <span class='actionTopic'>Rejected</span> Successfully.";
                MyAlertBox("SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", \"\");");
            }
            catch (Exception ex)
            {
                string message = "Somethings goes wrong in Reject";
                if (ex.InnerException != null) { message += " --> Somethings goes wrong in Reject" ; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
        }
        public void ApproveBankChequeBookEntryByAutoRefNo(BankChequeBookBLL bankChequeBook, LumexDBPlayer db)
        {
            try
            {
                db.AddParameters("@AccountId", bankChequeBook.AccountId.Trim());
                db.AddParameters("@ChequeBookRefNo", bankChequeBook.ChequeBookRefNo.Trim());
                db.AddParameters("@AutoRefNo", bankChequeBook.AutoRefNo.Trim());
                db.AddParameters("@StartPageNo", bankChequeBook.StartPageNo.Trim());
                db.AddParameters("@EndPageNo", bankChequeBook.EndPageNo.Trim());
                db.AddParameters("@OfficeBranchId", "");
                db.AddParameters("@ApprovedBy", LumexSessionManager.Get("ActiveUserId").ToString());
                db.AddParameters("@ApprovedFrom", LumexLibraryManager.GetTerminal());

                db.ExecuteNonQuery("APPROVE_CHEQUE_BOOK_ENTRY_BY_AUTO_REF_NO", true);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                bankChequeBook = null;
            }
        }
        protected void updateLinkButton_Click(object sender, EventArgs e)
        {
            BankChequeBookBLL bankChequeBook = new BankChequeBookBLL();

            try
            {
                LinkButton lnkBtn = (LinkButton)sender;
                GridViewRow row = (GridViewRow)lnkBtn.NamingContainer;

                TextBox usedDateTextBox = (TextBox)chequeBookPageListGridView.Rows[row.RowIndex].Cells[3].FindControl("usedDateTextBox");
                string usedDate = usedDateTextBox.Text.Trim();

                TextBox usedVoucherNoTextBox = (TextBox)chequeBookPageListGridView.Rows[row.RowIndex].Cells[4].FindControl("usedVoucherNoTextBox");
                string usedVoucherNo = usedVoucherNoTextBox.Text.Trim();

                TextBox usedJournalNoTextBox = (TextBox)chequeBookPageListGridView.Rows[row.RowIndex].Cells[5].FindControl("usedJournalNoTextBox");
                string usedJournalNo = usedJournalNoTextBox.Text.Trim();

                TextBox usedNarrationTextBox = (TextBox)chequeBookPageListGridView.Rows[row.RowIndex].Cells[6].FindControl("usedNarrationTextBox");
                string usedNarration = usedNarrationTextBox.Text.Trim();

                string chequeNo = chequeBookPageListGridView.Rows[row.RowIndex].Cells[1].Text.Trim();
                string autoRefNo = numberLabel.Text.Trim();

                if (string.IsNullOrEmpty(usedDate) || LumexLibraryManager.ParseAppDate(usedDate) == "False")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Used Date field is required at Cheque No. [" + chequeNo + "]";
                }
                else if (string.IsNullOrEmpty(usedVoucherNo))
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Used Voucher No. field is required at Cheque No. [" + chequeNo + "]";
                }
                else if (string.IsNullOrEmpty(usedJournalNo))
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Used Journal No. field is required at Cheque No. [" + chequeNo + "]";
                }
                else if (string.IsNullOrEmpty(usedNarration))
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Used Narration field is required at Cheque No. [" + chequeNo + "]";
                }
                else
                {
                    bankChequeBook.ChequeUsedByAutoRefNoAndChequeNo(autoRefNo, chequeNo, LumexLibraryManager.ParseAppDate(usedDate), usedVoucherNo, usedJournalNo, usedNarration);

                    GetBankChequeBookPagesByAutoRefNo(numberLabel.Text.Trim());
                    string message = "Cheque <span class='actionTopic'>Updated</span> Successfully.";
                    MyAlertBox("SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", \"\");");
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
            finally
            {
                bankChequeBook = null;
                MyAlertBox("MyOverlayStop();");
            }
        }
        public static string GetBankChequeBookAutoRefNosByAccountId(string accountId)
        {
            BankChequeBookBLL bankChequeBook = new BankChequeBookBLL();

            try
            {
                DataTable dt = bankChequeBook.GetBankChequeBookAutoRefNosByAccountId(accountId);

                if (dt.Rows.Count > 0)
                {
                    StringBuilder sb = new StringBuilder();

                    string volume = "";

                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        volume = dt.Rows[i]["AutoRefNo"].ToString().Trim();
                        sb.Append(volume).Append(Environment.NewLine);
                    }

                    return sb.ToString();
                }
                else
                {
                    return "No Cheque Book saved yet!";
                }
            }
            catch (Exception ex)
            {
                return ex.Message;
            }
            finally
            {
                bankChequeBook = null;
            }
        }
        protected void GetApprovalList()
        {
            BankChequeBookBLL bankChequeBook = new BankChequeBookBLL();

            try
            {
                if (bankAccountHeadDropDownList.SelectedValue == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Bank Account Head field is required.";
                }
                else
                {
                    DataTable dt = bankChequeBook.GetBankChequeBookEntryApprovalListByAccountIdAll(bankAccountHeadDropDownList.SelectedValue.Trim());

                    chequeBookEntryListGridView.DataSource = dt;
                    chequeBookEntryListGridView.DataBind();

                    if (chequeBookEntryListGridView.Rows.Count > 0)
                    {
                        chequeBookEntryListGridView.UseAccessibleHeader = true;
                        chequeBookEntryListGridView.HeaderRow.TableSection = TableRowSection.TableHeader;
                    }
                    else
                    {
                        msgbox.Visible = true; msgTitleLabel.Text = "Cheque Book Entry List Data Not Found!!!"; msgDetailLabel.Text = "";
                        msgbox.Attributes.Add("class", "alert alert-info");
                    }
                }
            }
            catch (Exception ex)
            {
                string message = "Somethings goes wrong in Get approval list";
                if (ex.InnerException != null) { message += " --> Somethings goes wrong in Approval List" ; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
            finally
            {
                bankChequeBook = null;
            }
        }
        protected void saveButton_Click(object sender, EventArgs e)
        {
            BankChequeBookBLL bankChequeBook = new BankChequeBookBLL();

            try
            {
                if (bankAccountHeadDropDownList.SelectedValue == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Bank Account Head field is required.";
                }
                else if (chequeBookReferenceNoTextBox.Text == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Cheque Book Reference Number field is required.";
                }
                else if (startPageNoTextBox.Text == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Start Page Number field is required.";
                }
                else if (endPageNoTextBox.Text == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "End Page Number field is required.";
                }
                else
                {
                    bankChequeBook.AccountId = bankAccountHeadDropDownList.SelectedValue.Trim();
                    bankChequeBook.ChequeBookRefNo = chequeBookReferenceNoTextBox.Text.Trim();
                    bankChequeBook.StartPageNo = startPageNoTextBox.Text.Trim();
                    bankChequeBook.EndPageNo = endPageNoTextBox.Text.Trim();

                    if (!bankChequeBook.CheckDuplicateBankChequeBook())
                    {
                        DataTable dt = bankChequeBook.SaveBankChequeBook();

                        if (dt.Rows.Count > 0)
                        {
                            string message = "Cheque Book Entry <span class='actionTopic'>Created</span> Successfully with Reference Number: <span class='actionTopic'>" + dt.Rows[0][0].ToString() + "</span>.";
                            MyAlertBox("var callbackOk = function () { MyOverlayStart(); window.location = \"/UI/AccUI/BankChequeBook/ChequeBookEntryList.aspx\"; }; SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", callbackOk);");
                        }
                        else
                        {
                            string message = "<span class='actionTopic'>Failed</span> to Create Cheque Book Entry.";
                            MyAlertBox("ErrorAlert(\"" + "Process Failed" + "\", \"" + message + "\");");
                        }
                    }
                    else
                    {
                        string message = "This Cheque Book Page(s) <span class='actionTopic'>already exist</span>, check the cheque numbers.";
                        MyAlertBox("WarningAlert(\"" + "Data Duplicate" + "\", \"" + message + "\");");
                    }
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
            finally
            {
                bankChequeBook = null;
            }
        }
Beispiel #16
0
        protected void GetBankChequeBookPagesByAutoRefNo(string autoRefNo)
        {
            BankChequeBookBLL bankChequeBook = new BankChequeBookBLL();
            TextBox usedDateTextBox;
            TextBox usedVoucherNoTextBox;
            TextBox usedJournalNoTextBox;
            TextBox usedNarrationTextBox;
            LinkButton useLinkButton;

            try
            {
                DataTable dt = bankChequeBook.GetBankChequeBookPagesByAutoRefNo(autoRefNo);

                if (dt.Rows.Count > 0)
                {
                    chequeBookPageListGridView.DataSource = dt;
                    chequeBookPageListGridView.DataBind();

                    for (int i = 0; i < chequeBookPageListGridView.Rows.Count; i++)
                    {
                        usedDateTextBox = (TextBox)chequeBookPageListGridView.Rows[i].Cells[3].FindControl("usedDateTextBox");
                        if (!string.IsNullOrEmpty(dt.Rows[i]["UsedDate"].ToString()))
                        {
                            usedDateTextBox.Text = LumexLibraryManager.GetAppDateView(dt.Rows[i]["UsedDate"].ToString());
                        }
                        else
                        {
                            usedDateTextBox.Text = "";
                        }

                        usedVoucherNoTextBox = (TextBox)chequeBookPageListGridView.Rows[i].Cells[4].FindControl("usedVoucherNoTextBox");
                        usedVoucherNoTextBox.Text = dt.Rows[i]["UsedVoucherNo"].ToString();

                        usedJournalNoTextBox = (TextBox)chequeBookPageListGridView.Rows[i].Cells[5].FindControl("usedJournalNoTextBox");
                        usedJournalNoTextBox.Text = dt.Rows[i]["UsedJournalNo"].ToString();

                        usedNarrationTextBox = (TextBox)chequeBookPageListGridView.Rows[i].Cells[6].FindControl("usedNarrationTextBox");
                        usedNarrationTextBox.Text = dt.Rows[i]["UsedNarration"].ToString();

                        if (chequeBookPageListGridView.Rows[i].Cells[2].Text.ToString() != "Available")
                        {
                            useLinkButton = (LinkButton)chequeBookPageListGridView.Rows[i].Cells[7].FindControl("useLinkButton");
                            useLinkButton.Visible = false;

                            usedDateTextBox.Enabled = false;
                            usedVoucherNoTextBox.ReadOnly = true;
                            usedJournalNoTextBox.ReadOnly = true;
                            usedNarrationTextBox.ReadOnly = true;
                        }
                    }

                    if (chequeBookPageListGridView.Rows.Count > 0)
                    {
                        chequeBookPageListGridView.UseAccessibleHeader = true;
                        chequeBookPageListGridView.HeaderRow.TableSection = TableRowSection.TableHeader;

                        chequeBookEntry.Visible = true;
                    }
                    else
                    {
                        chequeBookEntry.Visible = false;
                    }
                }
                else
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Cheque Book Page List Data Not Found!!!"; msgDetailLabel.Text = "";
                    msgbox.Attributes.Add("class", "alert alert-warning");
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
            finally
            {
                bankChequeBook = null;
            }
        }
        protected void chequeBookEntryListButton_Click(object sender, EventArgs e)
        {
            BankChequeBookBLL bankChequeBook = new BankChequeBookBLL();

            try
            {
                if (bankAccountHeadDropDownList.SelectedValue == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Bank Account Head field is required.";
                }
                else if (fromDateTextBox.Text.Trim() == "" || LumexLibraryManager.ParseAppDate(fromDateTextBox.Text.Trim()) == "False")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Date From field is required.";
                }
                else if (toDateTextBox.Text.Trim() == "" || LumexLibraryManager.ParseAppDate(toDateTextBox.Text.Trim()) == "False")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Date To field is required.";
                }
                else
                {
                    bankChequeBook.AccountId = bankAccountHeadDropDownList.SelectedValue.Trim();
                    bankChequeBook.FromDate = LumexLibraryManager.ParseAppDate(fromDateTextBox.Text.Trim());
                    bankChequeBook.ToDate = LumexLibraryManager.ParseAppDate(toDateTextBox.Text.Trim());
                    bankChequeBook.Status = statusDropDownList.SelectedValue.Trim();

                    DataTable dt = bankChequeBook.GetBankChequeBookEntryListByAccountIdDateRangeAndStatus();

                    chequeBookEntryListGridView.DataSource = dt;
                    chequeBookEntryListGridView.DataBind();

                    if (chequeBookEntryListGridView.Rows.Count > 0)
                    {
                        chequeBookEntryListGridView.UseAccessibleHeader = true;
                        chequeBookEntryListGridView.HeaderRow.TableSection = TableRowSection.TableHeader;
                    }
                    else
                    {
                        msgbox.Visible = true; msgTitleLabel.Text = "Cheque Book Entry List Data Not Found!!!"; msgDetailLabel.Text = "";
                        msgbox.Attributes.Add("class", "alert alert-info");
                    }
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
            finally
            {
                bankChequeBook = null;
                MyAlertBox("MyOverlayStop();");
            }
        }