コード例 #1
0
        private void BindMaxNo(Int32 FromCityIdno, Int32 YearId)
        {
            PaymentToOwnDAL obj   = new PaymentToOwnDAL();
            Int64           MaxNo = obj.MaxNo(YearId, FromCityIdno, ApplicationFunction.ConnectionString());

            txtRcptNo.Text = Convert.ToString(MaxNo);
        }
コード例 #2
0
        protected void grdMain_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string strMsg = string.Empty;

            if (e.CommandName == "cmdedit")
            {
                Response.Redirect("PaymentToOwn.aspx?q=" + e.CommandArgument, true);
            }
            if (e.CommandName == "cmddelete")
            {
                Int64           UserIdno = Convert.ToInt64(Session["UserIdno"]);
                PaymentToOwnDAL obj      = new PaymentToOwnDAL();
                Int32           intValue = obj.Delete(Convert.ToInt32(e.CommandArgument), UserIdno, ApplicationFunction.ConnectionString());
                obj = null;
                if (intValue > 0)
                {
                    this.BindGrid();
                    strMsg = "Record deleted successfully.";
                    txtRcptNo.Focus();
                }
                else
                {
                    if (intValue == -1)
                    {
                        strMsg = "Record can not be deleted. It is in use.";
                    }
                    else
                    {
                        strMsg = "Record not deleted.";
                    }
                }
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alertstrMsg", "PassMessage('" + strMsg + "')", true);
            }
        }
コード例 #3
0
        public void userpref()
        {
            PaymentToOwnDAL obj      = new PaymentToOwnDAL();
            tblUserPref     userpref = obj.selectuserpref();

            iFromCity = Convert.ToInt32(userpref.BaseCity_Idno);
        }
コード例 #4
0
        private void GetReceiptNo()
        {
            PaymentToOwnDAL obj = new PaymentToOwnDAL();
            Int64           max = obj.GetMaxNo();

            obj            = null;
            txtRcptNo.Text = Convert.ToInt64(max) <= 0 ? "1" : Convert.ToString(max);
        }
コード例 #5
0
        private void BindCustBank()
        {
            PaymentToOwnDAL obj = new PaymentToOwnDAL();

            ddlCustmerBank.DataSource     = obj.BindBank();
            ddlCustmerBank.DataTextField  = "Acnt_Name";
            ddlCustmerBank.DataValueField = "Acnt_Idno";
            ddlCustmerBank.DataBind();
            ddlCustmerBank.Items.Insert(0, new System.Web.UI.WebControls.ListItem("--Select--", "0"));
        }
コード例 #6
0
        public void Countall()
        {
            PaymentToOwnDAL obj   = new PaymentToOwnDAL();
            Int64           count = obj.Countall();

            if (count > 0)
            {
                lblTotalRecord.Text = "T. Record (s):" + count;
            }
        }
コード例 #7
0
        private void BindReceiptType()
        {
            PaymentToOwnDAL obj      = new PaymentToOwnDAL();
            var             RcptType = obj.BindRcptType(ApplicationFunction.ConnectionString());

            ddlRcptTyp.DataSource     = RcptType;
            ddlRcptTyp.DataTextField  = "ACNT_NAME";
            ddlRcptTyp.DataValueField = "Acnt_Idno";
            ddlRcptTyp.DataBind();
            ddlRcptTyp.Items.Insert(0, new System.Web.UI.WebControls.ListItem("--Select--", "0"));
        }
