public void FillPAY_REC_MasterGrid(string CompCode)
        {
            DataTable Dt = new DataTable();

            Dt = PAY_REC_MLogicLayer.GetAllPAY_REC_MASDetailsForBankReco(Convert.ToInt32(Session["USERCODE"].ToString()), Convert.ToInt32(Session["COMP_CODE"].ToString()), HfAccountCodeOnMasterGrid.Value.ToString());
            DataView Dv = new DataView(Dt);

            if (CompCode != string.Empty)
            {
                Dv.RowFilter = "COMP_CODE=" + Session["COMP_CODE"].ToString();
            }
            GvPayReceiveMaster.DataSource = Dv.ToTable();
            GvPayReceiveMaster.DataBind();
        }
        protected void BtnSAVE_Click(object sender, EventArgs e)
        {
            try
            {
                #region UPDATE BANK RECONCILIATION DATA
                int flgsave = 0;
                foreach (GridViewRow row in GvPayReceiveMaster.Rows)
                {
                    if (row.RowType == DataControlRowType.DataRow)
                    {
                        HiddenField HfCompCodeGrid = (HiddenField)row.Cells[0].FindControl("HfCompCodeGrid");
                        HiddenField HfTranDateGrid = (HiddenField)row.Cells[0].FindControl("HfTranDateGrid");
                        HiddenField HfTranNoGrid   = (HiddenField)row.Cells[0].FindControl("HfTranNoGrid");
                        HiddenField HfSrNoGrid     = (HiddenField)row.Cells[0].FindControl("HfSrNoGrid");

                        TextBox TxtBankDate       = (TextBox)row.Cells[9].FindControl("TxtBankDate");
                        TextBox TxtBankRecoRemark = (TextBox)row.Cells[10].FindControl("TxtBankRecoRemark");

                        HiddenField HfUnsavedGrid = (HiddenField)row.Cells[0].FindControl("HfUnsaved");

                        PAY_REC_TLogicLayer insert = new PAY_REC_TLogicLayer();

                        insert.BANKDT     = Convert.ToDateTime(TxtBankDate.Text.Trim().ToString()).ToString("MM-dd-yyyy");
                        insert.BANK_NARRN = TxtBankRecoRemark.Text.Trim().ToUpper().ToString();

                        if (HfUnsavedGrid.Value == "1")
                        {
                            string str = PAY_REC_MLogicLayer.UpdatePAY_REC_TDetailForBANK_RECO(HfCompCodeGrid.Value.Trim().ToString(), HfTranNoGrid.Value.Trim().ToString(), Convert.ToDateTime(HfTranDateGrid.Value.Trim().ToString()), HfSrNoGrid.Value.Trim().ToString(), Convert.ToDateTime(TxtBankDate.Text.Trim().ToString()), TxtBankRecoRemark.Text.Trim().ToString());
                            if (str.Contains("successfully"))
                            {
                                flgsave = 1;
                            }
                        }
                    }
                }
                FillPAY_REC_MasterGrid(Session["COMP_CODE"].ToString());



                if (flgsave == 1)
                {
                    lblmsg.Text      = "BANK RECONCILIATION UPDATE SUCCESSFULLY.";
                    lblmsg.ForeColor = Color.Green;
                    FillPAY_REC_MasterGrid(Session["COMP_CODE"].ToString());
                }
                //else if (str.Contains("Already") || str.Contains("PRIMARY KEY"))
                //{
                //    lblmsg.Text = "BANK RECONCILIATION ALREADY EXIST.";
                //    lblmsg.ForeColor = Color.Red;
                //}
                else
                {
                    lblmsg.Text      = "ERROR : BANK RECONCILIATION NOT SAVED";
                    lblmsg.ForeColor = Color.Red;
                }

                #endregion
            }
            catch (Exception)
            {
                throw;
            }
        }