Esempio n. 1
0
 protected void ImgBtnExport_Click(object sender, ImageClickEventArgs e)
 {
     if (ViewState["Summary"] != null)
     {
         DataTable DtGrd    = (DataTable)ViewState["Summary"];
         string    PURINVNO = string.Empty;
         if (DtGrd.Rows.Count > 0)
         {
             GridView GridExp = new GridView();
             GridExp.DataSource = DtGrd;
             GridExp.DataBind();
             Obj_Comm.Export("ListOfReceipts.xls", GridExp);
         }
         else
         {
             Obj_Comm.ShowPopUpMsg("No Data Found To Export..!", this.Page);
             GridReceiptList.DataSource = null;
             GridReceiptList.DataBind();
         }
     }
     else
     {
         Obj_Comm.ShowPopUpMsg("No Data Found To Export..!", this.Page);
         SetInitialRow();
     }
 }
Esempio n. 2
0
 protected void BtnShow_Click(object sender, EventArgs e)
 {
     try
     {
         ReportGrid();
         GridReceiptList.Focus();
     }
     catch (Exception ex)
     {
         Obj_Comm.ShowPopUpMsg(ex.Message, this.Page);
     }
 }
Esempio n. 3
0
    public void SetInitialRow()
    {
        try
        {
            DataTable dt = new DataTable();
            DataRow   dr = null;
            dt.Columns.Add(new DataColumn("Property", typeof(string)));
            dt.Columns.Add(new DataColumn("PartyName", typeof(string)));
            dt.Columns.Add(new DataColumn("UnitNo", typeof(string)));
            dt.Columns.Add(new DataColumn("CompanyName", typeof(string)));
            dt.Columns.Add(new DataColumn("ReceiptNo", typeof(string)));
            dt.Columns.Add(new DataColumn("ReceiptDate", typeof(string)));
            dt.Columns.Add(new DataColumn("VoucherAmt", typeof(decimal)));
            dt.Columns.Add(new DataColumn("#", typeof(int)));
            dt.Columns.Add(new DataColumn("ForTheMonth", typeof(string)));
            dr = dt.NewRow();

            dr["#"]           = 0;
            dr["Property"]    = "";
            dr["PartyName"]   = "";
            dr["UnitNo"]      = "";
            dr["CompanyName"] = "";
            dr["ReceiptNo"]   = "";
            dr["ReceiptDate"] = "";
            dr["VoucherAmt"]  = 0;
            dr["ForTheMonth"] = "";

            dt.Rows.Add(dr);
            ViewState["Summary"]       = dt;
            GridReceiptList.DataSource = dt;
            GridReceiptList.DataBind();
            dt = null;
            dr = null;
        }
        catch (Exception ex)
        {
            throw new Exception(ex.Message);
        }
    }
Esempio n. 4
0
    private void ReportGrid()
    {
        try
        {
            StrCondition = string.Empty;

            if (ChkFrmDate.Checked == true)
            {
                StrCondition = StrCondition + " and RV.ReceiptDate between '" + Convert.ToDateTime(txtFromDate.Text).ToString("MM-dd-yyyy") + "' AND '" + Convert.ToDateTime(txtToDate.Text).ToString("MM-dd-yyyy") + "' ";
            }
            if (Convert.ToInt32(ddlProperty.SelectedValue) > 0)
            {
                StrCondition = StrCondition + " and RV.PropertyId='" + (ddlProperty.SelectedValue) + "' ";
            }
            if (!string.IsNullOrEmpty(ddlParty.Text) && Convert.ToInt32(ddlParty.SelectedValue) > 0)
            {
                StrCondition = StrCondition + " and RV.PartyId='" + (ddlParty.SelectedValue) + "' ";
            }
            if (!string.IsNullOrEmpty(ddlCompany.Text) && Convert.ToInt32(ddlCompany.SelectedValue) > 0)
            {
                StrCondition = StrCondition + " and PM.CompanyId='" + (ddlCompany.SelectedValue) + "' ";
            }
            if (!string.IsNullOrEmpty(txtUnitNo.Text))
            {
                StrCondition = StrCondition + " RV.UnitNo='" + (txtUnitNo.Text) + "' ";
            }


            DS = Obj_Receipt.GetReceiptMaster(StrCondition, out StrError);
            if (DS.Tables.Count > 0 && DS.Tables[0].Rows.Count > 0)
            {
                ViewState["Summary"]       = DS.Tables[0];
                GridReceiptList.DataSource = DS.Tables[0];
                GridReceiptList.DataBind();

                if (!FlagPrint)
                {
                    ImgBtnPrint.Visible  = false;
                    ImgBtnExport.Visible = true;
                    ImgPDF.Visible       = true;
                }
                lblCount.Text    = DS.Tables[0].Rows.Count + " Records Found";
                lblCount.Visible = true;
                dsExport         = DS.Copy();
            }
            else
            {
                GridReceiptList.DataSource = null;
                GridReceiptList.DataBind();
                lblCount.Text    = "No Records Found!!";
                lblCount.Visible = true;
                SetInitialRow();

                ImgBtnPrint.Visible  = false;
                ImgBtnExport.Visible = false;
                ImgPDF.Visible       = false;
            }
        }
        catch (Exception ex)
        {
            Obj_Comm.ShowPopUpMsg(ex.Message, this.Page);
        }
    }