コード例 #8
0
        private void Populate(Int64 HeadId)
        {
            PaymentToOwnDAL obj        = new PaymentToOwnDAL();
            tblPayToOwnAcc  AmntGrhead = obj.selectHead(HeadId);

            ddldateRange.SelectedValue = Convert.ToString(AmntGrhead.Year_IdNo);
            ddldateRange_SelectedIndexChanged(null, null);
            ddldateRange.Enabled = false;
            txtRcptNo.Text       = Convert.ToString(AmntGrhead.Rcpt_No);
            txtRcptNo.Visible    = true; ddlFromCity.SelectedValue = Convert.ToString(AmntGrhead.BaseCity_Idno); BindPartName();
            txtDate.Text         = Convert.ToDateTime(AmntGrhead.Rcpt_date).ToString("dd-MM-yyyy");
            //ddlDriverName.SelectedValue = Convert.ToString(AmntGrhead.Party_IdNo);
            ddlRcptTyp.SelectedValue = Convert.ToString(AmntGrhead.RcptType_Idno);
            ddlRcptType_SelectedIndexChanged(null, null);
            ddlChallan.SelectedValue = Convert.ToString(AmntGrhead.Chln_IdNo);
            ddlChallan_SelectedIndexChanged(null, null);
            ddlCustmerBank.SelectedValue = Convert.ToString(AmntGrhead.Bank_Idno);
            txtInstNo.Text   = Convert.ToString(AmntGrhead.Inst_No);
            txtInstDate.Text = (Convert.ToString(AmntGrhead.Inst_Dt) == "") ? "" : Convert.ToDateTime(AmntGrhead.Inst_Dt).ToString("dd-MM-yyyy");
            TxtRemark.Text   = Convert.ToString(AmntGrhead.Remark);
            txtAmount.Text   = Convert.ToString(AmntGrhead.Amnt);

            ViewState["dt"] = DtTemp;


            //For Daulat Print
            string strChlnIdno = string.Empty;

            for (int j = 0; j <= DtTemp.Rows.Count - 1; j++)
            {
                strChlnIdno = strChlnIdno + DtTemp.Rows[j]["Chln_Idno"].ToString() + ",";
            }
            if (strChlnIdno != "")
            {
                strChlnIdno = strChlnIdno.Substring(0, strChlnIdno.Length - 1);
            }

            //Int64 ChlnIdno = obj.GetChlnIdno(HeadId);
            if (Convert.ToString(hidPrintType.Value) != "")
            {
                if (Convert.ToInt32(hidPrintType.Value) == 2)
                {
                    if (strChlnIdno != "")
                    {
                        PrintChlnDetails(strChlnIdno);
                    }
                }
            }
            obj = null;
        }
コード例 #9
0
        private void BindPartName()
        {
            PaymentToOwnDAL obj = new PaymentToOwnDAL();
            DataTable       lst = obj.FetchChallanDetail(ApplicationFunction.ConnectionString(), Convert.ToInt32(ddldateRange.SelectedValue), Convert.ToInt32(ddlFromCity.SelectedValue));

            if (lst.Rows.Count > 0)
            {
                ddlChallan.DataSource     = lst;
                ddlChallan.DataTextField  = "chln_Detl";
                ddlChallan.DataValueField = "Chln_Idno";
                ddlChallan.DataBind();
                ddlChallan.Items.Insert(0, new System.Web.UI.WebControls.ListItem("--Select--", "0"));
            }
        }
コード例 #10
0
        private void GridChlnDetails(int ChlnIdno)
        {
            PaymentToOwnDAL obj = new PaymentToOwnDAL();
            var             lst = obj.SearchDetails(ChlnIdno);

            if (lst.Count > 0)
            {
                grdMain.DataSource = lst;
                grdMain.DataBind();
            }
            else
            {
                grdMain.DataSource = null;
                grdMain.DataBind();
            }
        }
コード例 #11
0
 protected void ddlRcptType_SelectedIndexChanged(object sender, EventArgs e)
 {
     txtInstNo.Text      = ""; rfvinstDate.Enabled = false; rfvinstno.Enabled = false; //rfvCusBank.Enabled = false; // lokesh, its remove b/c its not required
     txtInstNo.Enabled   = false;
     txtInstDate.Enabled = false; ddlCustmerBank.Enabled = false;
     if (ddlRcptTyp.SelectedIndex > 0)
     {
         PaymentToOwnDAL obj = new PaymentToOwnDAL();
         DataTable       dt  = obj.BindRcptTypeDel(Convert.ToInt32((ddlRcptTyp.SelectedValue) == "" ? "0" : ddlRcptTyp.SelectedValue), ApplicationFunction.ConnectionString());
         if (dt != null && dt.Rows.Count > 0)
         {
             Int64 intAcnttype = Convert.ToInt64(dt.Rows[0]["ACNT_TYPE"]);
             if (intAcnttype == 4)
             {
                 txtInstNo.Enabled      = true;
                 txtInstDate.Enabled    = true;
                 ddlCustmerBank.Enabled = true;
                 rfvinstDate.Enabled    = true; rfvinstno.Enabled = true; //rfvCusBank.Enabled = true;
             }
         }
     }
 }
コード例 #12
0
        private bool PostIntoAccounts(double Amount, Int64 intDocIdno, string strDocType, double dblRndOff, Int32 intCompIdno, Int32 intUserIdno, Int32 intUserType, Int32 intVchrForIdno, Int32 YearIdno)
        {
            #region Variables Declaration...

            Int64 intVchrIdno = 0;
            Int64 intValue    = 0;
            hidpostingmsg.Value = string.Empty;
            clsAccountPosting objclsAccountPosting = new clsAccountPosting();
            double            dblNetAmnt           = 0;
            double            dblDiscAmnt          = 0;

            DateTime?dtPBillDate = null;
            DateTime?dtBankDate  = null;
            if (string.IsNullOrEmpty(txtInstDate.Text) == false)
            {
                dtBankDate = Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtInstDate.Text));
            }
            #endregion

            #region Account link Validations...

            //clsAccountPosting objclsAccountPosting = new clsAccountPosting();
            //   tblAcntLink objAcntLink = objclsAccountPosting.GetAccountLinkData();
            //    if (objAcntLink == null)
            //    {
            //       hidpostingmsg.Value = " Account link is not defined. Kindly define.";
            //    }
            //    else
            //    {

            //    }


            #endregion
            PaymentToOwnDAL obj       = new PaymentToOwnDAL();
            Int32           IAcntIdno = 0;
            // Int32 ILType = obj.selectTruckType(Convert.ToInt32(ddlTruckNo.SelectedValue)); //Convert.ToInt32(clsDataAccessFunction.ExecuteScaler("select Lorry_type from LorryMast where Lorry_Idno=" + Convert.ToInt32(cmbTruckNo.SelectedValue) + "", Tran, Program.DataConn));
            //if (ILType == 1)
            //{
            //IAcntIdno = Convert.ToInt32(ddlDriverName.SelectedValue);
            //}
            //else
            //{
            IAcntIdno = Convert.ToInt32((string.IsNullOrEmpty((hidDriverIdno.Value)) ? "0" : hidDriverIdno.Value));
            //}
            if (Request.QueryString["q"] == null)
            {
                intValue = 1;
            }
            else
            {
                intValue = objclsAccountPosting.DeleteAccountPosting(intDocIdno, strDocType);
            }
            if (intValue > 0)
            {
                //IAcntIdno = Convert.ToInt32(ddlDriverName.SelectedValue);
                IAcntIdno = 0;

                Int64 VchrNo = objclsAccountPosting.GetMaxVchrNo(2, 0, Convert.ToInt32(ddldateRange.SelectedValue));

                intValue = objclsAccountPosting.InsertInVchrHead(
                    Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtDate.Text.Trim())),
                    1,
                    Convert.ToInt32((ddlRcptTyp.SelectedIndex == -1) ? 0 : Convert.ToInt32(ddlRcptTyp.SelectedValue)),
                    "Receipt No :" + Convert.ToString(txtRcptNo.Text) + " Receipt Date: " + txtDate.Text.Trim() + "Total Paid Amount :" + Convert.ToDouble(txtAmount.Text.Trim().Replace("'", "")) + "",
                    true,
                    0,
                    strDocType,
                    IAcntIdno,
                    0,
                    0,
                    Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtDate.Text.Trim())),
                    ((VchrNo == 0) ? 1 : VchrNo),
                    0,
                    YearIdno,
                    0, 0);
                if (intValue > 0)
                {
                    intVchrIdno = intValue;
                    intValue    = 0; IAcntIdno = Convert.ToInt32((ddlRcptTyp.SelectedIndex == -1) ? 0 : Convert.ToInt32(ddlRcptTyp.SelectedValue));

                    intValue = objclsAccountPosting.InsertInVchrDetl(
                        intVchrIdno,
                        Convert.ToInt32((ddlRcptTyp.SelectedIndex == -1) ? 0 : Convert.ToInt32(ddlRcptTyp.SelectedValue)),
                        "Receipt No :" + Convert.ToString(txtRcptNo.Text) + " Receipt Date: " + txtDate.Text.Trim() + "Total Amount Paid :" + Convert.ToDouble(txtAmount.Text.Trim().Replace("'", "")) + "  ",
                        Amount,
                        Convert.ToByte(1),
                        Convert.ToByte(0),
                        Convert.ToString(txtInstNo.Text),
                        true,
                        dtBankDate,
                        Convert.ToString(ddlCustmerBank.SelectedValue), 0);

                    if (intValue > 0)
                    {
                        intVchrIdno = intValue;
                        intValue    = 0;
                        intValue    = objclsAccountPosting.InsertInVchrDetl(
                            intVchrIdno,
                            Convert.ToInt32(hidDriverIdno.Value),
                            "Receipt No :" + Convert.ToString(txtRcptNo.Text) + " Receipt Date: " + txtDate.Text.Trim() + "Total Paid Received :" + Convert.ToDouble(txtAmount.Text.Trim().Replace("'", "")) + "  ",
                            Amount,
                            Convert.ToByte(2),
                            Convert.ToByte(0),
                            Convert.ToString(txtInstNo.Text),
                            false,
                            dtBankDate,
                            Convert.ToString(ddlCustmerBank.SelectedValue), 0);
                    }
                    else
                    {
                        return(false);
                    }
                    #region VchrIdDetl Posting...

                    if (intValue > 0)
                    {
                        intValue = 0;
                        intValue = objclsAccountPosting.InsertInVchrIdDetl(intVchrIdno, intDocIdno, strDocType);
                        if (intValue == 0)
                        {
                            return(false);
                        }
                    }

                    #endregion
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }

            #region Deallocate variables...

            objclsAccountPosting = null;
            return(true);

            #endregion
        }
コード例 #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ScriptManager scriptManager = ScriptManager.GetCurrent(this.Page);

            scriptManager.RegisterPostBackControl(this.lnkbtnPrintClick);
            //con = ConfigurationManager.ConnectionStrings["TransportMandiConnectionString"].ConnectionString;
            if (Request.UrlReferrer == null)
            {
                base.AutoRedirect();
            }
            if (!Page.IsPostBack)
            {
                if (base.CheckUserRights(intFormId) == false)
                {
                    Response.Redirect("PermissionDenied.aspx");
                }
                if (base.ADD == false)
                {
                    lnkbtnSave.Visible = false;
                }
                if (base.View == false)
                {
                    lblViewList.Visible = false;
                }
                txtInstDate.Attributes.Add("onkeypress", "return notAllowAnything(event);");
                txtDate.Attributes.Add("onkeypress", "return notAllowAnything(event);");
                this.userpref(); this.BindDateRange();
                Int32 intYearIdno = Convert.ToInt32(Convert.ToString(ddldateRange.SelectedValue) == "" ? 0 : Convert.ToInt32(ddldateRange.SelectedValue));
                //  ddlFromCity.SelectedValue = Convert.ToString(iFromCity);

                this.BindReceiptType();
                if (Convert.ToString(Session["Userclass"]) == "Admin")
                {
                    this.BindCity();
                }
                else
                {
                    this.BindCity(Convert.ToInt64(Session["UserIdno"]));
                }
                ddlFromCity.SelectedValue  = Convert.ToString(base.UserFromCity);
                ddldateRange.SelectedValue = Convert.ToString(base.UserDateRng);
                this.BindMaxNo(Convert.ToInt32(Convert.ToString(ddlFromCity.SelectedValue) == "" ? 0 : Convert.ToInt32(ddlFromCity.SelectedValue)), Convert.ToInt32(Convert.ToString(ddldateRange.SelectedValue) == "" ? 0 : Convert.ToInt32(ddldateRange.SelectedValue)));
                this.BindCityANDLocation();
                this.BindPartName();
                this.BindCustBank();

                PaymentToOwnDAL objChlnPayDAL = new PaymentToOwnDAL();
                tblUserPref     obj           = objChlnPayDAL.selectuserpref();
                hidPrintType.Value         = Convert.ToString(obj.PayChln_Print);
                ddldateRange.SelectedIndex = 0;
                ddldateRange_SelectedIndexChanged(null, null);
                ddlRcptType_SelectedIndexChanged(null, null);
                if (Request.QueryString["q"] != null)
                {
                    Populate(Convert.ToInt64(Request.QueryString["q"])); GridChlnDetails(Convert.ToInt32(ddlChallan.SelectedValue));
                    hidid.Value       = Convert.ToString(Request.QueryString["q"]);
                    lnkbtnNew.Visible = true;
                    if ((string.IsNullOrEmpty(hidPrintType.Value) ? 0 : Convert.ToInt32(hidPrintType.Value)) == 1)
                    {
                        //lnkbtnPrintClick.Visible = true;
                        LinkButton1.Visible = false;
                    }
                    else
                    {
                        lnkbtnPrintClick.Visible = false;
                        //LinkButton1.Visible = true;
                    }
                }
                else
                {
                    lnkbtnPrintClick.Visible = false;
                    lnkbtnNew.Visible        = false;
                    LinkButton1.Visible      = false;
                }
                if (Request.QueryString["ChlnIdno"] != null)
                {
                    DirectPaymentFromGr(Convert.ToInt64(Request.QueryString["ChlnIdno"]));
                }
                ddldateRange.Focus();
            }
        }
コード例 #14
0
        protected void lnkbtnSave_OnClick(object sender, EventArgs e)
        {
            DtTemp = CreateDt();
            PaymentToOwnDAL obj    = new PaymentToOwnDAL();
            tblPayToOwnAcc  objRGH = new tblPayToOwnAcc();

            objRGH.Rcpt_No       = Convert.ToInt64(txtRcptNo.Text);
            objRGH.BaseCity_Idno = Convert.ToInt64(ddlFromCity.SelectedValue);
            objRGH.Rcpt_date     = Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtDate.Text));
            objRGH.Chln_IdNo     = Convert.ToInt64(ddlChallan.SelectedValue);
            objRGH.Driver_IdNo   = Convert.ToInt64(hidDriverIdno.Value);
            objRGH.Inst_No       = Convert.ToInt64(Convert.ToString(txtInstNo.Text) == "" ? 0 : Convert.ToInt64(txtInstNo.Text));
            objRGH.Date_Added    = System.DateTime.Now;
            objRGH.Date_Modified = null;
            objRGH.Bank_Idno     = Convert.ToInt32(ddlCustmerBank.SelectedValue);
            objRGH.RcptType_Idno = Convert.ToInt32(ddlRcptTyp.SelectedValue);
            objRGH.UserIdno      = Convert.ToInt64(Session["UserIdno"]);
            if (txtInstDate.Text == "")
            {
                objRGH.Inst_Dt = null;
            }
            else
            {
                objRGH.Inst_Dt = Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtInstDate.Text));
            }

            objRGH.Remark    = Convert.ToString(TxtRemark.Text);
            objRGH.Year_IdNo = Convert.ToInt32(ddldateRange.SelectedValue);
            objRGH.Amnt      = Convert.ToDouble(txtAmount.Text.Trim());
            Int64 value = 0;

            using (TransactionScope tScope = new TransactionScope(TransactionScopeOption.Required))
            {
                if (string.IsNullOrEmpty(hidid.Value) == true)
                {
                    value = obj.Insert(objRGH);
                }
                else
                {
                    value = obj.Update(objRGH, Convert.ToInt32((Convert.ToString(hidid.Value) == "" ? 0 : Convert.ToInt32(hidid.Value))));
                }
                if (value > 0)
                {
                    if (this.PostIntoAccounts(Convert.ToDouble(txtAmount.Text), value, "PTD", 0, 0, 0, 0, 0, Convert.ToInt32(ddldateRange.SelectedValue)) == true)
                    {
                        obj.UpdateIsPosting(value);
                        if ((string.IsNullOrEmpty(hidid.Value) == false))
                        {
                            if (value > 0 && (string.IsNullOrEmpty(hidid.Value) == false))
                            {
                                ShowMessage("Record Update successfully");
                                this.Clear();
                                ddlFromCity_SelectedIndexChanged(null, null);
                            }
                            else if (value == -1)
                            {
                                ShowMessageErr("Pay No. Already Exist");
                            }
                            else if (string.IsNullOrEmpty(hidid.Value) == false)
                            {
                                ShowMessageErr("Record  Not Update");
                            }
                        }
                        else
                        {
                            if (value > 0 && (string.IsNullOrEmpty(hidid.Value) == true))
                            {
                                ShowMessage("Record Saved successfully");
                                this.Clear();
                                ddlFromCity_SelectedIndexChanged(null, null);
                            }
                            else if (value == -1)
                            {
                                ShowMessageErr("Pay No. Already Exist");
                            }
                            else if ((string.IsNullOrEmpty(hidid.Value) == true))
                            {
                                ShowMessageErr("Record  Not Saved successfully");
                            }
                        }
                        tScope.Complete();
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(hidpostingmsg.Value) == true)
                        {
                            if (string.IsNullOrEmpty(Convert.ToString(hidid.Value)) == false)
                            {
                                hidpostingmsg.Value = "Record(s) not updated.";
                            }
                            else
                            {
                                hidpostingmsg.Value = "Record(s) not saved.";
                            }
                            tScope.Dispose();
                        }
                        tScope.Dispose();
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "hwa", "PassMessageError('" + Convert.ToString(hidpostingmsg.Value) + "')", true);
                        return;
                    }
                }
                else
                {
                    if (string.IsNullOrEmpty(Convert.ToString(hidid.Value)) == false)
                    {
                        hidpostingmsg.Value = "Record(s) not updated.";
                    }
                    else
                    {
                        hidpostingmsg.Value = "Record(s) not saved.";
                    }
                    tScope.Dispose();
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "hwa", "PassMessageError('" + Convert.ToString(hidid.Value) + "')", true);
                    return;
                }
            }

            this.BindMaxNo(Convert.ToInt32(Convert.ToString(ddlFromCity.SelectedValue) == "" ? 0 : Convert.ToInt32(ddlFromCity.SelectedValue)), Convert.ToInt32(Convert.ToString(ddldateRange.SelectedValue) == "" ? 0 : Convert.ToInt32(ddldateRange.SelectedValue)));
        }
コード例 #15
0
        private void BindGrid()
        {
            PaymentToOwnDAL obj       = new PaymentToOwnDAL();
            DateTime?       dtfrom    = null;
            DateTime?       dtto      = null;
            Int64           InvoiceNo = Convert.ToInt64(Convert.ToString(txtRcptNo.Text) == "" ? 0 : Convert.ToInt64(txtRcptNo.Text));

            if (string.IsNullOrEmpty(Convert.ToString(txtGrDatefrom.Text)) == false)
            {
                dtfrom = Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtGrDatefrom.Text));
            }
            if (string.IsNullOrEmpty(Convert.ToString(txtGrDatefrom.Text)) == false)
            {
                dtto = Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtGrDateto.Text));
            }

            var lstGridData = obj.search(Convert.ToInt32(ddldateRange.SelectedValue), InvoiceNo, dtfrom, dtto, Convert.ToInt32(drpCityFrom.SelectedValue));

            obj = null;
            if (lstGridData != null && lstGridData.Count > 0)
            {
                DataTable dt = new DataTable();
                dt.Columns.Add("SrNo", typeof(string));
                dt.Columns.Add("Payment No", typeof(string));
                dt.Columns.Add("Date", typeof(string));
                dt.Columns.Add("Party Name", typeof(string));
                dt.Columns.Add("From City", typeof(string));
                dt.Columns.Add("Net Amount", typeof(string));
                double TNet = 0;
                for (int i = 0; i < lstGridData.Count; i++)
                {
                    DataRow dr = dt.NewRow();
                    dr["SrNo"]       = Convert.ToString(i + 1);
                    dr["Payment No"] = Convert.ToString(DataBinder.Eval(lstGridData[i], "Rcpt_No"));
                    dr["Date"]       = Convert.ToDateTime(DataBinder.Eval(lstGridData[i], "Rcpt_date")).ToString("dd-MM-yyyy");
                    dr["Party Name"] = Convert.ToString(DataBinder.Eval(lstGridData[i], "Acnt_Name"));
                    dr["From City"]  = Convert.ToString(DataBinder.Eval(lstGridData[i], "FromCity"));
                    dr["Net Amount"] = Convert.ToString(DataBinder.Eval(lstGridData[i], "Amnt"));
                    dt.Rows.Add(dr);
                    TNet += Convert.ToDouble(DataBinder.Eval(lstGridData[i], "Amnt"));
                    if (i == lstGridData.Count - 1)
                    {
                        DataRow drr = dt.NewRow();
                        drr["From City"]  = "Total";
                        drr["Net Amount"] = (TNet).ToString("N2");
                        dt.Rows.Add(drr);
                    }
                }
                if (dt != null && dt.Rows.Count > 0)
                {
                    ViewState["Dt"] = dt;
                }


                //
                grdMain.DataSource = lstGridData;
                grdMain.DataBind();
                lblTotalRecord.Text = "T. Record (s): " + lstGridData.Count;

                Double TotalNetAmount = 0;

                for (int i = 0; i < lstGridData.Count; i++)
                {
                    TotalNetAmount += Convert.ToDouble(DataBinder.Eval(lstGridData[i], "Amnt"));
                }
                lblNetTotalAmount.Text = TotalNetAmount.ToString("N2");

                int startRowOnPage = (grdMain.PageIndex * grdMain.PageSize) + 1;
                int lastRowOnPage  = startRowOnPage + grdMain.Rows.Count - 1;
                lblcontant.Text    = "Showing " + startRowOnPage.ToString() + " - " + lastRowOnPage.ToString() + " of " + lstGridData.Count.ToString();
                lblcontant.Visible = true;
                divpaging.Visible  = true;

                imgBtnExcel.Visible = true;
            }
            else
            {
                grdMain.DataSource = null;
                grdMain.DataBind();
                lblTotalRecord.Text = "T. Record (s): 0 ";
                lblcontant.Visible  = false;
                divpaging.Visible   = false;
                imgBtnExcel.Visible = false;
            }
        }