protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["collegecode"] == null)
     {
         Response.Redirect("~/Default.aspx");
     }
     usercode     = Session["usercode"].ToString();
     collegecode1 = Session["collegecode"].ToString();
     singleuser   = Session["single_user"].ToString();
     group_user   = Session["group_code"].ToString();
     if (!IsPostBack)
     {
         Bindcollege();
         collegecode = ddlcollege.SelectedValue.ToString();
         BindBatch();
         BindDegree(singleuser, group_user, collegecode, usercode);
         BindBranchMultiple(singleuser, group_user, course_id, collegecode, usercode);
         FarPoint.Web.Spread.StyleInfo MyStyle = new FarPoint.Web.Spread.StyleInfo();
         MyStyle.Font.Bold       = true;
         MyStyle.Font.Size       = FontUnit.Medium;
         MyStyle.HorizontalAlign = HorizontalAlign.Center;
         MyStyle.ForeColor       = Color.Black;
         MyStyle.BackColor       = ColorTranslator.FromHtml("#0CA6CA");
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["collegecode"] == null) //Aruna For Back Button
        {
            Response.Redirect("~/Default.aspx");
        }
        usercode    = Session["usercode"].ToString();
        collegecode = Session["collegecode"].ToString();
        singleuser  = Session["single_user"].ToString();
        group_user  = Session["group_code"].ToString();

        if (!IsPostBack)
        {
            FpSpread1.Width = 1000;
            FpSpread1.Sheets[0].AutoPostBack = true;
            FpSpread1.CommandBar.Visible     = true;
            FpSpread1.Sheets[0].SheetName    = " ";
            FpSpread1.Sheets[0].SheetCorner.Columns[0].Visible = false;
            FpSpread1.Sheets[0].Columns.Default.VerticalAlign  = VerticalAlign.Middle;
            FpSpread1.Sheets[0].Rows.Default.HorizontalAlign   = HorizontalAlign.Left;
            FpSpread1.Sheets[0].Rows.Default.VerticalAlign     = VerticalAlign.Middle;
            FpSpread1.Sheets[0].DefaultStyle.Font.Name         = "Book Antiqua";
            FpSpread1.Sheets[0].DefaultStyle.Font.Size         = FontUnit.Medium;
            FpSpread1.Sheets[0].DefaultStyle.Font.Bold         = false;

            FarPoint.Web.Spread.StyleInfo style1 = new FarPoint.Web.Spread.StyleInfo();
            style1.Font.Size       = 12;
            style1.Font.Bold       = true;
            style1.HorizontalAlign = HorizontalAlign.Center;
            style1.ForeColor       = System.Drawing.Color.Black;
            FpSpread1.Sheets[0].SheetCornerStyle          = new FarPoint.Web.Spread.StyleInfo(style1);
            FpSpread1.Sheets[0].ColumnHeader.DefaultStyle = new FarPoint.Web.Spread.StyleInfo(style1);
            FpSpread1.Sheets[0].ColumnHeader.DefaultStyle.HorizontalAlign = HorizontalAlign.Center;
            FpSpread1.Sheets[0].AllowTableCorner = true;

            //---------------page number

            FpSpread1.Pager.Position  = FarPoint.Web.Spread.PagerPosition.Bottom;
            FpSpread1.Pager.Mode      = FarPoint.Web.Spread.PagerMode.Both;
            FpSpread1.Pager.Align     = HorizontalAlign.Right;
            FpSpread1.Pager.Font.Bold = true;
            FpSpread1.Pager.Font.Name = "Book Antiqua";
            FpSpread1.Pager.ForeColor = System.Drawing.Color.DarkGreen;
            FpSpread1.Pager.BackColor = System.Drawing.Color.Beige;
            FpSpread1.Pager.BackColor = System.Drawing.Color.AliceBlue;
            FpSpread1.Pager.PageCount = 100;

            FpSpread1.Visible = false;
            btnxl.Visible     = false;
            Button1.Visible   = false;
            LabelE.Visible    = false;
            lblnorec.Visible  = false;
            errmsg.Visible    = false;
            BindBatch();
            BindDegree(singleuser, group_user, collegecode, usercode);
            BindBranchMultiple(singleuser, group_user, course_id, collegecode, usercode);
            BindSectionDetailmult(collegecode);
            Bindmultiseme(collegecode);
        }
    }
Ejemplo n.º 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["collegecode"] == null)
     {
         Response.Redirect("~/Default.aspx");
     }
     if (!IsPostBack)
     {
         rbplainsheet.Checked  = true;
         chkfootersign.Checked = true;
         chk_terms.Checked     = true;
         loadprintdetails();
         loadtermssp();
         loadtermssp2();
         showterms();
         showstaffdesc();
         txtstaff.Attributes.Add("Readonly", "Readonly");
         FarPoint.Web.Spread.StyleInfo darkstyle = new FarPoint.Web.Spread.StyleInfo();
         darkstyle.BackColor = ColorTranslator.FromHtml("#0CA6CA");
         darkstyle.ForeColor = System.Drawing.Color.White;
         // darkstyle.Font.Name = "Book Antiqua";
         darkstyle.Font.Size          = FontUnit.Medium;
         darkstyle.Border.BorderSize  = 1;
         darkstyle.Border.BorderColor = System.Drawing.Color.White;
         fsstaff.ActiveSheetView.ColumnHeader.DefaultStyle = darkstyle;
         retrive();
     }
 }
Ejemplo n.º 4
0
    private void loadsprcolumns()
    {
        try
        {
            FpSpread.Sheets[0].RowCount              = 0;
            FpSpread.Sheets[0].ColumnCount           = 5;
            FpSpread.CommandBar.Visible              = false;
            FpSpread.RowHeader.Visible               = false;
            FpSpread.Sheets[0].AutoPostBack          = false;
            FpSpread.Sheets[0].ColumnHeader.RowCount = 1;

            FarPoint.Web.Spread.TextCellType textcell  = new FarPoint.Web.Spread.TextCellType();
            FarPoint.Web.Spread.StyleInfo    darkstyle = new FarPoint.Web.Spread.StyleInfo();
            darkstyle.BackColor = ColorTranslator.FromHtml("#0CA6CA");
            darkstyle.ForeColor = Color.Black;
            FpSpread.ActiveSheetView.ColumnHeader.DefaultStyle = darkstyle;

            FpSpread.Sheets[0].ColumnHeader.Cells[0, 0].Text            = "S.No";
            FpSpread.Sheets[0].ColumnHeader.Cells[0, 0].Font.Bold       = true;
            FpSpread.Sheets[0].ColumnHeader.Cells[0, 0].HorizontalAlign = HorizontalAlign.Center;
            FpSpread.Sheets[0].ColumnHeader.Cells[0, 0].Font.Name       = "Book Antiqua";
            FpSpread.Sheets[0].ColumnHeader.Cells[0, 0].Font.Size       = FontUnit.Medium;
            FpSpread.Columns[0].Locked = true;
            FpSpread.Columns[0].Width  = 50;

            FpSpread.Sheets[0].ColumnHeader.Cells[0, 1].Text            = "Staff Code";
            FpSpread.Sheets[0].ColumnHeader.Cells[0, 1].Font.Bold       = true;
            FpSpread.Sheets[0].ColumnHeader.Cells[0, 1].HorizontalAlign = HorizontalAlign.Center;
            FpSpread.Sheets[0].ColumnHeader.Cells[0, 1].Font.Name       = "Book Antiqua";
            FpSpread.Sheets[0].ColumnHeader.Cells[0, 1].Font.Size       = FontUnit.Medium;
            FpSpread.Columns[1].Locked = true;
            FpSpread.Columns[1].Width  = 150;

            FpSpread.Sheets[0].ColumnHeader.Cells[0, 2].Text            = "Staff Name";
            FpSpread.Sheets[0].ColumnHeader.Cells[0, 2].Font.Bold       = true;
            FpSpread.Sheets[0].ColumnHeader.Cells[0, 2].HorizontalAlign = HorizontalAlign.Center;
            FpSpread.Sheets[0].ColumnHeader.Cells[0, 2].Font.Name       = "Book Antiqua";
            FpSpread.Sheets[0].ColumnHeader.Cells[0, 2].Font.Size       = FontUnit.Medium;
            FpSpread.Columns[2].Locked = true;
            FpSpread.Columns[2].Width  = 300;

            FpSpread.Sheets[0].ColumnHeader.Cells[0, 3].Text            = "Device ID";
            FpSpread.Sheets[0].ColumnHeader.Cells[0, 3].Font.Bold       = true;
            FpSpread.Sheets[0].ColumnHeader.Cells[0, 3].HorizontalAlign = HorizontalAlign.Center;
            FpSpread.Sheets[0].ColumnHeader.Cells[0, 3].Font.Name       = "Book Antiqua";
            FpSpread.Sheets[0].ColumnHeader.Cells[0, 3].Font.Size       = FontUnit.Medium;
            FpSpread.Columns[3].Locked = true;
            FpSpread.Columns[3].Width  = 150;

            FpSpread.Sheets[0].ColumnHeader.Cells[0, 4].Text            = "Finger ID";
            FpSpread.Sheets[0].ColumnHeader.Cells[0, 4].CellType        = textcell;
            FpSpread.Sheets[0].ColumnHeader.Cells[0, 4].Font.Bold       = true;
            FpSpread.Sheets[0].ColumnHeader.Cells[0, 4].HorizontalAlign = HorizontalAlign.Center;
            FpSpread.Sheets[0].ColumnHeader.Cells[0, 4].Font.Name       = "Book Antiqua";
            FpSpread.Sheets[0].ColumnHeader.Cells[0, 4].Font.Size       = FontUnit.Medium;
            FpSpread.Columns[4].Locked = true;
            FpSpread.Columns[4].Width  = 150;
        }
        catch { }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["collegecode"] == null) //Aruna For Back Button
        {
            Response.Redirect("~/Default.aspx");
        }
        usercode    = Session["usercode"].ToString();
        collegecode = Session["collegecode"].ToString();
        singleuser  = Session["single_user"].ToString();
        group_user  = Session["group_code"].ToString();

        if (!IsPostBack)
        {
            setLabelText();
            Fpstudenttransport.Width = 1000;
            Fpstudenttransport.Sheets[0].AutoPostBack = true;
            Fpstudenttransport.CommandBar.Visible     = true;
            Fpstudenttransport.Sheets[0].SheetName    = " ";
            Fpstudenttransport.Sheets[0].SheetCorner.Columns[0].Visible = false;
            Fpstudenttransport.Sheets[0].Columns.Default.VerticalAlign  = VerticalAlign.Middle;
            Fpstudenttransport.Sheets[0].Rows.Default.HorizontalAlign   = HorizontalAlign.Left;
            Fpstudenttransport.Sheets[0].Rows.Default.VerticalAlign     = VerticalAlign.Middle;
            Fpstudenttransport.Sheets[0].DefaultStyle.Font.Name         = "Book Antiqua";
            Fpstudenttransport.Sheets[0].DefaultStyle.Font.Size         = FontUnit.Medium;
            Fpstudenttransport.Sheets[0].DefaultStyle.Font.Bold         = false;

            FarPoint.Web.Spread.StyleInfo style1 = new FarPoint.Web.Spread.StyleInfo();
            style1.Font.Size       = 12;
            style1.Font.Bold       = true;
            style1.HorizontalAlign = HorizontalAlign.Center;
            style1.ForeColor       = System.Drawing.Color.Black;
            Fpstudenttransport.Sheets[0].SheetCornerStyle          = new FarPoint.Web.Spread.StyleInfo(style1);
            Fpstudenttransport.Sheets[0].ColumnHeader.DefaultStyle = new FarPoint.Web.Spread.StyleInfo(style1);
            Fpstudenttransport.Sheets[0].ColumnHeader.DefaultStyle.HorizontalAlign = HorizontalAlign.Center;
            Fpstudenttransport.Sheets[0].AllowTableCorner = true;


            Fpstudenttransport.Visible = false;
            //btnxl.Visible = false;
            //btnprintmaster.Visible = false;
            LabelE.Visible   = false;
            lblnorec.Visible = false;
            errmsg.Visible   = false;



            BindBatch();
            BindDegree(singleuser, group_user, collegecode, usercode);
            BindBranch(singleuser, group_user, course_id, collegecode, usercode);
            BindSectransport(strbatch, strbranch);
            BindSectionDetail(strbatch, strbranch);
            // BindBranchMultiple(singleuser, group_user, course_id, collegecode, usercode);
        }
    }
Ejemplo n.º 6
0
    public void bindspread()
    {
        FpExternal.Sheets[0].ColumnCount           = 10;
        FpExternal.Sheets[0].AutoPostBack          = true;
        FpExternal.Sheets[0].ColumnHeader.RowCount = 2;
        FpExternal.Sheets[0].RowCount = 0;
        FpExternal.ActiveSheetView.ColumnHeader.DefaultStyle.Font.Size = FontUnit.Medium;
        FpExternal.ActiveSheetView.ColumnHeader.DefaultStyle.Font.Name = "Book Antiqua";
        FpExternal.ActiveSheetView.ColumnHeader.DefaultStyle.Font.Bold = true;
        FpExternal.VerticalScrollBarPolicy                 = FarPoint.Web.Spread.ScrollBarPolicy.AsNeeded;
        FpExternal.HorizontalScrollBarPolicy               = FarPoint.Web.Spread.ScrollBarPolicy.AsNeeded;
        FpExternal.Sheets[0].DefaultStyle.Font.Name        = "Book Antiqua";
        FpExternal.Sheets[0].DefaultStyle.Font.Bold        = false;
        FpExternal.Sheets[0].DefaultStyle.Font.Size        = FontUnit.Medium;
        FpExternal.Sheets[0].ColumnHeader.Cells[0, 0].Text = "S.No";
        FpExternal.Sheets[0].ColumnHeaderSpanModel.Add(0, 0, 2, 1);
        FpExternal.Sheets[0].ColumnHeader.Cells[0, 1].Text = "Sub Code";
        FpExternal.Sheets[0].ColumnHeaderSpanModel.Add(0, 1, 2, 1);
        FpExternal.Sheets[0].ColumnHeader.Cells[0, 2].Text = "Sub Name";
        FpExternal.Sheets[0].ColumnHeaderSpanModel.Add(0, 2, 2, 1);
        FpExternal.Sheets[0].ColumnHeader.Cells[0, 3].Text = "Staff Name";
        FpExternal.Sheets[0].ColumnHeaderSpanModel.Add(0, 3, 2, 1);
        FpExternal.Sheets[0].ColumnHeader.Cells[0, 4].Text = "Before Revaluation";

        FpExternal.Sheets[0].ColumnHeader.Cells[0, 7].Text = "After Revaluation";

        FpExternal.Sheets[0].ColumnHeaderSpanModel.Add(0, 4, 1, 3);
        FpExternal.Sheets[0].ColumnHeaderSpanModel.Add(0, 7, 1, 3);

        FpExternal.Sheets[0].ColumnHeader.Cells[1, 4].Text = "No Of Students Appear";
        FpExternal.Sheets[0].ColumnHeader.Cells[1, 5].Text = "No Of Students Passed";
        FpExternal.Sheets[0].ColumnHeader.Cells[1, 6].Text = "% Of Pass";
        FpExternal.Sheets[0].ColumnHeader.Cells[1, 7].Text = "No Of Students Appear";
        FpExternal.Sheets[0].ColumnHeader.Cells[1, 8].Text = "No Of Students Passed";
        FpExternal.Sheets[0].ColumnHeader.Cells[1, 9].Text = "% Of Pass";

        FarPoint.Web.Spread.StyleInfo style = new FarPoint.Web.Spread.StyleInfo();
        style.Font.Size = 11;
        style.Font.Name = "Book Antiqua";

        FpExternal.Sheets[0].DefaultStyle = new FarPoint.Web.Spread.StyleInfo(style);

        FpExternal.Sheets[0].RowHeader.Visible = false;
        FpExternal.Visible     = true;
        btnExcel.Visible       = true;
        txtexcelname.Visible   = true;
        lblrptname.Visible     = true;
        btnprintmaster.Visible = true;
    }
Ejemplo n.º 7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        lblerror.Visible = false;
        if (Session["collegecode"] == null)
        {
            Response.Redirect("~/Default.aspx");
        }
        collegecode = Session["collegecode"].ToString();

        if (!IsPostBack)
        {
            ss2 = "";
            p   = "";
            FarPoint.Web.Spread.StyleInfo style2 = new FarPoint.Web.Spread.StyleInfo();
            style2.Font.Size       = 13;
            style2.Font.Name       = "Trebuchet MS";
            style2.Font.Bold       = true;
            style2.HorizontalAlign = HorizontalAlign.Center;
            style2.ForeColor       = Color.White;
            style2.BackColor       = Color.Teal;

            FpSpread2.Sheets[0].ColumnHeader.DefaultStyle = new FarPoint.Web.Spread.StyleInfo(style2);

            style2 = new FarPoint.Web.Spread.StyleInfo();


            style2.VerticalAlign   = VerticalAlign.Middle;
            style2.HorizontalAlign = HorizontalAlign.Center;

            FpSpread2.Sheets[0].DefaultStyle = new FarPoint.Web.Spread.StyleInfo(style2);


            // ddlsubtype.Items.Add(new ListItem(""));


            bindbatch();
            binddegree();
            bindbranch();
            //bindsem();

            clear();



            clear();
        }
    }
Ejemplo n.º 8
0
    public void loadspreadHeader(DataSet ds)
    {
        try
        {
            Fpload1.Sheets[0].RowCount              = 0;
            Fpload1.Sheets[0].ColumnCount           = 4;
            Fpload1.CommandBar.Visible              = false;
            Fpload1.Sheets[0].AutoPostBack          = true;
            Fpload1.Sheets[0].ColumnHeader.RowCount = 1;
            Fpload1.Sheets[0].RowHeader.Visible     = false;
            FarPoint.Web.Spread.StyleInfo darkstyle = new FarPoint.Web.Spread.StyleInfo();
            darkstyle.BackColor = ColorTranslator.FromHtml("#0CA6CA");
            darkstyle.ForeColor = Color.Black;
            Fpload1.ActiveSheetView.ColumnHeader.DefaultStyle = darkstyle;
            darkstyle.Font.Name       = "Book Antiqua";
            darkstyle.Font.Size       = FontUnit.Medium;
            darkstyle.HorizontalAlign = HorizontalAlign.Center;
            darkstyle.VerticalAlign   = VerticalAlign.Middle;


            Fpload1.Sheets[0].ColumnHeader.Cells[0, 0].Text            = "SNo";
            Fpload1.Sheets[0].ColumnHeader.Cells[0, 0].HorizontalAlign = HorizontalAlign.Center;
            Fpload1.Sheets[0].ColumnHeader.Cells[0, 0].VerticalAlign   = VerticalAlign.Bottom;
            Fpload1.Sheets[0].ColumnHeader.Cells[0, 0].Locked          = true;
            Fpload1.Sheets[0].Columns[0].Width = 20;

            Fpload1.Sheets[0].ColumnHeader.Cells[0, 1].Text            = "Gym_Name";
            Fpload1.Sheets[0].ColumnHeader.Cells[0, 1].HorizontalAlign = HorizontalAlign.Center;
            Fpload1.Sheets[0].ColumnHeader.Cells[0, 1].VerticalAlign   = VerticalAlign.Bottom;
            Fpload1.Sheets[0].ColumnHeader.Cells[0, 1].Locked          = true;
            Fpload1.Sheets[0].Columns[1].Width = 10;


            Fpload1.Sheets[0].ColumnHeader.Cells[0, 2].Text            = "Gym_Acroynm";
            Fpload1.Sheets[0].ColumnHeader.Cells[0, 2].HorizontalAlign = HorizontalAlign.Center;
            Fpload1.Sheets[0].ColumnHeader.Cells[0, 2].VerticalAlign   = VerticalAlign.Bottom;
            Fpload1.Sheets[0].ColumnHeader.Cells[0, 2].Locked          = true;
            Fpload1.Sheets[0].Columns[2].Width = 50;

            Fpload1.Sheets[0].ColumnHeader.Cells[0, 3].Text            = "Gym_PK";
            Fpload1.Sheets[0].ColumnHeader.Cells[0, 3].HorizontalAlign = HorizontalAlign.Center;
            Fpload1.Sheets[0].ColumnHeader.Cells[0, 3].VerticalAlign   = VerticalAlign.Bottom;
            Fpload1.Sheets[0].ColumnHeader.Cells[0, 3].Locked          = true;
        }
        catch (Exception ex) {}
    }
    public void loadtermssp2()
    {
        FpSpread2.Sheets[0].RowHeader.Visible = false;

        FpSpread2.CommandBar.Visible = false;
        FpSpread2.Width  = 380;
        FpSpread2.Height = 150;
        FpSpread2.Sheets[0].ColumnCount                   = 4;
        FpSpread2.Sheets[0].ColumnHeader.RowCount         = 1;
        FpSpread2.Sheets[0].AutoPostBack                  = false;
        FpSpread2.Sheets[0].Columns[0].Locked             = true;
        FpSpread2.Sheets[0].Columns[1].Locked             = true;
        FpSpread2.Sheets[0].ColumnHeader.Cells[0, 0].Text = "S.No";
        FpSpread2.Sheets[0].ColumnHeader.Cells[0, 1].Text = "Staff";
        FpSpread2.Sheets[0].ColumnHeader.Cells[0, 2].Text = "Description";
        FpSpread2.Sheets[0].ColumnHeader.Cells[0, 3].Text = "Select";
        FpSpread2.Sheets[0].Columns[0].HorizontalAlign    = HorizontalAlign.Center;
        FpSpread2.Sheets[0].Columns[0].VerticalAlign      = VerticalAlign.Middle;
        FpSpread2.Sheets[0].Columns[1].HorizontalAlign    = HorizontalAlign.Left;
        FpSpread2.Sheets[0].Columns[1].VerticalAlign      = VerticalAlign.Middle;

        FpSpread2.Sheets[0].ColumnHeader.Columns[0].HorizontalAlign = HorizontalAlign.Center;
        FpSpread2.Sheets[0].ColumnHeader.Columns[0].VerticalAlign   = VerticalAlign.Middle;
        FpSpread2.Sheets[0].ColumnHeader.Columns[1].HorizontalAlign = HorizontalAlign.Center;
        FpSpread2.Sheets[0].ColumnHeader.Columns[1].VerticalAlign   = VerticalAlign.Middle;
        FpSpread2.Sheets[0].ColumnHeader.Columns[2].HorizontalAlign = HorizontalAlign.Center;
        FpSpread2.Sheets[0].ColumnHeader.Columns[2].VerticalAlign   = VerticalAlign.Middle;
        FpSpread2.Sheets[0].ColumnHeader.Columns[3].HorizontalAlign = HorizontalAlign.Center;
        FpSpread2.Sheets[0].ColumnHeader.Columns[3].VerticalAlign   = VerticalAlign.Middle;

        FpSpread2.Sheets[0].Columns[0].Width = 40;
        FpSpread2.Sheets[0].Columns[1].Width = 100;
        FpSpread2.Sheets[0].Columns[2].Width = 180;
        FpSpread2.Sheets[0].Columns[3].Width = 40;

        FarPoint.Web.Spread.StyleInfo darkstyle = new FarPoint.Web.Spread.StyleInfo();
        darkstyle.BackColor = ColorTranslator.FromHtml("#0CA6CA");
        darkstyle.ForeColor = System.Drawing.Color.White;
        // darkstyle.Font.Name = "Book Antiqua";
        darkstyle.Font.Size          = FontUnit.Medium;
        darkstyle.Border.BorderSize  = 1;
        darkstyle.Border.BorderColor = System.Drawing.Color.White;
        FpSpread2.ActiveSheetView.ColumnHeader.DefaultStyle = darkstyle;
        FpSpread2.Sheets[0].RowCount = 0;
    }
Ejemplo n.º 10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //****************************************************//
        if (Session["collegecode"] == null)
        {
            Response.Redirect("~/Default.aspx");
        }

        if (!Request.FilePath.Contains("hostelindex"))
        {
            string strPreviousPage = "";
            if (Request.UrlReferrer != null)
            {
                strPreviousPage = Request.UrlReferrer.Segments[Request.UrlReferrer.Segments.Length - 1];
            }
            if (strPreviousPage == "")
            {
                Response.Redirect("~/HostelMod/hostelindex.aspx");
                return;
            }
        }
        //****************************************************//
        if (!IsPostBack)
        {
            rbplainsheet.Checked  = true;
            chkfootersign.Checked = true;
            chk_terms.Checked     = true;
            loadprintdetails();
            loadtermssp();
            loadtermssp2();
            showterms();
            showstaffdesc();
            txtstaff.Attributes.Add("Readonly", "Readonly");
            FarPoint.Web.Spread.StyleInfo darkstyle = new FarPoint.Web.Spread.StyleInfo();
            darkstyle.BackColor = ColorTranslator.FromHtml("#0CA6CA");
            darkstyle.ForeColor = System.Drawing.Color.White;
            // darkstyle.Font.Name = "Book Antiqua";
            darkstyle.Font.Size          = FontUnit.Medium;
            darkstyle.Border.BorderSize  = 1;
            darkstyle.Border.BorderColor = System.Drawing.Color.White;
            fsstaff.ActiveSheetView.ColumnHeader.DefaultStyle = darkstyle;
            retrive();
        }
    }
Ejemplo n.º 11
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (Session["collegecode"] == null)
         {
             Response.Redirect("~/Default.aspx");
         }
         if (!Request.FilePath.Contains("CAMHome"))
         {
             string strPreviousPage = "";
             if (Request.UrlReferrer != null)
             {
                 strPreviousPage = Request.UrlReferrer.Segments[Request.UrlReferrer.Segments.Length - 1];
             }
             if (strPreviousPage == "")
             {
                 Response.Redirect("~/MarkMod/CAMHome.aspx");
                 return;
             }
         }
         usercode     = Session["usercode"].ToString();
         collegecode1 = Session["collegecode"].ToString();
         singleuser   = Session["single_user"].ToString();
         group_user   = Session["group_code"].ToString();
         if (!IsPostBack)
         {
             Bindcollege();
             collegecode = ddlcollege.SelectedValue.ToString();
             BindBatch();
             BindDegree(singleuser, group_user, collegecode, usercode);
             BindBranchMultiple(singleuser, group_user, course_id, collegecode, usercode);
             FarPoint.Web.Spread.StyleInfo MyStyle = new FarPoint.Web.Spread.StyleInfo();
             MyStyle.Font.Bold       = true;
             MyStyle.Font.Size       = FontUnit.Medium;
             MyStyle.HorizontalAlign = HorizontalAlign.Center;
             MyStyle.ForeColor       = Color.Black;
             MyStyle.BackColor       = ColorTranslator.FromHtml("#0CA6CA");
         }
     }
     catch (Exception ex) { }
 }
Ejemplo n.º 12
0
    public void GridHeader()
    {
        FpStudent.Sheets[0].AutoPostBack                  = false;
        FpStudent.CommandBar.Visible                      = false;
        FpStudent.Sheets[0].SheetCorner.ColumnCount       = 0;
        FpStudent.Sheets[0].ColumnCount                   = 0;
        FpStudent.Sheets[0].RowCount                      = 0;
        FpStudent.Sheets[0].ColumnCount                   = 5;
        FpStudent.Sheets[0].ColumnHeader.Cells[0, 0].Text = "S.No";
        FpStudent.Sheets[0].ColumnHeader.Cells[0, 1].Text = "Degree";
        FpStudent.Sheets[0].ColumnHeader.Cells[0, 2].Text = "Branch";
        FpStudent.Sheets[0].SetColumnMerge(1, FarPoint.Web.Spread.Model.MergePolicy.Always);
        FpStudent.Sheets[0].ColumnHeader.Cells[0, 3].Text = "MaxCredit";
        FpStudent.Sheets[0].ColumnHeader.Cells[0, 4].Text = "Pass Credits For Consolidated Mark Sheet";


        FpStudent.Sheets[0].Columns[0].Width = 37;
        FpStudent.Sheets[0].Columns[1].Width = 100;
        FpStudent.Sheets[0].Columns[2].Width = 350;
        FpStudent.Sheets[0].Columns[3].Width = 100;
        FpStudent.Sheets[0].Columns[4].Width = 100;


        FarPoint.Web.Spread.StyleInfo style2 = new FarPoint.Web.Spread.StyleInfo();
        style2.Font.Size       = 13;
        style2.Font.Name       = "Book Antiqua";
        style2.Font.Bold       = true;
        style2.HorizontalAlign = HorizontalAlign.Center;
        style2.ForeColor       = System.Drawing.Color.Black;
        // style2.BackColor = System.Drawing.Color.Teal;
        style2.BackColor = ColorTranslator.FromHtml("#0CA6CA");

        FpStudent.Sheets[0].ColumnHeader.DefaultStyle = new FarPoint.Web.Spread.StyleInfo(style2);
        FpStudent.Sheets[0].SheetName = "Settings";
        FpStudent.Sheets[0].Columns.Default.VerticalAlign = VerticalAlign.Middle;
        FpStudent.Sheets[0].Rows.Default.HorizontalAlign  = HorizontalAlign.Center;
        FpStudent.Sheets[0].Rows.Default.VerticalAlign    = VerticalAlign.Middle;
        FpStudent.Sheets[0].DefaultStyle.Font.Name        = "Book Antiqua";
        FpStudent.Sheets[0].DefaultStyle.Font.Size        = FontUnit.Medium;
        FpStudent.Sheets[0].DefaultStyle.Font.Bold        = false;
    }
Ejemplo n.º 13
0
    private void LoadHeader()
    {
        FpSpread.CommandBar.Visible              = false;
        FpSpread.RowHeader.Visible               = false;
        FpSpread.Sheets[0].AutoPostBack          = false;
        FpSpread.Sheets[0].ColumnHeader.RowCount = 1;
        FpSpread.Sheets[0].RowCount              = 0;
        FpSpread.Sheets[0].ColumnCount           = 6;

        FarPoint.Web.Spread.StyleInfo darkstyle = new FarPoint.Web.Spread.StyleInfo();
        darkstyle.Font.Name       = "Book Antiqua";
        darkstyle.Font.Size       = FontUnit.Medium;
        darkstyle.Font.Bold       = true;
        darkstyle.HorizontalAlign = HorizontalAlign.Center;
        darkstyle.ForeColor       = Color.Black;
        darkstyle.BackColor       = ColorTranslator.FromHtml("#0CA6CA");

        FpSpread.Sheets[0].ColumnHeader.DefaultStyle     = darkstyle;
        FpSpread.Sheets[0].ColumnHeader.Cells[0, 0].Text = "S.No.";
        FpSpread.Columns[0].Width  = 75;
        FpSpread.Columns[0].Locked = true;
        FpSpread.Sheets[0].ColumnHeader.Cells[0, 1].Text = "Select";
        FpSpread.Columns[1].Width = 75;
        FpSpread.Sheets[0].ColumnHeader.Cells[0, 2].Text = "Staff Code";
        FpSpread.Columns[2].Width  = 100;
        FpSpread.Columns[2].Locked = true;
        FpSpread.Sheets[0].ColumnHeader.Cells[0, 3].Text = "Staff Name";
        FpSpread.Columns[3].Width  = 250;
        FpSpread.Columns[3].Locked = true;
        FpSpread.Sheets[0].ColumnHeader.Cells[0, 4].Text = "Department";
        FpSpread.Columns[4].Width  = 300;
        FpSpread.Columns[4].Locked = true;
        FpSpread.Sheets[0].ColumnHeader.Cells[0, 5].Text = "In Time";
        FpSpread.Columns[5].Width  = 150;
        FpSpread.Columns[5].Locked = true;
    }
Ejemplo n.º 14
0
    private void loadrepsprcolumns()
    {
        try
        {
            Fpspreadpop.Sheets[0].RowCount              = 0;
            Fpspreadpop.Sheets[0].ColumnCount           = 7;
            Fpspreadpop.CommandBar.Visible              = false;
            Fpspreadpop.RowHeader.Visible               = false;
            Fpspreadpop.Sheets[0].AutoPostBack          = false;
            Fpspreadpop.Sheets[0].ColumnHeader.RowCount = 1;
            Fpspreadpop.Sheets[0].FrozenRowCount        = 1;

            FarPoint.Web.Spread.StyleInfo darkstyle = new FarPoint.Web.Spread.StyleInfo();
            darkstyle.BackColor = ColorTranslator.FromHtml("#0CA6CA");
            darkstyle.ForeColor = Color.Black;
            Fpspreadpop.ActiveSheetView.ColumnHeader.DefaultStyle = darkstyle;

            Fpspreadpop.Sheets[0].ColumnHeader.Cells[0, 0].Text            = "S.No";
            Fpspreadpop.Sheets[0].ColumnHeader.Cells[0, 0].Font.Bold       = true;
            Fpspreadpop.Sheets[0].ColumnHeader.Cells[0, 0].HorizontalAlign = HorizontalAlign.Center;
            Fpspreadpop.Sheets[0].ColumnHeader.Cells[0, 0].Font.Name       = "Book Antiqua";
            Fpspreadpop.Sheets[0].ColumnHeader.Cells[0, 0].Font.Size       = FontUnit.Medium;
            Fpspreadpop.Columns[0].Locked = true;
            Fpspreadpop.Columns[0].Width  = 50;

            Fpspreadpop.Sheets[0].ColumnHeader.Cells[0, 1].Text            = "Select";
            Fpspreadpop.Sheets[0].ColumnHeader.Cells[0, 1].Font.Bold       = true;
            Fpspreadpop.Sheets[0].ColumnHeader.Cells[0, 1].HorizontalAlign = HorizontalAlign.Center;
            Fpspreadpop.Sheets[0].ColumnHeader.Cells[0, 1].Font.Name       = "Book Antiqua";
            Fpspreadpop.Sheets[0].ColumnHeader.Cells[0, 1].Font.Size       = FontUnit.Medium;
            Fpspreadpop.Columns[1].Width = 75;

            Fpspreadpop.Sheets[0].ColumnHeader.Cells[0, 2].Text            = "Staff Code";
            Fpspreadpop.Sheets[0].ColumnHeader.Cells[0, 2].Font.Bold       = true;
            Fpspreadpop.Sheets[0].ColumnHeader.Cells[0, 2].HorizontalAlign = HorizontalAlign.Center;
            Fpspreadpop.Sheets[0].ColumnHeader.Cells[0, 2].Font.Name       = "Book Antiqua";
            Fpspreadpop.Sheets[0].ColumnHeader.Cells[0, 2].Font.Size       = FontUnit.Medium;
            Fpspreadpop.Columns[2].Locked = true;
            if (rbnofingerid.Checked == true)
            {
                Fpspreadpop.Columns[2].Width = 165;
            }
            else
            {
                Fpspreadpop.Columns[2].Width = 115;
            }

            Fpspreadpop.Sheets[0].ColumnHeader.Cells[0, 3].Text            = "Staff Name";
            Fpspreadpop.Sheets[0].ColumnHeader.Cells[0, 3].Font.Bold       = true;
            Fpspreadpop.Sheets[0].ColumnHeader.Cells[0, 3].HorizontalAlign = HorizontalAlign.Center;
            Fpspreadpop.Sheets[0].ColumnHeader.Cells[0, 3].Font.Name       = "Book Antiqua";
            Fpspreadpop.Sheets[0].ColumnHeader.Cells[0, 3].Font.Size       = FontUnit.Medium;
            Fpspreadpop.Columns[3].Locked = true;
            if (rbnofingerid.Checked == true)
            {
                Fpspreadpop.Columns[3].Width = 215;
            }
            else
            {
                Fpspreadpop.Columns[3].Width = 165;
            }

            Fpspreadpop.Sheets[0].ColumnHeader.Cells[0, 4].Text            = "Designation";
            Fpspreadpop.Sheets[0].ColumnHeader.Cells[0, 4].Font.Bold       = true;
            Fpspreadpop.Sheets[0].ColumnHeader.Cells[0, 4].HorizontalAlign = HorizontalAlign.Center;
            Fpspreadpop.Sheets[0].ColumnHeader.Cells[0, 4].Font.Name       = "Book Antiqua";
            Fpspreadpop.Sheets[0].ColumnHeader.Cells[0, 4].Font.Size       = FontUnit.Medium;
            Fpspreadpop.Columns[4].Locked = true;
            if (rbnofingerid.Checked == true)
            {
                Fpspreadpop.Columns[4].Width = 240;
            }
            else
            {
                Fpspreadpop.Columns[4].Width = 190;
            }

            Fpspreadpop.Sheets[0].ColumnHeader.Cells[0, 5].Text            = "Department";
            Fpspreadpop.Sheets[0].ColumnHeader.Cells[0, 5].Font.Bold       = true;
            Fpspreadpop.Sheets[0].ColumnHeader.Cells[0, 5].HorizontalAlign = HorizontalAlign.Center;
            Fpspreadpop.Sheets[0].ColumnHeader.Cells[0, 5].Font.Name       = "Book Antiqua";
            Fpspreadpop.Sheets[0].ColumnHeader.Cells[0, 5].Font.Size       = FontUnit.Medium;
            Fpspreadpop.Columns[5].Locked = true;
            if (rbnofingerid.Checked == true)
            {
                Fpspreadpop.Columns[5].Width = 240;
            }
            else
            {
                Fpspreadpop.Columns[5].Width = 190;
            }


            Fpspreadpop.Sheets[0].ColumnHeader.Cells[0, 6].Text            = "Finger ID";
            Fpspreadpop.Sheets[0].ColumnHeader.Cells[0, 6].Font.Bold       = true;
            Fpspreadpop.Sheets[0].ColumnHeader.Cells[0, 6].HorizontalAlign = HorizontalAlign.Center;
            Fpspreadpop.Sheets[0].ColumnHeader.Cells[0, 6].Font.Name       = "Book Antiqua";
            Fpspreadpop.Sheets[0].ColumnHeader.Cells[0, 6].Font.Size       = FontUnit.Medium;
            Fpspreadpop.Columns[6].Locked = true;
            Fpspreadpop.Columns[6].Width  = 115;

            if (rbnofingerid.Checked == true)
            {
                Fpspreadpop.Columns[1].Visible = false;
                Fpspreadpop.Columns[6].Visible = false;
                btndelete.Visible = false;
            }
            else
            {
                Fpspreadpop.Columns[1].Visible = true;
                Fpspreadpop.Columns[6].Visible = true;
                btndelete.Visible = true;
            }
        }
        catch { }
    }
Ejemplo n.º 15
0
    protected void btn_go(object sender, EventArgs e)
    {
        try
        {
            clear();
            FpSpread1.Sheets[0].SheetCorner.ColumnCount = 0;
            FpSpread1.Sheets[0].ColumnHeader.RowCount   = 2;
            FpSpread1.Sheets[0].ColumnCount             = 0;
            FpSpread1.Sheets[0].RowCount = 0;
            FpSpread1.CommandBar.Visible = false;
            FpSpread1.ActiveSheetView.ColumnHeader.DefaultStyle.Font.Name = "Book Antiqua";
            FpSpread1.ActiveSheetView.ColumnHeader.DefaultStyle.Font.Size = FontUnit.Medium;
            FpSpread1.ActiveSheetView.ColumnHeader.DefaultStyle.Font.Bold = true;
            FpSpread1.Sheets[0].DefaultStyle.Font.Name = "Book Antiqua";
            FpSpread1.Sheets[0].DefaultStyle.Font.Size = FontUnit.Medium;
            FarPoint.Web.Spread.StyleInfo style2 = new FarPoint.Web.Spread.StyleInfo();
            style2.Font.Size       = 13;
            style2.Font.Name       = "Book Antiqua";
            style2.Font.Bold       = true;
            style2.HorizontalAlign = HorizontalAlign.Center;
            style2.ForeColor       = Color.White;
            style2.BackColor       = Color.Teal;
            FpSpread1.Sheets[0].SheetCornerStyle          = new FarPoint.Web.Spread.StyleInfo(style2);
            FpSpread1.Sheets[0].ColumnHeader.DefaultStyle = new FarPoint.Web.Spread.StyleInfo(style2);

            FarPoint.Web.Spread.TextCellType txt = new FarPoint.Web.Spread.TextCellType();
            DataSet   dsrank      = new DataSet();
            Hashtable hatstutotal = new Hashtable();
            DataSet   dsexam      = new DataSet();
            DataView  dvcount     = new DataView();

            string batchcount  = "";
            string sqlbatch    = "";
            string branchcount = "";
            string sqlbranch   = "";
            string exam_year   = "";
            string exam_month  = "";
            collegecode = ddlclg.SelectedItem.Value;

            for (int itemcount = 0; itemcount < chklsbatch.Items.Count; itemcount++)
            {
                if (chklsbatch.Items[itemcount].Selected == true)
                {
                    if (batchcount == "")
                    {
                        batchcount = "'" + chklsbatch.Items[itemcount].Value.ToString() + "'";
                    }
                    else
                    {
                        batchcount = batchcount + ",'" + chklsbatch.Items[itemcount].Value.ToString() + "'";
                    }
                }
            }

            if (batchcount != "")
            {
                sqlbatch = " and r.batch_year in(" + batchcount + ")";
            }
            else
            {
                lbl_errmsg.Visible = true;
                lbl_errmsg.Text    = "Please Select The Batch And Then Proceed";
                return;
            }

            for (int itemcount = 0; itemcount < chklstbranch.Items.Count; itemcount++)
            {
                if (chklstbranch.Items[itemcount].Selected == true)
                {
                    if (branchcount == "")
                    {
                        branchcount = "'" + chklstbranch.Items[itemcount].Value.ToString() + "'";
                    }
                    else
                    {
                        branchcount = branchcount + ",'" + chklstbranch.Items[itemcount].Value.ToString() + "'";
                    }
                }
            }
            if (branchcount != "")
            {
                sqlbranch = " and r.degree_code in(" + branchcount + ")";
            }
            else
            {
                lbl_errmsg.Visible = true;
                lbl_errmsg.Text    = "Please Select The Degree and Branch And Then Proceed";
                return;
            }

            if (ddlyear.Items.Count > 0)
            {
                if (ddlyear.SelectedItem.ToString().Trim() != "")
                {
                    exam_year = ddlyear.SelectedValue.ToString();
                }
                else
                {
                    lbl_errmsg.Visible = true;
                    lbl_errmsg.Text    = "Please Select The Exam Year And Then Proceed";
                    return;
                }
            }
            else
            {
                lbl_errmsg.Visible = true;
                lbl_errmsg.Text    = "Please Select The Exam Year And Then Proceed";
                return;
            }

            if (ddlmonth.Items.Count > 0)
            {
                if (ddlmonth.SelectedItem.ToString().Trim() != "")
                {
                    exam_month = ddlmonth.SelectedValue.ToString();
                }
                else
                {
                    lbl_errmsg.Visible = true;
                    lbl_errmsg.Text    = "Please Select The Exam Month And Then Proceed";
                    return;
                }
            }
            else
            {
                lbl_errmsg.Visible = true;
                lbl_errmsg.Text    = "Please Select The Exam Month And Then Proceed";
                return;
            }

            Double cgpafrom  = 0;
            Double cgpato    = 0;
            string strfrange = txt_rangefrom.Text.ToString();
            if (strfrange.Trim() != "")
            {
                cgpafrom = Convert.ToDouble(strfrange);
            }
            else
            {
                lbl_errmsg.Visible = true;
                lbl_errmsg.Text    = "Please Select The CGPA From Range And Then Proceed";
                return;
            }

            string strtrange = txt_to.Text.ToString();
            if (strtrange.Trim() != "")
            {
                cgpato = Convert.ToDouble(strtrange);
            }
            else
            {
                lbl_errmsg.Visible = true;
                lbl_errmsg.Text    = "Please Select The CGPA To Range And Then Proceed";
                return;
            }

            if (cgpato < cgpafrom)
            {
                lbl_errmsg.Visible = true;
                lbl_errmsg.Text    = "Please Enter The CGPA To Range Must Be Greater Then From Range";
                return;
            }

            string query          = "select distinct r.stud_name,r.Reg_No,r.batch_year,dg.Acronym,course.Course_Name,ed.current_semester,r.sections,r.degree_code,d.dept_name,course.course_name,dg.course_id,r.mode ,r.roll_no,r.degree_code,r.mode from registration r,mark_entry me ,department d,course,degree dg,Exam_Details ed where me.roll_no=r.roll_no and r.degree_code=dg.degree_code and dg.course_id = course.course_id and dg.dept_code = d.dept_code and ed.degree_code=r.degree_code and ed.batch_year=r.Batch_Year and me.result='pass' and ed.Exam_Month='" + exam_month + "' and ed.Exam_year='" + exam_year + "' " + sqlbatch + " " + sqlbranch + " order by r.degree_code,r.Batch_Year";
            string getbranchvalue = "select distinct d.dept_acronym,c.Course_Name,dg.Degree_Code from registration r,mark_entry me ,department d,course c,degree dg,Exam_Details ed where me.roll_no=r.roll_no and r.degree_code=dg.degree_code and dg.course_id = c.course_id and dg.dept_code = d.dept_code and ed.degree_code=r.degree_code and ed.batch_year=r.Batch_Year and me.result='pass' and ed.Exam_Month='" + exam_month + "' and ed.Exam_year='" + exam_year + "' " + sqlbatch + " " + sqlbranch + " order by c.Course_Name,d.dept_acronym";
            ds.Dispose();
            ds.Reset();
            ds = d2.select_method(query, hat, "Text");
            if (ds.Tables[0].Rows.Count > 0)
            {
                DataSet dstable = d2.select_method("select * from sysobjects where name='tbl_Topperrank' and Type='U'", hat, "text ");
                if (dstable.Tables[0].Rows.Count == 0)
                {
                    int p = d2.insert_method("create table tbl_Topperrank (roll_no nvarchar(50),cgpa float (8),stud_name nvarchar(200),degree nvarchar(500),user_code nvarchar(25))", hat, "text");
                }
                else
                {
                    int p = d2.insert_method("IF not EXISTS (SELECT * FROM   INFORMATION_SCHEMA.COLUMNS WHERE  TABLE_NAME = 'tbl_Topperrank' AND COLUMN_NAME = 'user_code') alter table tbl_Topperrank add user_code nvarchar(15)", hat, "text");
                }
                ds.Dispose();
                dsfind = d2.select_method("select name from sysobjects where xtype='p' and name='sp_ins_upd_topperrank' ", hat, "text");
                if (dsfind.Tables[0].Rows.Count == 0)
                {
                    string spcreation = " CREATE procedure sp_ins_upd_topperrank (@RollNumber varchar(50), @cgpa varchar(20), @stud_name varchar(20), @degree varchar(200) ,@user_code nvarchar(25))  as  declare @cou_nt  int set @cou_nt=(select count(Roll_no)from tbl_Topperrank where Roll_no=@RollNumber) if @cou_nt=0 BEGIN insert into tbl_Topperrank(Roll_no,cgpa,stud_name,degree,user_code) values (@RollNumber,@cgpa,@stud_name,@degree,@user_code) End Else BEGIN update  tbl_Topperrank set cgpa=@cgpa where Roll_no=@RollNumber and user_code=@user_code end";
                    int    s          = d2.insert_method(spcreation, hat, "Text");
                }
                else
                {
                    string spalter = " alter procedure sp_ins_upd_topperrank (@RollNumber varchar(50), @cgpa   varchar(20), @stud_name varchar(20), @degree varchar(200) ,@user_code nvarchar(25))    as  declare @cou_nt  int set @cou_nt=(select count(Roll_no)from tbl_Topperrank    where Roll_no=@RollNumber) if @cou_nt=0 BEGIN insert into tbl_Topperrank(Roll_no,   cgpa,stud_name,degree,user_code)values(@RollNumber,@cgpa,@stud_name,@degree,   @user_code) End Else BEGIN update  tbl_Topperrank set cgpa=@cgpa where    Roll_no=@RollNumber and user_code=@user_code End";
                    int    gf      = d2.insert_method(spalter, hat, "Text");
                }

                Boolean rowflag = false;
                FpSpread1.Sheets[0].ColumnCount++;
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].Text = "CGPA";
                FpSpread1.Sheets[0].ColumnHeaderSpanModel.Add(0, 0, 2, 1);
                string  tempdegree = "";
                DataSet dsdegree   = d2.select_method_wo_parameter(getbranchvalue, "text");
                int     spancolumn = 0;
                Boolean valkflag   = false;
                for (int d = 0; d < dsdegree.Tables[0].Rows.Count; d++)
                {
                    string strdegree = dsdegree.Tables[0].Rows[d]["dept_acronym"].ToString();
                    string Course    = dsdegree.Tables[0].Rows[d]["Course_Name"].ToString();
                    if (tempdegree != Course || d == dsdegree.Tables[0].Rows.Count - 1)
                    {
                        if (tempdegree != "")
                        {
                            if (tempdegree == Course && d == dsdegree.Tables[0].Rows.Count - 1)
                            {
                                spancolumn++;
                                valkflag = true;
                                FpSpread1.Sheets[0].ColumnCount++;
                                FpSpread1.Sheets[0].ColumnHeader.Cells[0, FpSpread1.Sheets[0].ColumnCount - 1].Text = Course;
                                FpSpread1.Sheets[0].ColumnHeader.Cells[1, FpSpread1.Sheets[0].ColumnCount - 1].Text = strdegree;
                                FpSpread1.Sheets[0].ColumnHeader.Cells[1, FpSpread1.Sheets[0].ColumnCount - 1].Note = dsdegree.Tables[0].Rows[d]["Degree_Code"].ToString();
                            }
                            FpSpread1.Sheets[0].ColumnHeaderSpanModel.Add(0, FpSpread1.Sheets[0].ColumnCount - spancolumn, 1, spancolumn);
                        }
                        spancolumn = 0;
                        tempdegree = Course;
                    }
                    if (valkflag == false)
                    {
                        spancolumn++;
                        FpSpread1.Sheets[0].ColumnCount++;
                        FpSpread1.Sheets[0].ColumnHeader.Cells[0, FpSpread1.Sheets[0].ColumnCount - 1].Text = Course;
                        FpSpread1.Sheets[0].ColumnHeader.Cells[1, FpSpread1.Sheets[0].ColumnCount - 1].Text = strdegree;
                        FpSpread1.Sheets[0].ColumnHeader.Cells[1, FpSpread1.Sheets[0].ColumnCount - 1].Note = dsdegree.Tables[0].Rows[d]["Degree_Code"].ToString();
                    }
                }

                FpSpread1.Sheets[0].ColumnCount++;
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, FpSpread1.Sheets[0].ColumnCount - 1].Text = "Total";

                FpSpread1.Sheets[0].ColumnHeaderSpanModel.Add(0, FpSpread1.Sheets[0].ColumnCount - 1, 2, 1);
                for (int y = 0; y < chklsbatch.Items.Count; y++)
                {
                    if (chklsbatch.Items[y].Selected == true)
                    {
                        string batch = chklsbatch.Items[y].Text.ToString();
                        FpSpread1.Sheets[0].RowCount++;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].CellType        = txt;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Text            = "Batch " + batch + "";
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].BackColor       = Color.AliceBlue;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].HorizontalAlign = HorizontalAlign.Center;
                        FpSpread1.Sheets[0].SpanModel.Add(FpSpread1.Sheets[0].RowCount - 1, 0, 1, FpSpread1.Sheets[0].ColumnCount);
                        int startow = FpSpread1.Sheets[0].RowCount;
                        for (Double dc = cgpato; dc >= cgpafrom; dc = dc - 0.5)
                        {
                            FpSpread1.Sheets[0].RowCount++;
                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].CellType = txt;
                            if (dc == cgpato)
                            {
                                FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Text = ">" + dc.ToString();
                                FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Note = " and cgpa >" + dc + "";
                            }
                            else
                            {
                                Double doc1 = dc + 0.5;
                                Double doc2 = dc + 0.001;
                                FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Text = dc + " - " + doc1;
                                FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Note = " and cgpa between " + doc2 + " and " + doc1 + "";
                            }
                        }

                        for (int c = 1; c < FpSpread1.Sheets[0].ColumnCount - 1; c++)
                        {
                            string degreecode = FpSpread1.Sheets[0].ColumnHeader.Cells[1, c].Note.ToString();
                            ds.Tables[0].DefaultView.RowFilter = "Batch_year='" + batch + "' and degree_code='" + degreecode + "'";
                            DataView dvstud = ds.Tables[0].DefaultView;
                            for (int s = 0; s < dvstud.Count; s++)
                            {
                                string rollno      = dvstud[s]["roll_no"].ToString();
                                string sem         = dvstud[s]["current_semester"].ToString();
                                string mode        = dvstud[s]["mode"].ToString();
                                string name        = dvstud[s]["stud_name"].ToString();
                                string degreevalue = dvstud[s]["Acronym"].ToString();
                                int    failcount   = Convert.ToInt32(d2.GetFunction(" Select COUNT(*) from Mark_Entry,Subject where  Mark_Entry.Subject_No = Subject.Subject_No and roll_no='" + rollno + "' and result='fail' and result='Fail'  "));
                                if (failcount == 0)
                                {
                                    string cgpav = d2.Calculete_CGPA(rollno, sem, degreecode, batch, mode, collegecode);
                                    if (cgpav != "0" && cgpav != "" && cgpav != "-" && cgpav != "NaN")
                                    {
                                        Double num = 0;
                                        if (Double.TryParse(cgpav, out num))
                                        {
                                            hat.Clear();
                                            hat.Add("RollNumber", rollno);
                                            hat.Add("cgpa", cgpav.ToString());
                                            hat.Add("stud_name", name.ToString());
                                            hat.Add("degree", degreevalue.ToString());
                                            hat.Add("user_code", usercode.ToString());
                                            int o = d2.insert_method("sp_ins_upd_topperrank", hat, "sp");
                                        }
                                    }
                                }
                            }
                            for (int r = startow; r < FpSpread1.Sheets[0].RowCount; r++)
                            {
                                string valran      = FpSpread1.Sheets[0].Cells[r, 0].Note;
                                string getstucount = d2.GetFunction("select count(roll_no) from tbl_Topperrank where user_code='" + usercode + "' " + valran + "");
                                if (getstucount.Trim() != "0" && getstucount.Trim() != "")
                                {
                                    rowflag = true;
                                }
                                FpSpread1.Sheets[0].Cells[r, c].CellType        = txt;
                                FpSpread1.Sheets[0].Cells[r, c].Text            = getstucount;
                                FpSpread1.Sheets[0].Cells[r, c].HorizontalAlign = HorizontalAlign.Center;
                            }
                            int p = d2.insert_method("Delete from tbl_Topperrank where user_code='" + usercode + "' ", hat, "text");
                        }
                    }
                }
                for (int r = 1; r < FpSpread1.Sheets[0].RowCount; r++)
                {
                    int totalstudent = 0;
                    for (int c = 1; c < FpSpread1.Sheets[0].ColumnCount - 1; c++)
                    {
                        string rowsvalue = FpSpread1.Sheets[0].Cells[r, c].Text.ToString();
                        if (rowsvalue.Trim() != "")
                        {
                            totalstudent = totalstudent + Convert.ToInt32(rowsvalue);
                        }
                        FpSpread1.Sheets[0].Cells[r, FpSpread1.Sheets[0].ColumnCount - 1].Text            = totalstudent.ToString();
                        FpSpread1.Sheets[0].Cells[r, FpSpread1.Sheets[0].ColumnCount - 1].HorizontalAlign = HorizontalAlign.Center;
                    }
                }

                if (rowflag == true)
                {
                    FpSpread1.Visible   = true;
                    lbl_rptname.Visible = true;
                    btn_excel.Visible   = true;
                    btn_print.Visible   = true;
                    txt_rpt.Visible     = true;
                }
                else
                {
                    lbl_errmsg.Text    = "No Records Found";
                    lbl_errmsg.Visible = true;
                }
            }
            else
            {
                lbl_errmsg.Text    = "No Records Found";
                lbl_errmsg.Visible = true;
            }

            FpSpread1.Sheets[0].PageSize = FpSpread1.Sheets[0].RowCount;
        }
        catch (Exception ex)
        {
            lbl_errmsg.Text    = ex.ToString();
            lbl_errmsg.Visible = true;
        }
    }
    void load_click()
    {
        fpattendance.Visible   = true;
        btnprintmaster.Visible = true;
        string   date1;
        string   datefrom;
        string   date2;
        string   dateto;
        string   date6;
        string   year;
        int      day3;
        string   monyear;
        DateTime monyear1;
        int      day5;

        date1 = Txtentryfrom.Text.ToString();
        string[] split = date1.Split(new Char[] { '/' });
        datefrom = split[1].ToString() + "/" + split[0].ToString() + "/" + split[2].ToString();
        // monyearfrom= split[1].ToString() +"/" + split[2].ToString();
        //  day5=
        year  = split[2].ToString();
        date2 = Txtentryto.Text.ToString();
        string[] split1 = date2.Split(new Char[] { '/' });
        dateto = split1[1].ToString() + "/" + split1[0].ToString() + "/" + split1[2].ToString();
        date6  = split[1].ToString();
        DateTime dt1  = Convert.ToDateTime(datefrom.ToString());
        DateTime dt2  = Convert.ToDateTime(dateto.ToString());
        TimeSpan t    = dt2.Subtract(dt1);
        long     days = t.Days;

        day3 = Convert.ToInt32(days);

        fpattendance.Sheets[0].RowCount    = 0;
        fpattendance.Sheets[0].ColumnCount = 0;
        //fpattendance.CommandBar.Visible = false;
        //fpattendance.Sheets[0].SheetCorner.Cells[0, 0].Text = "S.No";

        //fpattendance.Sheets[0].SheetCorner.Cells[0, 0].HorizontalAlign = HorizontalAlign.Center;
        //fpattendance.Sheets[0].SheetCorner.Cells[0, 0].Border.BorderColorBottom = Color.White;
        //fpattendance.Sheets[0].SheetCorner.Cells[0, 0].Font.Bold = true;
        //fpattendance.Sheets[0].SheetCorner.Cells[0, 0].Font.Size = FontUnit.Large;

        fpattendance.Sheets[0].PageSize = 10;
        fpattendance.Pager.Position     = FarPoint.Web.Spread.PagerPosition.Bottom;
        fpattendance.Pager.Mode         = FarPoint.Web.Spread.PagerMode.Both;
        fpattendance.Pager.Align        = HorizontalAlign.Right;
        fpattendance.Pager.Font.Bold    = true;
        fpattendance.Pager.Font.Name    = "Book Antiqua";
        fpattendance.Pager.ForeColor    = Color.DarkGreen;
        fpattendance.Pager.BackColor    = Color.AliceBlue;
        fpattendance.Pager.PageCount    = 5;

        FarPoint.Web.Spread.StyleInfo darkstyle = new FarPoint.Web.Spread.StyleInfo();
        darkstyle.Font.Name       = "Book Antiqua";
        darkstyle.HorizontalAlign = HorizontalAlign.Center;
        darkstyle.Font.Bold       = true;
        darkstyle.BackColor       = ColorTranslator.FromHtml("#0CA6CA");
        fpattendance.ActiveSheetView.ColumnHeader.DefaultStyle = darkstyle;

        //=============Added by Manikandan 08/05/2013
        fpattendance.Sheets[0].ColumnHeader.RowCount = 2;


        string str = "select isnull(collname, ' ') as collname,isnull(address1, ' ') as address1,isnull(address2,' ') as address2,isnull(address3, ' ') as address3,isnull(pincode,' ') as pincode from collinfo where college_code='" + Session["collegecode"].ToString() + "'";

        con.Close();
        con.Open();
        SqlCommand    comm = new SqlCommand(str, con);
        SqlDataReader drr  = comm.ExecuteReader();

        drr.Read();
        coll_name     = Convert.ToString(drr["collname"]);
        coll_address1 = Convert.ToString(drr["address1"]);
        coll_address2 = Convert.ToString(drr["address2"]);
        coll_address3 = Convert.ToString(drr["address3"]);
        pin_code      = Convert.ToString(drr["pincode"]);

        fpattendance.Sheets[0].ColumnCount = 7;

        fpattendance.Sheets[0].ColumnHeader.Rows[0].BackColor = ColorTranslator.FromHtml("#0CA6CA");
        fpattendance.Sheets[0].ColumnHeader.Rows[1].BackColor = ColorTranslator.FromHtml("#0CA6CA");
        //=========================

        fpattendance.Sheets[0].ColumnHeader.Cells[0, 0].Text = "S.No";
        fpattendance.Sheets[0].SetColumnWidth(0, 50);
        fpattendance.Sheets[0].ColumnHeaderSpanModel.Add(0, 0, 2, 1);
        fpattendance.Sheets[0].ColumnHeader.Cells[0, 0].HorizontalAlign = HorizontalAlign.Center;
        fpattendance.Sheets[0].ColumnHeader.Cells[0, 1].Text            = "Department";
        fpattendance.Sheets[0].SetColumnWidth(1, 200);
        fpattendance.Sheets[0].ColumnHeader.Cells[0, 2].Text = "Total No Of Staff";
        fpattendance.Sheets[0].ColumnHeader.Cells[0, 3].Text = "Present";
        fpattendance.Sheets[0].ColumnHeaderSpanModel.Add(0, 3, 1, 2);
        fpattendance.Sheets[0].ColumnHeader.Cells[0, 5].Text = "Absent";
        fpattendance.Sheets[0].ColumnHeaderSpanModel.Add(0, 5, 1, 2);

        fpattendance.Sheets[0].ColumnHeader.Cells[0, 1, 1, 5].HorizontalAlign = HorizontalAlign.Center;

        fpattendance.Sheets[0].ColumnHeader.Cells[1, 1, 1, 5].HorizontalAlign = HorizontalAlign.Center;



        fpattendance.Sheets[0].ColumnHeaderSpanModel.Add(0, 1, 2, 1);
        fpattendance.Sheets[0].ColumnHeaderSpanModel.Add(0, 2, 3, 1);

        fpattendance.Sheets[0].ColumnHeader.Cells[1, 0].Text = " ";
        fpattendance.Sheets[0].ColumnHeader.Cells[1, 1].Text = " ";
        fpattendance.Sheets[0].ColumnHeader.Cells[1, 3].Text = "Morning";
        fpattendance.Sheets[0].ColumnHeader.Cells[1, 3].Tag  = "Present";
        fpattendance.Sheets[0].ColumnHeader.Cells[1, 4].Text = "Evening";
        fpattendance.Sheets[0].ColumnHeader.Cells[1, 4].Tag  = "Present";

        fpattendance.Sheets[0].ColumnHeader.Cells[1, 5].Text = "Morning";
        fpattendance.Sheets[0].ColumnHeader.Cells[1, 5].Tag  = "Absent";
        fpattendance.Sheets[0].ColumnHeader.Cells[1, 6].Text = "Evening";
        fpattendance.Sheets[0].ColumnHeader.Cells[1, 6].Tag  = "Absent";


        // added staffcategorizer table in below query by jairam 08-11-2014 Modififed By delsi 10.01.2018 Added join Date
        sql = "SELECT distinct staffmaster.staff_code , staff_name,desig_master.desig_name,dept_name,stafftrans.dept_code,desig_master.priority, stafftrans.smdate, staffmaster.staff_code  FROM staffmaster INNER JOIN stafftrans ON staffmaster.staff_code = stafftrans.staff_code INNER JOIN hrdept_master ON stafftrans.dept_code = hrdept_master.dept_code inner join hr_privilege on hr_privilege.dept_code=hrdept_master.dept_code";
        sql = sql + " AND staffmaster.college_code = hrdept_master.college_code INNER JOIN desig_master ON stafftrans.desig_code = desig_master.desig_code and hrdept_master.dept_code=stafftrans.dept_code inner join staffcategorizer on staffcategorizer.college_code =hrdept_master.college_code and staffcategorizer.college_code=staffmaster.college_code and staffcategorizer.category_code =stafftrans.category_code and hrdept_master.college_code=" + Session["collegecode"] + " and desig_master.collegecode='" + Session["collegecode"] + "' where stafftrans.latestrec<>0 and ISNULL(DispReports,0) =1 and  (staffmaster.resign=0 and staffmaster.settled=0) and join_date<='" + datefrom + "' and staffmaster.college_code=" + Session["collegecode"] + "";

        if (cbldepttype.SelectedItem.Value.ToString() != "All")
        {
            sql = sql + " and hrdept_master.dept_code = '" + cbldepttype.SelectedItem.Value.ToString() + "'";
        }
        sql = sql + " order by hrdept_master.dept_name";
        con1.Open();
        SqlCommand    cmd = new SqlCommand(sql, con1);
        SqlDataReader dr14;

        dr14 = cmd.ExecuteReader();

        tempdept_ = "";
        int sno = 0;


        while (dr14.Read())
        {
            if (dr14.HasRows == true)
            {
                string staffcode = "";

                staffcode = dr14["staff_code"].ToString();
                if (tempdept_ == "")
                {
                    sno++;
                    tempdept_ = dr14["dept_name"].ToString();
                    rowstr    = fpattendance.Sheets[0].RowCount++;
                }
                else if ((tempdept_ != "") && (tempdept_ != dr14["dept_name"].ToString()))
                {
                    //spreadrowcnt++;
                    sno++;
                    rowstr = fpattendance.Sheets[0].RowCount++;
                    fpattendance.Sheets[0].Cells[rowstr, 0].Text = sno.ToString();
                    fpattendance.Sheets[0].Cells[rowstr, 1].Text = tempdept_.ToString();
                    fpattendance.Sheets[0].Cells[rowstr, 2].Text = countstaff.ToString();
                    fpattendance.Sheets[0].Cells[rowstr, 3].Text = totalmorningpresent.ToString(); //Modified By Manikandan 08/05/2013
                    fpattendance.Sheets[0].Cells[rowstr, 4].Text = totaleveningpresent.ToString(); //Added by Manikandan 08/05/2013
                    fpattendance.Sheets[0].Cells[rowstr, 5].Text = totalmorningabsent.ToString();  //Modified by Manikandan 08/05/2013
                    fpattendance.Sheets[0].Cells[rowstr, 6].Text = totalevenngabsent.ToString();   //Added by Manikandan 08/05/2013

                    totaleveningpresent = 0;
                    totalmorningpresent = 0;
                    counttotalpresent   = 0;
                    totalmorningabsent  = 0;
                    totalevenngabsent   = 0;
                    counttotalabsent    = 0;
                    countstaff          = 0;
                    tempdept_           = dr14["dept_name"].ToString();

                    SbStringMrngP = new StringBuilder();
                    SbStringEveP  = new StringBuilder();
                    SbStringMrngA = new StringBuilder();
                    SbStringEveA  = new StringBuilder();
                }


                string totalpresent = getfunction(staffcode, datefrom);

                fpattendance.Sheets[0].Cells[rowstr, 0].Text            = sno.ToString();
                fpattendance.Sheets[0].Cells[rowstr, 0].HorizontalAlign = HorizontalAlign.Center;
                fpattendance.Sheets[0].Cells[rowstr, 1].Text            = tempdept_.ToString();
                fpattendance.Sheets[0].Cells[rowstr, 1].HorizontalAlign = HorizontalAlign.Left;
                fpattendance.Sheets[0].Cells[rowstr, 2].Text            = countstaff.ToString();
                fpattendance.Sheets[0].Cells[rowstr, 2].HorizontalAlign = HorizontalAlign.Center;
                fpattendance.Sheets[0].Cells[rowstr, 3].Text            = totalmorningpresent.ToString();//Modified by Manikandan 08/05/2013
                fpattendance.Sheets[0].Cells[rowstr, 3].Tag             = SbStringMrngP.ToString();

                fpattendance.Sheets[0].Cells[rowstr, 4].Text = totaleveningpresent.ToString();//Added by Manikandan 08/05/2013
                fpattendance.Sheets[0].Cells[rowstr, 4].Tag  = SbStringEveP.ToString();

                fpattendance.Sheets[0].Cells[rowstr, 3].HorizontalAlign = HorizontalAlign.Center;
                fpattendance.Sheets[0].Cells[rowstr, 4].HorizontalAlign = HorizontalAlign.Center;
                fpattendance.Sheets[0].Cells[rowstr, 5].Text            = totalmorningabsent.ToString();//Modified by Manikandan 08/05/2013
                fpattendance.Sheets[0].Cells[rowstr, 5].Tag             = SbStringMrngA.ToString();

                fpattendance.Sheets[0].Cells[rowstr, 6].Text = totalevenngabsent.ToString();//Modified by Manikandan 08/05/2013
                fpattendance.Sheets[0].Cells[rowstr, 6].Tag  = SbStringEveA.ToString();

                fpattendance.Sheets[0].Cells[rowstr, 5].HorizontalAlign = HorizontalAlign.Center;
                fpattendance.Sheets[0].Cells[rowstr, 6].HorizontalAlign = HorizontalAlign.Center;

                lblexcel.Visible       = true;
                txtxl.Visible          = true;
                btnxl.Visible          = true;
                btnprintmaster.Visible = true;
                lblnorec.Visible       = false;
            }

            //spreadrowcnt = fpattendance.Sheets[0].RowCount;
        }

        fpattendance.Sheets[0].RowCount++;
        fpattendance.Sheets[0].Cells[fpattendance.Sheets[0].RowCount - 1, 1].Text            = "Total";
        fpattendance.Sheets[0].Cells[fpattendance.Sheets[0].RowCount - 1, 1].Font.Bold       = true;
        fpattendance.Sheets[0].Cells[fpattendance.Sheets[0].RowCount - 1, 1].Font.Name       = "Book Antiqua";
        fpattendance.Sheets[0].Cells[fpattendance.Sheets[0].RowCount - 1, 1].HorizontalAlign = HorizontalAlign.Right;

        for (int tot = 2; tot < fpattendance.Sheets[0].ColumnCount; tot++)
        {
            int total = 0;
            for (int tot_row = 0; tot_row < fpattendance.Sheets[0].RowCount - 1; tot_row++)
            {
                total = total + Convert.ToInt32(fpattendance.Sheets[0].Cells[tot_row, tot].Text.ToString());
            }
            fpattendance.Sheets[0].Cells[fpattendance.Sheets[0].RowCount - 1, tot].Text = total.ToString();

            fpattendance.Sheets[0].Cells[fpattendance.Sheets[0].RowCount - 1, tot].HorizontalAlign = HorizontalAlign.Center;
            fpattendance.Sheets[0].Cells[fpattendance.Sheets[0].RowCount - 1, tot].Font.Bold       = true;
            fpattendance.Sheets[0].Cells[fpattendance.Sheets[0].RowCount - 1, tot].Font.Name       = "Book Antiqua";
            fpattendance.Sheets[0].Cells[fpattendance.Sheets[0].RowCount - 1, tot].Font.Size       = FontUnit.Medium;
        }


        Double totalRows = 0;

        totalRows = Convert.ToInt32(fpattendance.Sheets[0].RowCount);

        if (totalRows >= 10)
        {
            fpattendance.Sheets[0].PageSize = Convert.ToInt32(totalRows);

            fpattendance.Height = 350;
            fpattendance.VerticalScrollBarPolicy   = FarPoint.Web.Spread.ScrollBarPolicy.AsNeeded;
            fpattendance.HorizontalScrollBarPolicy = FarPoint.Web.Spread.ScrollBarPolicy.AsNeeded;
        }
        else if (totalRows == 0)
        {
            fpattendance.Height = 300;
        }
        else
        {
            fpattendance.Sheets[0].PageSize = Convert.ToInt32(totalRows);

            fpattendance.Height = 75 + (75 * Convert.ToInt32(totalRows));
        }


        Session["totalPages"] = (int)Math.Ceiling(totalRows / fpattendance.Sheets[0].PageSize);



        if (dr14.HasRows == false)
        {
            fpattendance.Visible   = false;
            lblexcel.Visible       = false;
            txtxl.Visible          = false;
            btnxl.Visible          = false;
            btnprintmaster.Visible = false;
            lblnorec.Visible       = true;
            lblnorec.Text          = "No Records Found!";
        }

        //fpattendance.Sheets[0].RowHeader.Cells[fpattendance.Sheets[0].RowCount - 1, 0].Text = " ";
    }
Ejemplo n.º 17
0
    public void Prioriry()
    {
        try
        {
            CreateGroup.Visible    = false;
            CreatePriority.Visible = true;
            CreateMapping.Visible  = false;
            string Query = "select GroupName,ITGroupPK,Priority from IT_GroupMaster where parentCode=0 and collegeCode ='" + ddlcolload.SelectedValue + "'";
            ds.Clear();
            ds = d2.select_method_wo_parameter(Query, "Text");
            if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                FpSpread1.Visible                         = true;
                FpSpread1.Sheets[0].RowCount              = 0;
                FpSpread1.Sheets[0].ColumnCount           = 0;
                FpSpread1.CommandBar.Visible              = false;
                FpSpread1.Sheets[0].AutoPostBack          = false;
                FpSpread1.Sheets[0].ColumnHeader.RowCount = 1;
                FpSpread1.Sheets[0].RowHeader.Visible     = false;
                FpSpread1.Sheets[0].ColumnCount           = 4;
                FarPoint.Web.Spread.StyleInfo darkstyle = new FarPoint.Web.Spread.StyleInfo();
                darkstyle.BackColor = ColorTranslator.FromHtml("#0CA6CA");
                darkstyle.ForeColor = Color.White;
                FpSpread1.ActiveSheetView.ColumnHeader.DefaultStyle = darkstyle;

                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].Text            = "S.No";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].Font.Bold       = true;
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].HorizontalAlign = HorizontalAlign.Center;
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].Font.Name       = "Book Antiqua";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].Font.Size       = FontUnit.Medium;
                FpSpread1.Columns[0].Locked = true;
                FpSpread1.Columns[0].Width  = 50;

                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 1].Text            = "Group Name";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 1].Font.Bold       = true;
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 1].HorizontalAlign = HorizontalAlign.Center;
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 1].Font.Name       = "Book Antiqua";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 1].Font.Size       = FontUnit.Medium;
                FpSpread1.Columns[1].Width = 200;

                FarPoint.Web.Spread.CheckBoxCellType chkall = new FarPoint.Web.Spread.CheckBoxCellType();
                chkall.AutoPostBack = true;

                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 2].Text            = "Set Priority";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 2].Font.Bold       = true;
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 2].HorizontalAlign = HorizontalAlign.Center;
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 2].Font.Name       = "Book Antiqua";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 2].Font.Size       = FontUnit.Medium;
                FpSpread1.Columns[2].Width = 75;

                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 3].Text            = "Priority";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 3].Font.Bold       = true;
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 3].HorizontalAlign = HorizontalAlign.Center;
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 3].Font.Name       = "Book Antiqua";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 3].Font.Size       = FontUnit.Medium;
                FpSpread1.Columns[3].Locked = true;
                FpSpread1.Columns[3].Width  = 75;

                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    FpSpread1.Sheets[0].RowCount++;
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Text            = Convert.ToString(i + 1);
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].HorizontalAlign = HorizontalAlign.Center;
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Font.Size       = FontUnit.Medium;
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Font.Name       = "Book Antiqua";

                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Text = Convert.ToString(ds.Tables[0].Rows[i]["GroupName"]);
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Tag  = Convert.ToString(ds.Tables[0].Rows[i]["ITGroupPK"]);

                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Font.Name       = "Book Antiqua";
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].HorizontalAlign = HorizontalAlign.Center;

                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].CellType        = chkall;
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Value           = 0;
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].HorizontalAlign = HorizontalAlign.Center;
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Font.Size       = FontUnit.Medium;
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Font.Name       = "Book Antiqua";

                    string Prioriry = Convert.ToString(ds.Tables[0].Rows[i]["Priority"]);
                    if (Prioriry.Trim() != "" && Prioriry.Trim() != "0")
                    {
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].Text   = Prioriry.ToString();
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].Locked = true;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Value  = 1;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Locked = true;
                    }
                    else
                    {
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].Text = "";
                    }
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].HorizontalAlign = HorizontalAlign.Center;
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].Font.Size       = FontUnit.Medium;
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].Font.Name       = "Book Antiqua";
                }
                FpSpread1.Visible            = true;
                FpSpread1.Sheets[0].PageSize = FpSpread1.Sheets[0].RowCount;
                FpSpread1.SaveChanges();
                FpSpread1.Height = 400;
                FpSpread1.Width  = 600;
                lblalert.Visible = false;
            }
            else
            {
                FpSpread1.Visible = false;
                imgdiv2.Visible   = true;
                lbl_alerterr.Text = "Not Updated";
            }
        }
        catch
        {
        }
    }
Ejemplo n.º 18
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (Session["collegecode"] == null) //Aruna For Back Button
            {
                Response.Redirect("~/Default.aspx");
            }
            errmsg.Visible = false;
            FpSpread1.SaveChanges();
            if (!IsPostBack)
            {
                FpSpread1.CommandBar.Visible  = false;
                FpSpread1.Sheets[0].SheetName = " ";
                FpSpread1.Sheets[0].SheetCorner.Columns[0].Visible = false;
                FpSpread1.Sheets[0].Columns.Default.VerticalAlign  = VerticalAlign.Middle;
                FpSpread1.Sheets[0].Rows.Default.HorizontalAlign   = HorizontalAlign.Left;
                FpSpread1.Sheets[0].Rows.Default.VerticalAlign     = VerticalAlign.Middle;
                FpSpread1.Sheets[0].DefaultStyle.Font.Name         = "Book Antiqua";
                FpSpread1.Sheets[0].DefaultStyle.Font.Size         = FontUnit.Medium;
                FpSpread1.Sheets[0].DefaultStyle.Font.Bold         = false;

                FarPoint.Web.Spread.StyleInfo style1 = new FarPoint.Web.Spread.StyleInfo();
                style1.Font.Size       = 12;
                style1.Font.Bold       = true;
                style1.HorizontalAlign = HorizontalAlign.Center;
                style1.ForeColor       = System.Drawing.Color.Black;
                FpSpread1.Sheets[0].SheetCornerStyle          = new FarPoint.Web.Spread.StyleInfo(style1);
                FpSpread1.Sheets[0].ColumnHeader.DefaultStyle = new FarPoint.Web.Spread.StyleInfo(style1);
                FpSpread1.Sheets[0].ColumnHeader.DefaultStyle.HorizontalAlign = HorizontalAlign.Center;
                FpSpread1.Sheets[0].AllowTableCorner = true;


                FpSpread1.Pager.Position  = FarPoint.Web.Spread.PagerPosition.Bottom;
                FpSpread1.Pager.Mode      = FarPoint.Web.Spread.PagerMode.Both;
                FpSpread1.Pager.Align     = HorizontalAlign.Right;
                FpSpread1.Pager.Font.Bold = true;
                FpSpread1.Pager.Font.Name = "Book Antiqua";
                FpSpread1.Pager.ForeColor = System.Drawing.Color.DarkGreen;
                FpSpread1.Pager.BackColor = System.Drawing.Color.Beige;
                FpSpread1.Pager.BackColor = System.Drawing.Color.AliceBlue;
                FpSpread1.Pager.PageCount = 5;
                FpSpread1.Visible         = false;


                FpSpread1.Pager.Position  = FarPoint.Web.Spread.PagerPosition.Bottom;
                FpSpread1.Pager.Mode      = FarPoint.Web.Spread.PagerMode.Both;
                FpSpread1.Pager.Align     = HorizontalAlign.Left;
                FpSpread1.Pager.Font.Bold = true;
                FpSpread1.Pager.Font.Name = "Book Antiqua";
                FpSpread1.Pager.ForeColor = Color.DarkGreen;
                // FpSpread1.Pager.BackColor = Color.Beige;
                // FpSpread1.Pager.BackColor = Color.AliceBlue;
                FpSpread1.Sheets[0].Columns.Default.VerticalAlign       = VerticalAlign.Middle;
                FpSpread1.Sheets[0].Rows.Default.HorizontalAlign        = HorizontalAlign.Left;
                FpSpread1.Sheets[0].Rows.Default.VerticalAlign          = VerticalAlign.Middle;
                FpSpread1.Sheets[0].DefaultStyle.Font.Name              = "Book Antiqua";
                FpSpread1.Sheets[0].DefaultStyle.Font.Size              = FontUnit.Medium;
                FpSpread1.Sheets[0].DefaultStyle.Font.Bold              = false;
                FpSpread1.SheetCorner.Columns[0].Visible                = false;
                FpSpread1.Sheets[0].ColumnHeader.DefaultStyle.Font.Name = "Book Antiqua";
                FpSpread1.Sheets[0].DefaultStyle.Font.Bold              = false;
                FpSpread1.Sheets[0].DefaultStyle.Font.Size              = FontUnit.Medium;

                loadstage();
            }
        }
        catch
        {
        }
    }
Ejemplo n.º 19
0
    protected void btngo_Click(object sender, EventArgs e)
    {
        try
        {
            clear();
            fpsalary.CommandBar.Visible                = false;
            fpsalary.Sheets[0].RowCount                = 0;
            fpsalary.Sheets[0].ColumnCount             = 0;
            fpsalary.Sheets[0].SheetCorner.ColumnCount = 0;
            fpsalary.Sheets[0].ColumnCount             = 15;
            fpsalary.Sheets[0].ColumnHeader.RowCount   = 1;

            fpsalary.Sheets[0].ColumnHeader.Rows[0].BackColor = Color.AliceBlue;

            fpsalary.Sheets[0].SheetName = " ";
            fpsalary.Sheets[0].Columns.Default.VerticalAlign = VerticalAlign.Middle;
            fpsalary.Sheets[0].Rows.Default.HorizontalAlign  = HorizontalAlign.Center;
            fpsalary.Sheets[0].Rows.Default.VerticalAlign    = VerticalAlign.Middle;
            fpsalary.Sheets[0].DefaultStyle.Font.Name        = "Book Antiqua";
            fpsalary.Sheets[0].DefaultStyle.Font.Size        = FontUnit.Medium;
            fpsalary.Sheets[0].DefaultStyle.Font.Bold        = false;
            FarPoint.Web.Spread.StyleInfo style1 = new FarPoint.Web.Spread.StyleInfo();
            style1.Font.Size       = 12;
            style1.Font.Bold       = true;
            style1.HorizontalAlign = HorizontalAlign.Center;
            style1.ForeColor       = Color.Black;
            style1.BackColor       = ColorTranslator.FromHtml("#0CA6CA");
            fpsalary.Sheets[0].SheetCornerStyle          = new FarPoint.Web.Spread.StyleInfo(style1);
            fpsalary.Sheets[0].ColumnHeader.DefaultStyle = new FarPoint.Web.Spread.StyleInfo(style1);
            fpsalary.Sheets[0].ColumnHeader.DefaultStyle.HorizontalAlign = HorizontalAlign.Center;
            fpsalary.Sheets[0].AllowTableCorner = true;
            fpsalary.Pager.Position             = FarPoint.Web.Spread.PagerPosition.Bottom;
            fpsalary.Pager.Mode         = FarPoint.Web.Spread.PagerMode.Both;
            fpsalary.Pager.Align        = HorizontalAlign.Right;
            fpsalary.Pager.Font.Bold    = true;
            fpsalary.Pager.Font.Name    = "Book Antiqua";
            fpsalary.Pager.ForeColor    = Color.DarkGreen;
            fpsalary.Pager.BackColor    = Color.Beige;
            fpsalary.Pager.BackColor    = Color.AliceBlue;
            fpsalary.Pager.PageCount    = 5;
            fpsalary.CommandBar.Visible = false;

            fpsalary.Sheets[0].ColumnHeader.Cells[0, 0].Text  = "S.No";
            fpsalary.Sheets[0].ColumnHeader.Cells[0, 1].Text  = "Staff Code";
            fpsalary.Sheets[0].ColumnHeader.Cells[0, 2].Text  = "Staff Name";
            fpsalary.Sheets[0].ColumnHeader.Cells[0, 3].Text  = "Department";
            fpsalary.Sheets[0].ColumnHeader.Cells[0, 4].Text  = "Designation";
            fpsalary.Sheets[0].ColumnHeader.Cells[0, 5].Text  = "Category";
            fpsalary.Sheets[0].ColumnHeader.Cells[0, 6].Text  = "Type";
            fpsalary.Sheets[0].ColumnHeader.Cells[0, 7].Text  = "Date Of Joining";
            fpsalary.Sheets[0].ColumnHeader.Cells[0, 8].Text  = "PF Join Date";
            fpsalary.Sheets[0].ColumnHeader.Cells[0, 9].Text  = "Date Of Relive";
            fpsalary.Sheets[0].ColumnHeader.Cells[0, 10].Text = "Father/Husband Name";
            fpsalary.Sheets[0].ColumnHeader.Cells[0, 11].Text = "Date Of Birth";
            fpsalary.Sheets[0].ColumnHeader.Cells[0, 12].Text = "Age";
            fpsalary.Sheets[0].ColumnHeader.Cells[0, 13].Text = "PF A/C Number";
            fpsalary.Sheets[0].ColumnHeader.Cells[0, 14].Text = "Remarks";

            fpsalary.Sheets[0].Columns[0].HorizontalAlign  = HorizontalAlign.Center;
            fpsalary.Sheets[0].Columns[1].HorizontalAlign  = HorizontalAlign.Left;
            fpsalary.Sheets[0].Columns[2].HorizontalAlign  = HorizontalAlign.Left;
            fpsalary.Sheets[0].Columns[3].HorizontalAlign  = HorizontalAlign.Left;
            fpsalary.Sheets[0].Columns[4].HorizontalAlign  = HorizontalAlign.Left;
            fpsalary.Sheets[0].Columns[5].HorizontalAlign  = HorizontalAlign.Left;
            fpsalary.Sheets[0].Columns[6].HorizontalAlign  = HorizontalAlign.Left;
            fpsalary.Sheets[0].Columns[7].HorizontalAlign  = HorizontalAlign.Left;
            fpsalary.Sheets[0].Columns[8].HorizontalAlign  = HorizontalAlign.Left;
            fpsalary.Sheets[0].Columns[9].HorizontalAlign  = HorizontalAlign.Left;
            fpsalary.Sheets[0].Columns[10].HorizontalAlign = HorizontalAlign.Left;
            fpsalary.Sheets[0].Columns[11].HorizontalAlign = HorizontalAlign.Left;
            fpsalary.Sheets[0].Columns[12].HorizontalAlign = HorizontalAlign.Left;
            fpsalary.Sheets[0].Columns[13].HorizontalAlign = HorizontalAlign.Left;

            fpsalary.Sheets[0].Columns[0].Width  = 50;
            fpsalary.Sheets[0].Columns[1].Width  = 200;
            fpsalary.Sheets[0].Columns[2].Width  = 200;
            fpsalary.Sheets[0].Columns[3].Width  = 200;
            fpsalary.Sheets[0].Columns[4].Width  = 200;
            fpsalary.Sheets[0].Columns[5].Width  = 200;
            fpsalary.Sheets[0].Columns[6].Width  = 200;
            fpsalary.Sheets[0].Columns[7].Width  = 80;
            fpsalary.Sheets[0].Columns[8].Width  = 80;
            fpsalary.Sheets[0].Columns[9].Width  = 80;
            fpsalary.Sheets[0].Columns[10].Width = 200;
            fpsalary.Sheets[0].Columns[11].Width = 80;
            fpsalary.Sheets[0].Columns[12].Width = 200;
            fpsalary.Sheets[0].Columns[13].Width = 80;

            FarPoint.Web.Spread.TextCellType txt = new FarPoint.Web.Spread.TextCellType();

            fpsalary.Sheets[0].Columns[0].CellType  = txt;
            fpsalary.Sheets[0].Columns[1].CellType  = txt;
            fpsalary.Sheets[0].Columns[2].CellType  = txt;
            fpsalary.Sheets[0].Columns[3].CellType  = txt;
            fpsalary.Sheets[0].Columns[4].CellType  = txt;
            fpsalary.Sheets[0].Columns[5].CellType  = txt;
            fpsalary.Sheets[0].Columns[6].CellType  = txt;
            fpsalary.Sheets[0].Columns[7].CellType  = txt;
            fpsalary.Sheets[0].Columns[8].CellType  = txt;
            fpsalary.Sheets[0].Columns[9].CellType  = txt;
            fpsalary.Sheets[0].Columns[10].CellType = txt;
            fpsalary.Sheets[0].Columns[11].CellType = txt;
            fpsalary.Sheets[0].Columns[12].CellType = txt;
            fpsalary.Sheets[0].Columns[13].CellType = txt;

            fpsalary.Width = 1200;

            string strdeptcode = "";
            for (int i = 0; i < chklsdept.Items.Count; i++)
            {
                if (chklsdept.Items[i].Selected == true)
                {
                    if (strdeptcode == "")
                    {
                        strdeptcode = "'" + chklsdept.Items[i].Value + "'";
                    }
                    else
                    {
                        strdeptcode = strdeptcode + ",'" + chklsdept.Items[i].Value + "'";
                    }
                }
            }
            if (strdeptcode.Trim() != "")
            {
                strdeptcode = " and st.dept_code in(" + strdeptcode + ")";
            }

            string strdesignquery = "";
            for (int i = 0; i < chklsdesgination.Items.Count; i++)
            {
                if (chklsdesgination.Items[i].Selected == true)
                {
                    if (strdesignquery == "")
                    {
                        strdesignquery = "'" + chklsdesgination.Items[i].Value + "'";
                    }
                    else
                    {
                        strdesignquery = strdesignquery + ",'" + chklsdesgination.Items[i].Value + "'";
                    }
                }
            }
            if (strdesignquery.Trim() != "")
            {
                strdesignquery = " and st.desig_code in(" + strdesignquery + ")";
            }

            string strcatequery = "";
            for (int i = 0; i < chklscategory.Items.Count; i++)
            {
                if (chklscategory.Items[i].Selected == true)
                {
                    if (strcatequery == "")
                    {
                        strcatequery = "'" + chklscategory.Items[i].Value + "'";
                    }
                    else
                    {
                        strcatequery = strcatequery + ",'" + chklscategory.Items[i].Value + "'";
                    }
                }
            }
            if (strcatequery.Trim() != "")
            {
                strcatequery = " and st.category_code in(" + strcatequery + ")";
            }

            string strtypequery = "";
            for (int i = 0; i < chklsstafftype.Items.Count; i++)
            {
                if (chklsstafftype.Items[i].Selected == true)
                {
                    if (strtypequery == "")
                    {
                        strtypequery = "'" + chklsstafftype.Items[i].Value + "'";
                    }
                    else
                    {
                        strtypequery = strtypequery + ",'" + chklsstafftype.Items[i].Value + "'";
                    }
                }
            }
            if (strtypequery.Trim() != "")
            {
                strtypequery = " and st.stftype in(" + strtypequery + ")";
            }

            string strquery = "select s.staff_code,LEN(s.staff_code),s.staff_name,sa.father_name,sa.husband_name,sa.sex,convert(nvarchar(15),sa.date_of_birth,103) dob,convert(nvarchar(15),s.relieve_date,103) relivedate,convert(nvarchar(15),s.join_date,103) joindate,h.dept_name,d.desig_name,sc.category_name,st.stftype,s.Is_PF,s.pfnumber from staffmaster s,stafftrans st,hrdept_master h,desig_master d,staffcategorizer sc,staff_appl_master sa  where sa.appl_no=s.appl_no and s.staff_code=st.staff_code and st.dept_code=h.dept_code and st.desig_code=d.desig_code and st.category_code=sc.category_code and st.latestrec=1 ";
            if (ddltype.Text.ToString() == "New Staff List")
            {
                fpsalary.Sheets[0].Columns[9].Visible  = false;
                fpsalary.Sheets[0].Columns[7].Visible  = true;
                fpsalary.Sheets[0].Columns[8].Visible  = true;
                fpsalary.Sheets[0].Columns[11].Visible = true;
                fpsalary.Sheets[0].Columns[12].Visible = true;
                strquery = strquery + " and MONTH(s.join_date) = '" + ddlmonth.SelectedValue.ToString() + "' AND YEAR(s.join_date) = '" + ddlyear.SelectedItem.ToString() + "'";
            }
            else
            {
                fpsalary.Sheets[0].Columns[9].Visible  = true;
                fpsalary.Sheets[0].Columns[7].Visible  = false;
                fpsalary.Sheets[0].Columns[8].Visible  = false;
                fpsalary.Sheets[0].Columns[11].Visible = false;
                fpsalary.Sheets[0].Columns[12].Visible = false;
                strquery = strquery + " and MONTH(s.relieve_date) = '" + ddlmonth.SelectedValue.ToString() + "' AND YEAR(s.relieve_date) = '" + ddlyear.SelectedItem.ToString() + "' and ((s.resign=1 and s.settled=1) or (s.Discontinue=1))";
            }
            strquery = strquery + strdeptcode + strdesignquery + strcatequery + strtypequery + " order by s.join_date,LEN(s.staff_code),s.staff_code,s.staff_name";
            ds.Dispose();
            ds.Reset();
            ds.Clear();
            ds = d2.select_method_wo_parameter(strquery, "Text");
            if (ds.Tables[0].Rows.Count > 0)
            {
                fpsalary.Visible       = true;
                lblexcel.Visible       = true;
                txtexcel.Visible       = true;
                btnprintmaster.Visible = true;
                btnexcel.Visible       = true;
                int srno = 0;
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    string staffcode  = ds.Tables[0].Rows[i]["staff_code"].ToString();
                    string name       = ds.Tables[0].Rows[i]["staff_name"].ToString();
                    string dob        = ds.Tables[0].Rows[i]["dob"].ToString();
                    string jdate      = ds.Tables[0].Rows[i]["joindate"].ToString();
                    string deptname   = ds.Tables[0].Rows[i]["dept_name"].ToString();
                    string designname = ds.Tables[0].Rows[i]["desig_name"].ToString();
                    string catname    = ds.Tables[0].Rows[i]["category_name"].ToString();
                    string stftypenme = ds.Tables[0].Rows[i]["stftype"].ToString();
                    string fname      = ds.Tables[0].Rows[i]["father_name"].ToString();
                    string hname      = ds.Tables[0].Rows[i]["husband_name"].ToString();
                    if (hname.Trim() != "" && hname == null)
                    {
                        fname = hname;
                    }
                    string   pfnumber   = ds.Tables[0].Rows[i]["pfnumber"].ToString();
                    string   relivedate = ds.Tables[0].Rows[i]["relivedate"].ToString();
                    string   age        = "";
                    string[] spdate     = dob.Split('/');
                    if (spdate.GetUpperBound(0) == 2)
                    {
                        int      curemonth = 0, cureyear;
                        DateTime dtdob = Convert.ToDateTime(spdate[1] + '/' + spdate[0] + '/' + spdate[2]);
                        DateTime dtnow = DateTime.Now;
                        int      cury  = Convert.ToInt32(dtnow.ToString("yyyy"));
                        int      jyear = Convert.ToInt32(dtdob.ToString("yyyy"));
                        cureyear = cury - jyear;

                        int curmon = Convert.ToInt32(dtnow.ToString("MM"));
                        int jmon   = Convert.ToInt32(dtdob.ToString("MM"));
                        if (curmon < jmon)
                        {
                            curemonth = (curmon + 12) - jmon;
                            cureyear--;
                        }
                        else
                        {
                            curemonth = curmon - jmon;
                        }
                        age = cureyear.ToString() + " Years ";
                        if (curemonth > 0)
                        {
                            age = age + curemonth + " Months";
                        }
                    }

                    fpsalary.Sheets[0].RowCount++;
                    srno++;
                    fpsalary.Sheets[0].Cells[fpsalary.Sheets[0].RowCount - 1, 0].Text  = srno.ToString();
                    fpsalary.Sheets[0].Cells[fpsalary.Sheets[0].RowCount - 1, 1].Text  = staffcode.ToString();
                    fpsalary.Sheets[0].Cells[fpsalary.Sheets[0].RowCount - 1, 2].Text  = name.ToString();
                    fpsalary.Sheets[0].Cells[fpsalary.Sheets[0].RowCount - 1, 3].Text  = deptname.ToString();
                    fpsalary.Sheets[0].Cells[fpsalary.Sheets[0].RowCount - 1, 4].Text  = designname.ToString();
                    fpsalary.Sheets[0].Cells[fpsalary.Sheets[0].RowCount - 1, 5].Text  = catname.ToString();
                    fpsalary.Sheets[0].Cells[fpsalary.Sheets[0].RowCount - 1, 6].Text  = stftypenme.ToString();
                    fpsalary.Sheets[0].Cells[fpsalary.Sheets[0].RowCount - 1, 7].Text  = jdate.ToString();
                    fpsalary.Sheets[0].Cells[fpsalary.Sheets[0].RowCount - 1, 8].Text  = jdate.ToString();
                    fpsalary.Sheets[0].Cells[fpsalary.Sheets[0].RowCount - 1, 9].Text  = relivedate.ToString();
                    fpsalary.Sheets[0].Cells[fpsalary.Sheets[0].RowCount - 1, 10].Text = fname.ToString();
                    fpsalary.Sheets[0].Cells[fpsalary.Sheets[0].RowCount - 1, 11].Text = dob.ToString();
                    fpsalary.Sheets[0].Cells[fpsalary.Sheets[0].RowCount - 1, 12].Text = age.ToString();
                    fpsalary.Sheets[0].Cells[fpsalary.Sheets[0].RowCount - 1, 13].Text = pfnumber.ToString();
                }
            }
            else
            {
                errmsg.Text    = "No Records Found";
                errmsg.Visible = true;
            }
            fpsalary.Sheets[0].PageSize = fpsalary.Sheets[0].RowCount;
        }
        catch (Exception ex)
        {
            errmsg.Visible = true;
            errmsg.Text    = ex.ToString();
            d2.sendErrorMail(ex, "13", "StaffSalarydetails.aspx");
        }
    }
    protected void btn_go_Click(object sender, EventArgs e)
    {
        try
        {
            hide();

            FpSpread1.Sheets[0].RowCount     = 0;
            FpSpread1.Sheets[0].ColumnCount  = 0;
            FpSpread1.CommandBar.Visible     = false;
            FpSpread1.Sheets[0].AutoPostBack = true;
            FpSpread1.Height = 1000;
            FpSpread1.Width  = 600;
            FpSpread1.Sheets[0].ColumnHeader.RowCount = 1;
            FpSpread1.Sheets[0].RowHeader.Visible     = false;
            FpSpread1.Sheets[0].ColumnCount           = 8;
            FarPoint.Web.Spread.StyleInfo darkstyle = new FarPoint.Web.Spread.StyleInfo();
            darkstyle.BackColor = ColorTranslator.FromHtml("#0CA6CA");
            darkstyle.ForeColor = Color.White;
            FpSpread1.ActiveSheetView.ColumnHeader.DefaultStyle = darkstyle;
            FpSpread1.Visible = true;
            FarPoint.Web.Spread.CheckBoxCellType chkall = new FarPoint.Web.Spread.CheckBoxCellType();
            FarPoint.Web.Spread.CheckBoxCellType chk    = new FarPoint.Web.Spread.CheckBoxCellType();
            chkall.AutoPostBack = false;

            string selqry = "select category,shortname,status,LeaveMasterPK from leave_category where college_Code='" + collegecode1 + "'";
            ds.Clear();
            ds = d2.select_method_wo_parameter(selqry, "text");

            if (ds.Tables[0].Rows.Count > 0)
            {
                FpSpread1.Sheets[0].Rows.Count = ds.Tables[0].Rows.Count;
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    FpSpread1.Sheets[0].Cells[i, 3].CellType = chk;
                    FpSpread1.Sheets[0].Cells[i, 4].CellType = chk;
                    FpSpread1.Sheets[0].Cells[i, 5].CellType = chk;
                    FpSpread1.Sheets[0].Cells[i, 6].CellType = chk;
                    FpSpread1.Sheets[0].Cells[i, 3].Locked   = true;
                    FpSpread1.Sheets[0].Cells[i, 4].Locked   = true;
                    FpSpread1.Sheets[0].Cells[i, 5].Locked   = true;
                    FpSpread1.Sheets[0].Cells[i, 6].Locked   = true;

                    FpSpread1.Sheets[0].Cells[i, 0].Text      = Convert.ToString(i + 1);
                    FpSpread1.Sheets[0].Cells[i, 0].Font.Name = "Book Antiqua";
                    FpSpread1.Sheets[0].Cells[i, 1].Text      = ds.Tables[0].Rows[i]["category"].ToString();
                    FpSpread1.Sheets[0].Cells[i, 1].Font.Name = "Book Antiqua";
                    FpSpread1.Sheets[0].Cells[i, 2].Text      = ds.Tables[0].Rows[i]["shortname"].ToString();
                    FpSpread1.Sheets[0].Cells[i, 2].Font.Name = "Book Antiqua";
                    FpSpread1.Sheets[0].Cells[i, 7].Value     = ds.Tables[0].Rows[i]["LeaveMasterPK"].ToString();
                    FpSpread1.Sheets[0].Cells[i, 7].Font.Name = "Book Antiqua";

                    FpSpread1.Sheets[0].Cells[i, 3].Font.Name = "Book Antiqua";
                    FpSpread1.Sheets[0].Cells[i, 4].Font.Name = "Book Antiqua";
                    FpSpread1.Sheets[0].Cells[i, 5].Font.Name = "Book Antiqua";
                    string statusss = ds.Tables[0].Rows[i]["status"].ToString();
                    if (statusss.Trim() == "2")
                    {
                        FpSpread1.Sheets[0].Cells[i, 3].Value = 1;
                    }
                    if (statusss.Trim() == "0")
                    {
                        FpSpread1.Sheets[0].Cells[i, 4].Value = 1;
                    }
                    if (statusss.Trim() == "1")
                    {
                        FpSpread1.Sheets[0].Cells[i, 5].Value = 1;
                    }
                }
                FpSpread1.Sheets[0].ColumnHeader.Columns[0].Width = 60;
                FpSpread1.Sheets[0].ColumnHeader.Columns[1].Width = 244;
                FpSpread1.Sheets[0].ColumnHeader.Columns[2].Width = 150;
                FpSpread1.Sheets[0].ColumnHeader.Columns[3].Width = 102;
                FpSpread1.Sheets[0].ColumnHeader.Columns[4].Width = 102;
                FpSpread1.Sheets[0].ColumnHeader.Columns[5].Width = 102;
                FpSpread1.Sheets[0].ColumnHeader.Columns[6].Width = 102;

                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].Text      = "S.No";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].Font.Bold = true;
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].Font.Name = "Book Antiqua";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 1].Text      = "Leave Name";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 1].Font.Bold = true;
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 1].Font.Name = "Book Antiqua";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 2].Text      = "Short Form";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 2].Font.Bold = true;
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 2].Font.Name = "Book Antiqua";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 3].Text      = "Earn Leave";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 3].Font.Bold = true;
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 3].Font.Name = "Book Antiqua";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 4].Text      = "Treated As Present";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 4].Font.Bold = true;
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 4].Font.Name = "Book Antiqua";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 5].Text      = "Treated As LOP";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 5].Font.Bold = true;
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 5].Font.Name = "Book Antiqua";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 6].Text      = "Select";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 6].Font.Bold = true;
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 6].Font.Name = "Book Antiqua";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 7].Text      = "Id";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 7].Font.Bold = true;
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 7].Font.Name = "Book Antiqua";
                FpSpread1.Sheets[0].Columns[7].Visible = false;
                FpSpread1.Sheets[0].Columns[6].Visible = false;
                for (int i = 0; i < FpSpread1.Sheets[0].Columns.Count; i++)
                {
                    FpSpread1.Sheets[0].ColumnHeader.Columns[i].HorizontalAlign = HorizontalAlign.Center;
                    FpSpread1.Sheets[0].ColumnHeader.Columns[i].Font.Name       = "Book Antiqua";
                    FpSpread1.Sheets[0].ColumnHeader.Columns[i].Font.Bold       = true;
                    FpSpread1.Sheets[0].ColumnHeader.Columns[i].Font.Size       = FontUnit.Medium;
                    FpSpread1.Sheets[0].Columns[i].HorizontalAlign = HorizontalAlign.Center;
                }
                FpSpread1.Sheets[0].Columns[1].HorizontalAlign = HorizontalAlign.Left;
                FpSpread1.Sheets[0].Columns[2].HorizontalAlign = HorizontalAlign.Left;

                FpSpread1.SaveChanges();
                FpSpread1.Sheets[0].PageSize = ds.Tables[0].Rows.Count;
                FpSpread1.Visible            = true;
                addnew.Visible    = false;
                div1.Visible      = true;
                rptprint.Visible  = true;
                lbl_error.Visible = false;
            }
            else
            {
                lbl_error.Visible = true;
                lbl_error.Text    = "No Records Found";
            }
        }
        catch (Exception ex)
        {
            d2.sendErrorMail(ex, collegecode1, "LeaveMaster_Alter.aspx");
        }
    }
Ejemplo n.º 21
0
    protected void btn_go_Click(object sender, EventArgs e)
    {
        string collcode = Convert.ToString(ddlclg.SelectedItem.Value);

        try
        {
            int count = 0;
            for (int i = 0; i < cbl_dptname.Items.Count; i++)
            {
                if (cbl_dptname.Items[i].Selected == true)
                {
                    count++;
                }
            }
            if (count == 0)
            {
                lbl_alert.Text    = "Please Select Atleast One Department";
                lbl_alert.Visible = true;
                imgdiv2.Visible   = true;
                hide();
                return;
            }
            string deptcod = "";
            if (cbl_dptname.Items.Count > 0)
            {
                for (int i = 0; i < cbl_dptname.Items.Count; i++)
                {
                    if (cbl_dptname.Items[i].Selected == true)
                    {
                        if (deptcod == "")
                        {
                            deptcod = Convert.ToString(cbl_dptname.Items[i].Value);
                        }
                        else
                        {
                            deptcod = deptcod + "','" + Convert.ToString(cbl_dptname.Items[i].Value);
                        }
                    }
                }
            }

            count = 0;
            string   sql   = "";
            DataView dvfil = new DataView();
            Fpspread1.Sheets[0].Rows.Count    = 0;
            Fpspread1.Sheets[0].Columns.Count = 6;
            Fpspread1.Height                      = 340;
            Fpspread1.Width                       = 800;
            Fpspread1.CommandBar.Visible          = false;
            Fpspread1.Sheets[0].RowHeader.Visible = false;
            Fpspread1.Sheets[0].AutoPostBack      = false;
            FarPoint.Web.Spread.StyleInfo darkstyle = new FarPoint.Web.Spread.StyleInfo();
            darkstyle.BackColor = ColorTranslator.FromHtml("#0CA6CA");
            darkstyle.ForeColor = Color.White;
            Fpspread1.ActiveSheetView.ColumnHeader.DefaultStyle = darkstyle;
            Fpspread1.Sheets[0].ColumnHeader.Columns[0].Width   = 75;
            Fpspread1.Sheets[0].ColumnHeader.Columns[1].Width   = 310;
            Fpspread1.Sheets[0].ColumnHeader.Columns[2].Width   = 100;
            Fpspread1.Sheets[0].ColumnHeader.Columns[3].Width   = 100;
            Fpspread1.Sheets[0].ColumnHeader.Columns[4].Width   = 100;
            Fpspread1.Sheets[0].ColumnHeader.Columns[5].Width   = 100;

            Fpspread1.Sheets[0].ColumnHeader.Cells[0, 0].Text = "S.No";
            Fpspread1.Sheets[0].ColumnHeader.Cells[0, 1].Text = "Designation";
            Fpspread1.Sheets[0].ColumnHeader.Cells[0, 2].Text = "Available Staff";
            Fpspread1.Sheets[0].ColumnHeader.Cells[0, 3].Text = "No.of Req Staff";
            Fpspread1.Sheets[0].ColumnHeader.Cells[0, 4].Text = "No.of Vacancy";
            Fpspread1.Sheets[0].ColumnHeader.Cells[0, 5].Text = "No.of Additional Req Staff";

            FarPoint.Web.Spread.DoubleCellType intgrcel = new FarPoint.Web.Spread.DoubleCellType();
            intgrcel.FormatString = System.Windows.Forms.MaskFormat.ExcludePromptAndLiterals.ToString();
            intgrcel.MinimumValue = 0;
            intgrcel.ErrorMessage = "Enter valid Required Staff";
            string desigcod = d2.GetFunction(" Select desig_code from desig_master where desig_name='" + txt_search.Text.ToString() + "' and collegeCode='" + collcode + "'");
            string selquery = "";

            selquery = "select t.desig_code,t.dept_code,count(s.staff_code)as count from staffmaster s,stafftrans  t where s.staff_code =t.staff_code and t.latestrec ='1' and resign=0 and settled =0 and isnull(Discontinue,'0') ='0'  and s.college_code ='" + collcode + "' group by t.desig_code,t.dept_code";
            selquery = selquery + " select DeptCode,DesigCode,No_ofPersons from VacancyMaster where Collegecode ='" + collcode + "'";
            DataSet dsnew = new DataSet();
            dsnew.Clear();
            dsnew = d2.select_method_wo_parameter(selquery, "Text");
            int sno      = 1;
            int rowcount = 0;
            if (cbl_dptname.Items.Count > 0 && txt_dptname.Text.Trim() != "--Select--")
            {
                for (int st = 0; st < cbl_dptname.Items.Count; st++)
                {
                    if (cbl_dptname.Items[st].Selected == true)
                    {
                        rowcount = 0;
                        Fpspread1.Sheets[0].RowCount++;
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 0].Text            = Convert.ToString(cbl_dptname.Items[st].Text);
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 0].HorizontalAlign = HorizontalAlign.Center;
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 0].Font.Name       = "Book Antiqua";
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 0].Font.Bold       = true;
                        Fpspread1.Sheets[0].SpanModel.Add(Fpspread1.Sheets[0].RowCount - 1, 0, 1, 6);

                        string selq = "select desig_code,desig_name from desig_master where ((dept_code like '" + Convert.ToString(cbl_dptname.Items[st].Value) + ";%') or (dept_code like '%;" + Convert.ToString(cbl_dptname.Items[st].Value) + "%') or (dept_code like '%" + Convert.ToString(cbl_dptname.Items[st].Value) + "') or (dept_code='" + Convert.ToString(cbl_dptname.Items[st].Value) + "'))";

                        ds.Clear();
                        ds = d2.select_method_wo_parameter(selq, "Text");
                        if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                        {
                            for (int ik = 0; ik < ds.Tables[0].Rows.Count; ik++)
                            {
                                if (txt_search.Text.Trim() != "")
                                {
                                    if (Convert.ToString(ds.Tables[0].Rows[ik]["desig_code"]) == desigcod)
                                    {
                                        rowcount++;
                                        Fpspread1.Sheets[0].RowCount++;
                                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 0].Text            = Convert.ToString(sno++);
                                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 0].HorizontalAlign = HorizontalAlign.Center;
                                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 0].Font.Name       = "Book Antiqua";

                                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 1].Text            = Convert.ToString(txt_search.Text.Trim());
                                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 1].Tag             = Convert.ToString(desigcod);
                                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 1].Note            = Convert.ToString(cbl_dptname.Items[st].Value);
                                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 1].HorizontalAlign = HorizontalAlign.Left;
                                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 1].Font.Name       = "Book Antiqua";
                                        if (dsnew.Tables.Count > 0 && dsnew.Tables[0].Rows.Count > 0)
                                        {
                                            DataView dvnew = new DataView();
                                            dsnew.Tables[0].DefaultView.RowFilter = " dept_code='" + Convert.ToString(cbl_dptname.Items[st].Value) + "' and desig_code='" + desigcod + "'";
                                            dvnew = dsnew.Tables[0].DefaultView;
                                            if (dvnew.Count > 0)
                                            {
                                                Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 2].Text = Convert.ToString(dvnew[0]["count"]);
                                            }
                                            else
                                            {
                                                Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 2].Text = "-";
                                            }
                                        }
                                        else
                                        {
                                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 2].Text = "-";
                                        }
                                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 2].HorizontalAlign = HorizontalAlign.Center;
                                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 2].Font.Name       = "Book Antiqua";

                                        if (dsnew.Tables.Count > 0 && dsnew.Tables[1].Rows.Count > 0)
                                        {
                                            DataView dvmynew = new DataView();
                                            dsnew.Tables[1].DefaultView.RowFilter = " DeptCode='" + Convert.ToString(cbl_dptname.Items[st].Value) + "' and DesigCode='" + desigcod + "'";
                                            dvmynew = dsnew.Tables[1].DefaultView;
                                            if (dvmynew.Count > 0)
                                            {
                                                Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 3].Text = Convert.ToString(dvmynew[0]["No_ofPersons"]);
                                            }
                                            else
                                            {
                                                Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 3].Text = "-";
                                            }
                                        }
                                        else
                                        {
                                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 3].Text = "-";
                                        }
                                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 3].HorizontalAlign = HorizontalAlign.Center;
                                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 3].Font.Name       = "Book Antiqua";
                                        Double availcount = 0;
                                        Double noofreq    = 0;
                                        Double.TryParse(Convert.ToString(Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 2].Text), out availcount);
                                        Double.TryParse(Convert.ToString(Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 3].Text), out noofreq);

                                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 4].Text            = Convert.ToString(noofreq - availcount);
                                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 4].HorizontalAlign = HorizontalAlign.Center;
                                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 4].Font.Name       = "Book Antiqua";

                                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 5].CellType        = intgrcel;
                                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 5].HorizontalAlign = HorizontalAlign.Center;
                                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 5].Font.Name       = "Book Antiqua";
                                    }
                                }
                                else
                                {
                                    for (int jk = 0; jk < cbl_desname.Items.Count; jk++)
                                    {
                                        if (cbl_desname.Items[jk].Selected == true)
                                        {
                                            if (Convert.ToString(ds.Tables[0].Rows[ik]["desig_code"]) == Convert.ToString(cbl_desname.Items[jk].Value))
                                            {
                                                rowcount++;
                                                Fpspread1.Sheets[0].RowCount++;
                                                Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 0].Text            = Convert.ToString(sno++);
                                                Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 0].HorizontalAlign = HorizontalAlign.Center;
                                                Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 0].Font.Name       = "Book Antiqua";

                                                Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 1].Text            = Convert.ToString(cbl_desname.Items[jk].Text);
                                                Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 1].Tag             = Convert.ToString(cbl_desname.Items[jk].Value);
                                                Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 1].Note            = Convert.ToString(cbl_dptname.Items[st].Value);
                                                Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 1].HorizontalAlign = HorizontalAlign.Left;
                                                Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 1].Font.Name       = "Book Antiqua";
                                                if (dsnew.Tables.Count > 0 && dsnew.Tables[0].Rows.Count > 0)
                                                {
                                                    DataView dvnew = new DataView();
                                                    dsnew.Tables[0].DefaultView.RowFilter = " dept_code='" + Convert.ToString(cbl_dptname.Items[st].Value) + "' and desig_code='" + Convert.ToString(cbl_desname.Items[jk].Value) + "'";
                                                    dvnew = dsnew.Tables[0].DefaultView;
                                                    if (dvnew.Count > 0)
                                                    {
                                                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 2].Text = Convert.ToString(dvnew[0]["count"]);
                                                    }
                                                    else
                                                    {
                                                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 2].Text = "-";
                                                    }
                                                }
                                                else
                                                {
                                                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 2].Text = "-";
                                                }
                                                Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 2].HorizontalAlign = HorizontalAlign.Center;
                                                Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 2].Font.Name       = "Book Antiqua";

                                                if (dsnew.Tables.Count > 0 && dsnew.Tables[1].Rows.Count > 0)
                                                {
                                                    DataView dvmynew = new DataView();
                                                    dsnew.Tables[1].DefaultView.RowFilter = " DeptCode='" + Convert.ToString(cbl_dptname.Items[st].Value) + "' and DesigCode='" + Convert.ToString(cbl_desname.Items[jk].Value) + "'";
                                                    dvmynew = dsnew.Tables[1].DefaultView;
                                                    if (dvmynew.Count > 0)
                                                    {
                                                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 3].Text = Convert.ToString(dvmynew[0]["No_ofPersons"]);
                                                    }
                                                    else
                                                    {
                                                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 3].Text = "-";
                                                    }
                                                }
                                                else
                                                {
                                                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 3].Text = "-";
                                                }
                                                Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 3].HorizontalAlign = HorizontalAlign.Center;
                                                Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 3].Font.Name       = "Book Antiqua";
                                                Double availcount = 0;
                                                Double noofreq    = 0;
                                                Double.TryParse(Convert.ToString(Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 2].Text), out availcount);
                                                Double.TryParse(Convert.ToString(Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 3].Text), out noofreq);

                                                Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 4].Text            = Convert.ToString(noofreq - availcount);
                                                Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 4].HorizontalAlign = HorizontalAlign.Center;
                                                Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 4].Font.Name       = "Book Antiqua";

                                                Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 5].CellType        = intgrcel;
                                                Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 5].HorizontalAlign = HorizontalAlign.Center;
                                                Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 5].Font.Name       = "Book Antiqua";
                                            }
                                        }
                                    }
                                }
                            }
                            if (rowcount == 0)
                            {
                                Fpspread1.Sheets[0].Rows[Fpspread1.Sheets[0].RowCount - 1].Remove();
                            }
                        }
                        else
                        {
                            Fpspread1.Sheets[0].Rows[Fpspread1.Sheets[0].RowCount - 1].Remove();
                        }
                    }
                }
            }

            for (int ii = 0; ii < Fpspread1.Sheets[0].Columns.Count; ii++)
            {
                Fpspread1.Sheets[0].ColumnHeader.Columns[ii].HorizontalAlign = HorizontalAlign.Center;
                Fpspread1.Sheets[0].ColumnHeader.Columns[ii].Font.Name       = "Book Antiqua";
                Fpspread1.Sheets[0].ColumnHeader.Columns[ii].Font.Bold       = true;
                Fpspread1.Sheets[0].ColumnHeader.Columns[ii].Font.Size       = FontUnit.Medium;
            }
            for (int kl = 0; kl < Fpspread1.Sheets[0].ColumnCount - 1; kl++)
            {
                Fpspread1.Sheets[0].Columns[kl].Locked = true;
            }
            if (Fpspread1.Sheets[0].RowCount > 1)
            {
                Fpspread1.Visible = true;
                rptprint.Visible  = true;
                div1.Visible      = true;

                Fpspread1.Sheets[0].PageSize = Fpspread1.Sheets[0].RowCount;
                Fpspread1.SaveChanges();
                txt_search.Text = "";
            }
            else
            {
                txt_search.Text   = "";
                lbl_alert.Text    = "No Records Found";
                lbl_alert.Visible = true;
                imgdiv2.Visible   = true;
                hide();
            }
            //}
            //else
            //{
            //    txt_search.Text = "";
            //    lbl_alert.Text = "No Records Found";
            //    lbl_alert.Visible = true;
            //    imgdiv2.Visible = true;
            //    hide();
            //}
        }
        catch (Exception ex)
        {
            d2.sendErrorMail(ex, collcode, "manpower_Alter.aspx");
        }
    }
Ejemplo n.º 22
0
    protected void btngoclick(object sender, EventArgs e)
    {
        try
        {
            Printcontrol.Visible = false;
            string hostelname = "";
            for (int i = 0; i < ddlhos.Items.Count; i++)
            {
                if (ddlhos.Items.Count > 0)
                {
                    hostelname = ddlhos.SelectedItem.Text;
                }
            }

            string vendor = "";
            for (int i = 0; i < Cblven.Items.Count; i++)
            {
                if (Cblven.Items[i].Selected == true)
                {
                    if (vendor == "")
                    {
                        vendor = "" + Cblven.Items[i].Value.ToString() + "";
                    }
                    else
                    {
                        vendor = vendor + "'" + "," + "'" + Cblven.Items[i].Value.ToString() + "";
                    }
                }
            }
            string itemname = "";
            for (int i = 0; i < Cblitm.Items.Count; i++)
            {
                if (Cblitm.Items[i].Selected == true)
                {
                    if (itemname == "")
                    {
                        itemname = "" + Cblitm.Items[i].Value.ToString() + "";
                    }
                    else
                    {
                        itemname = itemname + "'" + "," + "'" + Cblitm.Items[i].Value.ToString() + "";
                    }
                }
            }
            string   firstdate  = Convert.ToString(txtfrom.Text);
            string   seconddate = Convert.ToString(txtto.Text);
            DateTime dt         = new DateTime();
            DateTime dt1        = new DateTime();
            string[] split      = firstdate.Split('/');
            dt    = Convert.ToDateTime(split[1] + "/" + split[0] + "/" + split[2]);
            split = seconddate.Split('/');
            dt1   = Convert.ToDateTime(split[1] + "/" + split[0] + "/" + split[2]);
            DataView dv = new DataView();
            if (vendor.Trim() != "" && itemname.Trim() != "")
            {
                // string q = "select distinct  v.vendor_code, item_name,i.item_code,i.item_unit,(app_qty-isnull(waiting_app_qty,0)) as app_qty,(app_qty-isnull(waiting_app_qty,0))- ISNULL(inward_qty,0) as rej_qty,inward_qty,rpu ,(rpu * inward_qty)as value,gi_date from item_master i,vendor_details v,Vendor_ItemDetails vi ,purchase_order p,purchaseorder_items pi,goods_inward g,goodsinward_items gi where v.vendor_code =vi.Vendor_Code and i.item_code =vi.Item_Code and p.order_code =pi.order_code and pi.item_code =i.item_code and pi.item_code =vi.Item_Code and vi.Vendor_Code =pi.vendor_code and pi.vendor_code =v.vendor_code and order_approval ='Approved' and goods_in ='1' and g.gi_code =gi.gi_code and gi.item_code =i.item_code and gi.item_code =vi.Item_Code and gi.item_code =pi.item_code and g.Order_Code =p.order_code and v.vendor_code in ('" + vendor + "') and i.item_code in ('" + itemname + "') and g.gi_date between '" + dt.ToString("MM/dd/yyyy") + "' and '" + dt1.ToString("MM/dd/yyyy") + "' order by v.vendor_code, i.item_code";

                string q = " select p.OrderCode,i.ItemPK,i.ItemName,i.ItemCode,i.ItemUnit,(pi.RPU*g.InwardQty) as value,pi.RPU,convert(varchar(10),g.GoodsInwardDate,103) as GoodsInwardDate,v.VendorPK,(pi.AppQty -ISNULL(pi.RejQty,0))as appQty,g.InwardQty,((pi.AppQty -ISNULL(pi.RejQty,0))-InwardQty) as Pending from IM_ItemMaster i,CO_VendorMaster v,IT_PurchaseOrder p,IT_PurchaseOrderDetail pi,IT_GoodsInward g where v.VendorPK =p.VendorFK and p.PurchaseOrderPK =pi.PurchaseOrderFK and i.ItemPK =pi.ItemFK and g.PurchaseOrderFK =p.PurchaseOrderPK and g.itemfk =i.ItemPK and ApproveStatus ='1' and InwardStatus ='1' and g.GoodsInwardDate between '" + dt.ToString("MM/dd/yyyy") + "' and '" + dt1.ToString("MM/dd/yyyy") + "' and i.ItemPK in ('" + itemname + "') and v.VendorPK in ('" + vendor + "')  order by OrderCode ";
                ds = da.select_method_wo_parameter(q, "Text");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    spreaddiv.Visible                         = true;
                    FpSpread1.Sheets[0].RowCount              = 0;
                    FpSpread1.Sheets[0].ColumnCount           = 0;
                    FpSpread1.CommandBar.Visible              = false;
                    FpSpread1.Sheets[0].AutoPostBack          = true;
                    FpSpread1.Sheets[0].ColumnHeader.RowCount = 1;
                    FpSpread1.Sheets[0].RowHeader.Visible     = false;
                    FpSpread1.Sheets[0].ColumnCount           = 9;
                    FarPoint.Web.Spread.StyleInfo darkstyle = new FarPoint.Web.Spread.StyleInfo();
                    darkstyle.BackColor = ColorTranslator.FromHtml("#0CA6CA");
                    darkstyle.ForeColor = Color.White;
                    FpSpread1.ActiveSheetView.ColumnHeader.DefaultStyle = darkstyle;

                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].Text            = "S.No";
                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].Font.Bold       = true;
                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].HorizontalAlign = HorizontalAlign.Center;
                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].Font.Name       = "Book Antiqua";
                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].Font.Size       = FontUnit.Medium;
                    FpSpread1.Sheets[0].Columns[0].Width = 50;

                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 1].Text            = "Item Code";
                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 1].Font.Bold       = true;
                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 1].HorizontalAlign = HorizontalAlign.Center;
                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 1].Font.Name       = "Book Antiqua";
                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 1].Font.Size       = FontUnit.Medium;
                    FpSpread1.Sheets[0].Columns[1].Width = 100;

                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 2].Text            = "Item Name";
                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 2].Font.Bold       = true;
                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 2].HorizontalAlign = HorizontalAlign.Center;
                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 2].Font.Name       = "Book Antiqua";
                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 2].Font.Size       = FontUnit.Medium;
                    FpSpread1.Sheets[0].Columns[2].Width = 200;

                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 3].Text            = "Item Measure";
                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 3].Font.Bold       = true;
                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 3].HorizontalAlign = HorizontalAlign.Center;
                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 3].Font.Name       = "Book Antiqua";
                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 3].Font.Size       = FontUnit.Medium;
                    FpSpread1.Sheets[0].Columns[3].Width = 100;

                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 4].Text            = "Rate Per Unit";
                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 4].Font.Bold       = true;
                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 4].HorizontalAlign = HorizontalAlign.Center;
                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 4].Font.Name       = "Book Antiqua";
                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 4].Font.Size       = FontUnit.Medium;
                    FpSpread1.Sheets[0].Columns[4].Width = 100;

                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 5].Text            = "Approved Quantity";
                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 5].Font.Bold       = true;
                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 5].HorizontalAlign = HorizontalAlign.Center;
                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 5].Font.Name       = "Book Antiqua";
                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 5].Font.Size       = FontUnit.Medium;
                    FpSpread1.Sheets[0].Columns[5].Width = 100;
                    FpSpread1.Columns[5].ForeColor       = Color.Blue;

                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 6].Text            = "Received Quantity";
                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 6].Font.Bold       = true;
                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 6].HorizontalAlign = HorizontalAlign.Center;
                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 6].Font.Name       = "Book Antiqua";
                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 6].Font.Size       = FontUnit.Medium;
                    FpSpread1.Sheets[0].Columns[6].Width = 100;
                    FpSpread1.Columns[6].ForeColor       = Color.Green;

                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 7].Text            = "Pending Quantity";
                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 7].Font.Bold       = true;
                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 7].HorizontalAlign = HorizontalAlign.Center;
                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 7].Font.Name       = "Book Antiqua";
                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 7].Font.Size       = FontUnit.Medium;
                    FpSpread1.Sheets[0].Columns[7].Width = 100;
                    FpSpread1.Columns[7].ForeColor       = Color.Red;

                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 8].Text            = "Total Value";
                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 8].Font.Bold       = true;
                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 8].HorizontalAlign = HorizontalAlign.Center;
                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 8].Font.Name       = "Book Antiqua";
                    FpSpread1.Sheets[0].ColumnHeader.Cells[0, 8].Font.Size       = FontUnit.Medium;
                    FpSpread1.Sheets[0].Columns[8].Width = 100;
                    int sno = 0;
                    for (int ir = 0; ir < Cblven.Items.Count; ir++)
                    {
                        if (Cblven.Items[ir].Selected == true)
                        {
                            split = firstdate.Split('/');
                            dt    = Convert.ToDateTime(split[1] + "/" + split[0] + "/" + split[2]);
                            split = seconddate.Split('/');
                            dt1   = Convert.ToDateTime(split[1] + "/" + split[0] + "/" + split[2]);

                            while (dt <= dt1)
                            {
                                ds.Tables[0].DefaultView.RowFilter = "VendorPK='" + Cblven.Items[ir].Value + "' and GoodsInwardDate='" + dt.ToString("dd/MM/yyyy") + "' ";
                                dv = ds.Tables[0].DefaultView;
                                if (dv.Count > 0)
                                {
                                    FpSpread1.Sheets[0].RowCount++;
                                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Text            = Convert.ToString(Cblven.Items[ir].Text) + " - " + Convert.ToString(dt.ToString("dd/MM/yyyy"));
                                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].HorizontalAlign = HorizontalAlign.Center;
                                    FpSpread1.Sheets[0].SpanModel.Add(FpSpread1.Sheets[0].RowCount - 1, 0, 1, FpSpread1.Sheets[0].ColumnCount);
                                    for (int rd = 0; rd < dv.Count; rd++)
                                    {
                                        sno++;
                                        FpSpread1.Sheets[0].RowCount++;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Text            = Convert.ToString(sno);
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].HorizontalAlign = HorizontalAlign.Center;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Font.Size       = FontUnit.Medium;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Font.Name       = "Book Antiqua";

                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Text            = Convert.ToString(dv[rd]["ItemCode"]);
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].HorizontalAlign = HorizontalAlign.Left;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Font.Size       = FontUnit.Medium;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Font.Name       = "Book Antiqua";

                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Text            = Convert.ToString(dv[rd]["ItemName"]);
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].HorizontalAlign = HorizontalAlign.Left;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Font.Size       = FontUnit.Medium;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Font.Name       = "Book Antiqua";

                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].Text            = Convert.ToString(dv[rd]["ItemUnit"]);
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].HorizontalAlign = HorizontalAlign.Left;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].Font.Size       = FontUnit.Medium;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].Font.Name       = "Book Antiqua";

                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 4].Text            = Convert.ToString(dv[rd]["RPU"]);
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 4].HorizontalAlign = HorizontalAlign.Center;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 4].Font.Size       = FontUnit.Medium;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 4].Font.Name       = "Book Antiqua";

                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 5].Text            = Convert.ToString(dv[rd]["appQty"]);
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 5].HorizontalAlign = HorizontalAlign.Center;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 5].Font.Size       = FontUnit.Medium;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 5].Font.Name       = "Book Antiqua";

                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 6].Text            = Convert.ToString(dv[rd]["InwardQty"]);
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 6].HorizontalAlign = HorizontalAlign.Center;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 6].Font.Size       = FontUnit.Medium;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 6].Font.Name       = "Book Antiqua";

                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 7].Text            = Convert.ToString(dv[rd]["Pending"]);
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 7].HorizontalAlign = HorizontalAlign.Center;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 7].Font.Size       = FontUnit.Medium;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 7].Font.Name       = "Book Antiqua";
                                        if (Convert.ToString(dv[rd]["Pending"]) != "0")
                                        {
                                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 7].ForeColor = Color.Red;
                                        }

                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 8].Text            = Convert.ToString(dv[rd]["value"]);
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 8].HorizontalAlign = HorizontalAlign.Center;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 8].Font.Size       = FontUnit.Medium;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 8].Font.Name       = "Book Antiqua";
                                    }
                                }
                                dt = dt.AddDays(1);
                            }
                        }
                    }

                    FpSpread1.Sheets[0].PageSize = FpSpread1.Sheets[0].RowCount;
                    spreaddiv.Visible            = true;
                    lblerror.Visible             = false;
                    rptprint.Visible             = true;
                }
                else
                {
                    lblerror.Visible  = true;
                    lblerror.Text     = "No Record Found";
                    spreaddiv.Visible = false;
                    rptprint.Visible  = false;
                }
            }
            else
            {
                lblerror.Visible  = true;
                lblerror.Text     = "Please Select All Fields";
                spreaddiv.Visible = false;
                rptprint.Visible  = false;
            }
        }
        catch
        {
        }
    }
Ejemplo n.º 23
0
    protected void btn_go_Click(object sender, EventArgs e)
    {
        try
        {
            Printcontrol.Visible = false;
            Hashtable totalvalue_dic = new Hashtable();
            if (txt_seat.Text != "--Select--" && txt_degree.Text != "--Select--" && txt_branch.Text != "--Select--")
            {
                Fpspread1.Sheets[0].RowCount              = 0;
                Fpspread1.Sheets[0].ColumnCount           = 0;
                Fpspread1.CommandBar.Visible              = false;
                Fpspread1.Sheets[0].AutoPostBack          = true;
                Fpspread1.Sheets[0].ColumnHeader.RowCount = 1;
                Fpspread1.Sheets[0].RowHeader.Visible     = false;
                Fpspread1.Sheets[0].Columns.Count         = 2;

                string   firstdate  = Convert.ToString(txt_fromdate.Text);
                string   seconddate = Convert.ToString(txt_todate.Text);
                string[] split      = firstdate.Split('/');
                dt = Convert.ToDateTime(split[1] + "/" + split[0] + "/" + split[2]);
                string[] split1 = seconddate.Split('/');
                dt1 = Convert.ToDateTime(split1[1] + "/" + split1[0] + "/" + split1[2]);

                FarPoint.Web.Spread.StyleInfo darkstyle = new FarPoint.Web.Spread.StyleInfo();
                darkstyle.BackColor = ColorTranslator.FromHtml("#0CA6CA");
                darkstyle.ForeColor = Color.White;
                Fpspread1.ActiveSheetView.ColumnHeader.DefaultStyle = darkstyle;

                Fpspread1.Sheets[0].ColumnHeader.Cells[0, 0].Text            = "S.No";
                Fpspread1.Sheets[0].ColumnHeader.Cells[0, 0].Font.Bold       = true;
                Fpspread1.Sheets[0].ColumnHeader.Cells[0, 0].Font.Name       = "Book Antiqua";
                Fpspread1.Sheets[0].ColumnHeader.Cells[0, 0].Font.Size       = FontUnit.Medium;
                Fpspread1.Sheets[0].ColumnHeader.Cells[0, 0].HorizontalAlign = HorizontalAlign.Center;
                Fpspread1.Columns[0].Width = 50;

                Fpspread1.Sheets[0].ColumnHeader.Cells[0, 1].Text            = lbl_branch.Text;
                Fpspread1.Sheets[0].ColumnHeader.Cells[0, 1].Font.Bold       = true;
                Fpspread1.Sheets[0].ColumnHeader.Cells[0, 1].Font.Name       = "Book Antiqua";
                Fpspread1.Sheets[0].ColumnHeader.Cells[0, 1].Font.Size       = FontUnit.Medium;
                Fpspread1.Sheets[0].ColumnHeader.Cells[0, 1].HorizontalAlign = HorizontalAlign.Center;
                Fpspread1.Columns[1].Width = 200;
                if (cbl_seat.Items.Count > 0)
                {
                    for (i = 0; i < cbl_seat.Items.Count; i++)
                    {
                        if (cbl_seat.Items[i].Selected == true)
                        {
                            Fpspread1.Sheets[0].ColumnCount++;
                            Fpspread1.Sheets[0].ColumnHeader.Cells[0, Fpspread1.Sheets[0].ColumnCount - 1].Text            = Convert.ToString(cbl_seat.Items[i].Text);
                            Fpspread1.Sheets[0].ColumnHeader.Cells[0, Fpspread1.Sheets[0].ColumnCount - 1].Tag             = Convert.ToString(cbl_seat.Items[i].Value);
                            Fpspread1.Sheets[0].ColumnHeader.Cells[0, Fpspread1.Sheets[0].ColumnCount - 1].Font.Bold       = true;
                            Fpspread1.Sheets[0].ColumnHeader.Cells[0, Fpspread1.Sheets[0].ColumnCount - 1].Font.Name       = "Book Antiqua";
                            Fpspread1.Sheets[0].ColumnHeader.Cells[0, Fpspread1.Sheets[0].ColumnCount - 1].Font.Size       = FontUnit.Medium;
                            Fpspread1.Sheets[0].ColumnHeader.Cells[0, Fpspread1.Sheets[0].ColumnCount - 1].HorizontalAlign = HorizontalAlign.Center;
                            Fpspread1.Columns[Fpspread1.Sheets[0].ColumnCount - 1].Width = 160;
                        }
                    }
                }
                Fpspread1.Sheets[0].ColumnCount++;
                Fpspread1.Sheets[0].ColumnHeader.Cells[0, Fpspread1.Sheets[0].ColumnCount - 1].Text            = "Available";
                Fpspread1.Sheets[0].ColumnHeader.Cells[0, Fpspread1.Sheets[0].ColumnCount - 1].Font.Bold       = true;
                Fpspread1.Sheets[0].ColumnHeader.Cells[0, Fpspread1.Sheets[0].ColumnCount - 1].Font.Name       = "Book Antiqua";
                Fpspread1.Sheets[0].ColumnHeader.Cells[0, Fpspread1.Sheets[0].ColumnCount - 1].Font.Size       = FontUnit.Medium;
                Fpspread1.Sheets[0].ColumnHeader.Cells[0, Fpspread1.Sheets[0].ColumnCount - 1].HorizontalAlign = HorizontalAlign.Center;
                Fpspread1.Columns[Fpspread1.Sheets[0].ColumnCount - 1].Width = 150;
                if (cbl_branch.Items.Count > 0)
                {
                    q1  = "";
                    q1  = " select count(seattype) countseat,seattype,degree_code from applyn where date_applied between '" + dt.ToString("MM/dd/yyyy") + "' and '" + dt1.ToString("MM/dd/yyyy") + "' group by seattype,degree_code";
                    q1 += "  select d.No_Of_seats,COUNT(r.degree_code)filled,(d.No_Of_seats-COUNT(r.degree_code)) available,r.degree_code from Registration r, Degree d,department dt,course c where c.Course_Id=d.Course_Id and dt.Dept_Code=d.Dept_Code and c.college_code=d.college_code and dt.college_code=d.college_code and r.degree_code=d.Degree_Code and r.college_code=d.college_code and r.Batch_Year='" + ddl_batch.SelectedItem.Value + "' and r.college_code='" + Convert.ToString(ddl_college.SelectedValue) + "' group by r.degree_code ,No_Of_seats";

                    ds.Clear();
                    ds = d2.select_method_wo_parameter(q1, "text");
                    int r = 1; int availabletotal = 0;
                    for (i = 0; i < cbl_branch.Items.Count; i++)
                    {
                        if (cbl_branch.Items[i].Selected == true)
                        {
                            Fpspread1.Sheets[0].RowCount++;
                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 0].Text            = Convert.ToString(r++);
                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 0].HorizontalAlign = HorizontalAlign.Center;
                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 0].Font.Size       = FontUnit.Medium;
                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 0].Font.Name       = "Book Antiqua";
                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 1].Text            = Convert.ToString(cbl_branch.Items[i].Text);
                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 1].Tag             = Convert.ToString(cbl_branch.Items[i].Value);
                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 1].HorizontalAlign = HorizontalAlign.Left;
                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 1].Font.Size       = FontUnit.Medium;
                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 1].Font.Name       = "Book Antiqua";
                            for (int k = 2; k < Fpspread1.Sheets[0].ColumnHeader.Columns.Count - 1; k++)
                            {
                                string seattypevalue = Convert.ToString(Fpspread1.Sheets[0].ColumnHeader.Cells[0, k].Tag);
                                if (ds.Tables[0].Rows.Count > 0)
                                {
                                    ds.Tables[0].DefaultView.RowFilter = " seattype='" + seattypevalue + "'and degree_code=" + Convert.ToString(cbl_branch.Items[i].Value) + " ";
                                    DataView dv = ds.Tables[0].DefaultView;
                                    if (dv.Count > 0)
                                    {
                                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, k].Text = Convert.ToString(dv[0]["countseat"]);
                                        if (totalvalue_dic.Contains(seattypevalue))
                                        {
                                            string value = totalvalue_dic[seattypevalue].ToString();
                                            totalvalue_dic.Remove(seattypevalue);
                                            int total = Convert.ToInt32(value) + Convert.ToInt32(dv[0]["countseat"]);
                                            totalvalue_dic.Add(seattypevalue, total);
                                        }
                                        else
                                        {
                                            totalvalue_dic.Add(seattypevalue, Convert.ToInt32(dv[0]["countseat"]));
                                        }
                                    }
                                    else
                                    {
                                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, k].Text = "0";
                                    }
                                }
                                else
                                {
                                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, k].Text = "0";
                                }
                                Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, k].HorizontalAlign = HorizontalAlign.Center;
                                Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, k].Font.Size       = FontUnit.Medium;
                                Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, k].Font.Name       = "Book Antiqua";
                            }
                            ds.Tables[1].DefaultView.RowFilter = " degree_code='" + Convert.ToString(cbl_branch.Items[i].Value) + "'";
                            DataView dv1      = ds.Tables[1].DefaultView;
                            string   avilable = "";
                            if (dv1.Count > 0)
                            {
                                avilable = dv1[0]["available"].ToString();
                                Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, Fpspread1.Sheets[0].ColumnHeader.Columns.Count - 1].Text = avilable;
                                availabletotal += Convert.ToInt32(avilable);
                            }
                            else
                            {
                                Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, Fpspread1.Sheets[0].ColumnHeader.Columns.Count - 1].Text = "0";
                            }
                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, Fpspread1.Sheets[0].ColumnHeader.Columns.Count - 1].HorizontalAlign = HorizontalAlign.Center;
                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, Fpspread1.Sheets[0].ColumnHeader.Columns.Count - 1].Font.Size       = FontUnit.Medium;
                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, Fpspread1.Sheets[0].ColumnHeader.Columns.Count - 1].Font.Name       = "Book Antiqua";
                        }
                    }
                    Fpspread1.Sheets[0].RowCount++;
                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 1].Text            = "Grant Total";
                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 1].HorizontalAlign = HorizontalAlign.Center;
                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 1].Font.Size       = FontUnit.Medium;
                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 1].Font.Name       = "Book Antiqua";
                    for (int k = 2; k < Fpspread1.Sheets[0].ColumnHeader.Columns.Count - 1; k++)
                    {
                        string seattypevalue = Convert.ToString(Fpspread1.Sheets[0].ColumnHeader.Cells[0, k].Tag);
                        if (totalvalue_dic.Count > 0)
                        {
                            string value = "";
                            if (totalvalue_dic.Contains(seattypevalue))
                            {
                                value = totalvalue_dic[seattypevalue].ToString();
                            }
                            else
                            {
                                value = "0";
                            }
                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, k].Text            = value;
                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, k].HorizontalAlign = HorizontalAlign.Center;
                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, k].Font.Size       = FontUnit.Medium;
                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, k].Font.Name       = "Book Antiqua";
                        }
                    }
                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, Fpspread1.Sheets[0].ColumnHeader.Columns.Count - 1].Text            = availabletotal.ToString();
                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, Fpspread1.Sheets[0].ColumnHeader.Columns.Count - 1].HorizontalAlign = HorizontalAlign.Center;
                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, Fpspread1.Sheets[0].ColumnHeader.Columns.Count - 1].Font.Size       = FontUnit.Medium;
                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, Fpspread1.Sheets[0].ColumnHeader.Columns.Count - 1].Font.Name       = "Book Antiqua";
                    Fpspread1.Sheets[0].Rows[Fpspread1.Sheets[0].RowCount - 1].BackColor = Color.Bisque;
                    Fpspread1.Sheets[0].Rows[Fpspread1.Sheets[0].RowCount - 1].ForeColor = Color.IndianRed;

                    Fpspread1.Sheets[0].PageSize = Fpspread1.Sheets[0].RowCount;
                    Fpspread1.Visible            = true;
                    rptprint.Visible             = true;
                    lbl_error.Visible            = false;
                }
            }
            else
            {
                lbl_error.Visible = true;
                lbl_error.Text    = "Please select All Fields";
                Fpspread1.Visible = false;
                rptprint.Visible  = false;
            }
        }
        catch (Exception ex)
        {
            lbl_error.Visible = true;
            lbl_error.Text    = ex.ToString();
            d2.sendErrorMail(ex, collegecode1, "Enquiry_report");
        }
    }
Ejemplo n.º 24
0
    protected void btn_go_Click(object sender, EventArgs e)
    {
        try
        {
            string itemheadercode = "";
            for (int i = 0; i < cbl_itemname.Items.Count; i++)
            {
                if (cbl_itemname.Items[i].Selected == true)
                {
                    if (itemheadercode == "")
                    {
                        itemheadercode = "" + cbl_itemname.Items[i].Value.ToString() + "";
                    }
                    else
                    {
                        itemheadercode = itemheadercode + "'" + "," + "'" + cbl_itemname.Items[i].Value.ToString() + "";
                    }
                }
            }

            if (itemheadercode.Trim() != "")
            {
                string selectquery = "";

                if (txt_searchby.Text.Trim() != "")
                {
                    selectquery = "select i.item_code,i.item_name,CONVERT(varchar(10), RPUdate,103) as RPUdate,RPU from ItemRateMaster im,item_master i where i.item_code =im.item_Code and i.item_name ='" + txt_searchby.Text + "'";
                }
                else if (txt_searchitemcode.Text.Trim() != "")
                {
                    selectquery = "select i.item_code,i.item_name,CONVERT(varchar(10), RPUdate,103) as RPUdate,RPU from ItemRateMaster im,item_master i where i.item_code =im.item_Code and i.item_code ='" + txt_searchitemcode.Text + "'";
                }
                else if (txt_searchheadername.Text.Trim() != "")
                {
                    selectquery = "select i.item_code,i.item_name,CONVERT(varchar(10), RPUdate,103) as RPUdate,RPU from ItemRateMaster im,item_master i where i.item_code =im.item_Code and i.itemheader_name ='" + txt_searchheadername.Text + "'";
                }
                else
                {
                    selectquery = "select i.item_code,i.item_name,CONVERT(varchar(10), RPUdate,103) as RPUdate,RPU from ItemRateMaster im,item_master i where i.item_code =im.item_Code and i.item_code in ('" + itemheadercode + "') ";
                }

                ds.Clear();
                ds = d2.select_method_wo_parameter(selectquery, "Text");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    Fpspread1.Sheets[0].RowCount              = 0;
                    Fpspread1.Sheets[0].ColumnCount           = 0;
                    Fpspread1.CommandBar.Visible              = false;
                    Fpspread1.Sheets[0].AutoPostBack          = true;
                    Fpspread1.Sheets[0].ColumnHeader.RowCount = 1;
                    Fpspread1.Sheets[0].RowHeader.Visible     = false;
                    Fpspread1.Sheets[0].ColumnCount           = 5;
                    FarPoint.Web.Spread.StyleInfo darkstyle = new FarPoint.Web.Spread.StyleInfo();
                    darkstyle.BackColor = ColorTranslator.FromHtml("#0CA6CA");
                    darkstyle.ForeColor = Color.White;
                    Fpspread1.ActiveSheetView.ColumnHeader.DefaultStyle = darkstyle;

                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 0].Text            = "S.No";
                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 0].Font.Bold       = true;
                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 0].Font.Name       = "Book Antiqua";
                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 0].Font.Size       = FontUnit.Medium;
                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 0].HorizontalAlign = HorizontalAlign.Center;
                    Fpspread1.Columns[0].Width = 50;

                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 1].Text            = "Item Code";
                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 1].Font.Bold       = true;
                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 1].Font.Name       = "Book Antiqua";
                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 1].Font.Size       = FontUnit.Medium;
                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 1].HorizontalAlign = HorizontalAlign.Center;
                    Fpspread1.Columns[1].Width = 100;

                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 2].Text            = "Item Name";
                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 2].Font.Bold       = true;
                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 2].Font.Name       = "Book Antiqua";
                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 2].Font.Size       = FontUnit.Medium;
                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 2].HorizontalAlign = HorizontalAlign.Center;
                    Fpspread1.Columns[2].Width = 200;

                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 3].Text            = "Date";
                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 3].Font.Bold       = true;
                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 3].Font.Name       = "Book Antiqua";
                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 3].Font.Size       = FontUnit.Medium;
                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 3].HorizontalAlign = HorizontalAlign.Center;

                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 4].Text            = "Cost Per Unit";
                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 4].Font.Bold       = true;
                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 4].Font.Name       = "Book Antiqua";
                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 4].Font.Size       = FontUnit.Medium;
                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 4].HorizontalAlign = HorizontalAlign.Center;

                    for (int row = 0; row < ds.Tables[0].Rows.Count; row++)
                    {
                        Fpspread1.Sheets[0].RowCount++;
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 0].Text            = Convert.ToString(row + 1);
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 0].HorizontalAlign = HorizontalAlign.Center;
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 0].Font.Size       = FontUnit.Medium;
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 0].Font.Name       = "Book Antiqua";
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 1].Text            = Convert.ToString(ds.Tables[0].Rows[row]["item_code"]);
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 1].HorizontalAlign = HorizontalAlign.Left;
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 1].Font.Size       = FontUnit.Medium;
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 1].Font.Name       = "Book Antiqua";

                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 2].Text = Convert.ToString(ds.Tables[0].Rows[row]["item_name"]);
                        //Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 2].Tag = Convert.ToString(ds.Tables[0].Rows[row]["rpu"]);
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 2].HorizontalAlign = HorizontalAlign.Left;
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 2].Font.Size       = FontUnit.Medium;
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 2].Font.Name       = "Book Antiqua";

                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 3].Text = Convert.ToString(ds.Tables[0].Rows[row]["RPUdate"]);
                        // Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 3].Tag = Convert.ToString(ds.Tables[0].Rows[row]["Stock_Value"]);
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 3].HorizontalAlign = HorizontalAlign.Left;
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 3].Font.Size       = FontUnit.Medium;
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 3].Font.Name       = "Book Antiqua";

                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 4].Text            = Convert.ToString(ds.Tables[0].Rows[row]["RPU"]);
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 4].HorizontalAlign = HorizontalAlign.Right;
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 4].Font.Size       = FontUnit.Medium;
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 4].Font.Name       = "Book Antiqua";
                    }
                    Fpspread1.Visible            = true;
                    rptprint.Visible             = true;
                    div1.Visible                 = true;
                    lbl_error.Visible            = false;
                    Fpspread1.Sheets[0].PageSize = Fpspread1.Sheets[0].RowCount;
                }
                else
                {
                    div1.Visible      = false;
                    Fpspread1.Visible = false;
                    rptprint.Visible  = false;
                    lbl_error.Visible = true;
                    lbl_error.Text    = "No Records Found";
                }
            }
            else
            {
                div1.Visible      = false;
                Fpspread1.Visible = false;
                rptprint.Visible  = false;
                imgdiv2.Visible   = true;

                lbl_alert.Visible = true;
                lbl_alert.Text    = "Please Select Any one Item Name";
                // lbl_error.Visible = true;
                //  lbl_error.Text = "Please Select Any one Item Name";
            }
        }
        catch
        {
        }
    }
Ejemplo n.º 25
0
    protected void btn_go_Click(object sender, EventArgs e)
    {
        try
        {
            lbl_error.Visible = false;
            FpSpread1.SaveChanges();
            FpSpread1.Sheets[0].RowCount              = 0;
            FpSpread1.Sheets[0].ColumnCount           = 0;
            FpSpread1.CommandBar.Visible              = false;
            FpSpread1.Sheets[0].AutoPostBack          = true;
            FpSpread1.Sheets[0].ColumnHeader.RowCount = 1;
            FpSpread1.Sheets[0].RowHeader.Visible     = false;
            FpSpread1.Sheets[0].ColumnCount           = 4;
            FarPoint.Web.Spread.StyleInfo darkstyle = new FarPoint.Web.Spread.StyleInfo();
            darkstyle.BackColor = ColorTranslator.FromHtml("#0CA6CA");
            darkstyle.ForeColor = Color.White;
            FpSpread1.ActiveSheetView.ColumnHeader.DefaultStyle          = darkstyle;
            FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].Text            = "S.No";
            FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].Font.Bold       = true;
            FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].HorizontalAlign = HorizontalAlign.Center;
            FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].Font.Name       = "Book Antiqua";
            FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].Font.Size       = FontUnit.Medium;
            FpSpread1.Sheets[0].Columns[0].HorizontalAlign               = HorizontalAlign.Center;
            FpSpread1.Sheets[0].ColumnHeader.Cells[0, 1].Text            = "Header";
            FpSpread1.Sheets[0].ColumnHeader.Cells[0, 1].Font.Bold       = true;
            FpSpread1.Sheets[0].ColumnHeader.Cells[0, 1].Font.Name       = "Book Antiqua";
            FpSpread1.Sheets[0].ColumnHeader.Cells[0, 1].Font.Size       = FontUnit.Medium;
            FpSpread1.Sheets[0].ColumnHeader.Cells[0, 1].HorizontalAlign = HorizontalAlign.Center;
            FpSpread1.Sheets[0].ColumnHeader.Cells[0, 2].Text            = "Questions";
            FpSpread1.Sheets[0].ColumnHeader.Cells[0, 2].Font.Bold       = true;
            FpSpread1.Sheets[0].ColumnHeader.Cells[0, 2].Font.Name       = "Book Antiqua";
            FpSpread1.Sheets[0].ColumnHeader.Cells[0, 2].Font.Size       = FontUnit.Medium;
            FpSpread1.Sheets[0].ColumnHeader.Cells[0, 2].HorizontalAlign = HorizontalAlign.Center;
            FpSpread1.Sheets[0].ColumnHeader.Cells[0, 3].Text            = "Question Option";
            FpSpread1.Sheets[0].ColumnHeader.Cells[0, 3].Font.Bold       = true;
            FpSpread1.Sheets[0].ColumnHeader.Cells[0, 3].Font.Name       = "Book Antiqua";
            FpSpread1.Sheets[0].ColumnHeader.Cells[0, 3].Font.Size       = FontUnit.Medium;
            FpSpread1.Sheets[0].ColumnHeader.Cells[0, 3].HorizontalAlign = HorizontalAlign.Center;
            FpSpread1.Sheets[0].ColumnHeader.Columns[0].Width            = 59;
            FpSpread1.Sheets[0].ColumnHeader.Columns[1].Width            = 150;
            FpSpread1.Sheets[0].ColumnHeader.Columns[2].Width            = 328;
            string headercode   = rs.GetSelectedItemsValueAsString(cbl_header1);
            string questionfk   = rs.GetSelectedItemsValueAsString(cbl_question1);
            string markmasterfk = rs.GetSelectedItemsValueAsString(cbl_option1);

            string q1 = " select FeedBackMasterPK from CO_FeedBackMaster where FeedBackName='" + ddl_feedback1.SelectedItem.Value + "'";
            ds.Clear();
            ds = d2.select_method_wo_parameter(q1, "text");
            string FeedBackMasterPK = GetdatasetRowstring(ds, "FeedBackMasterPK");
            q1 = " select distinct t.TextVal,q.Question,m.MarkType,qt.QuestionmasterFK,qt.HeaderCode,qt.MarkMasterFK,q.CollegeCode  from Co_Question_Type qt,CO_MarkMaster m,CO_QuestionMaster q,TextValTable t,CO_FeedBackQuestions fq where q.QuestionMasterPK=fq.QuestionMasterFK and t.TextCode= qt.HeaderCode and qt.MarkMasterFK=m.MarkMasterPK and qt.QuestionmasterFK=q.QuestionMasterPK and qt.HeaderCode=q.HeaderCode and m.CollegeCode=q.CollegeCode and q.HeaderCode in('" + headercode + "') and qt.MarkMasterFK in('" + markmasterfk + "') and  qt.FeedbackFk=fq.FeedBackMasterFK and qt.FeedbackFk in('" + FeedBackMasterPK + "') and qt.QuestionmasterFK in('" + questionfk + "') order by TextVal";
            ds.Clear();
            ds = d2.select_method_wo_parameter(q1, "text"); int row = 0;
            if (ds.Tables.Count > 0)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    for (int i = 0; i < cbl_header1.Items.Count; i++)
                    {
                        if (cbl_header1.Items[i].Selected == true)
                        {
                            for (int j = 0; j < cbl_question1.Items.Count; j++)
                            {
                                if (cbl_question1.Items[j].Selected == true)
                                {
                                    ds.Tables[0].DefaultView.RowFilter = " HeaderCode='" + cbl_header1.Items[i].Value + "' and  QuestionmasterFK='" + cbl_question1.Items[j].Value + "'"; //and MarkType='"++"' and
                                    DataView dv = ds.Tables[0].DefaultView;
                                    if (dv.Count > 0)
                                    {
                                        foreach (DataRowView dr in dv)
                                        {
                                            row++;
                                            FpSpread1.Sheets[0].RowCount++;
                                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Text            = row.ToString();
                                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].HorizontalAlign = HorizontalAlign.Center;
                                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Font.Size       = FontUnit.Medium;
                                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Font.Name       = "Book Antiqua";
                                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Text            = Convert.ToString(dr["TextVal"]);
                                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].HorizontalAlign = HorizontalAlign.Center;
                                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].VerticalAlign   = VerticalAlign.Middle;
                                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Font.Size       = FontUnit.Medium;
                                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Font.Name       = "Book Antiqua";
                                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Text            = Convert.ToString(dr["Question"]);
                                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].HorizontalAlign = HorizontalAlign.Center;
                                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].VerticalAlign   = VerticalAlign.Middle;
                                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Font.Size       = FontUnit.Medium;
                                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Font.Name       = "Book Antiqua";
                                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].Text            = Convert.ToString(dr["MarkType"]);
                                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].HorizontalAlign = HorizontalAlign.Center;
                                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].Font.Size       = FontUnit.Medium;
                                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].Font.Name       = "Book Antiqua";
                                            FpSpread1.Visible = true;
                                            rptprint1.Visible = true;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    FpSpread1.Sheets[0].PageSize = FpSpread1.Sheets[0].Rows.Count;
                    FpSpread1.Sheets[0].SetColumnMerge(1, FarPoint.Web.Spread.Model.MergePolicy.Always);
                    FpSpread1.Sheets[0].SetColumnMerge(2, FarPoint.Web.Spread.Model.MergePolicy.Always);
                }
                else
                {
                    lbl_error.Visible = true;
                    lbl_error.Text    = "No Records Found";
                    FpSpread1.Visible = false;
                    rptprint1.Visible = false;
                }
            }
            else
            {
                lbl_error.Visible = true;
                lbl_error.Text    = "No Records Found";
                FpSpread1.Visible = false;
                rptprint1.Visible = false;
            }
            FpSpread1.Sheets[0].PageSize = FpSpread1.Sheets[0].RowCount;
        }
        catch
        {
        }
    }
    private void loadSpreadValues(DataSet dsVal, string dateEnding)
    {
        try
        {
            #region Design
            Fpspread1.Sheets[0].RowCount              = 0;
            Fpspread1.Sheets[0].ColumnCount           = 0;
            Fpspread1.CommandBar.Visible              = false;
            Fpspread1.Sheets[0].AutoPostBack          = true;
            Fpspread1.Sheets[0].ColumnHeader.RowCount = 1;
            Fpspread1.Sheets[0].RowHeader.Visible     = false;
            Fpspread1.Sheets[0].ColumnCount           = 0;

            FarPoint.Web.Spread.StyleInfo darkstyle = new FarPoint.Web.Spread.StyleInfo();
            darkstyle.BackColor = ColorTranslator.FromHtml("#0CA6CA");
            darkstyle.ForeColor = Color.Black;
            Fpspread1.ActiveSheetView.ColumnHeader.DefaultStyle = darkstyle;
            ArrayList arColumn = getColumn();
            foreach (string columN in arColumn)
            {
                Fpspread1.Sheets[0].ColumnCount++;
                int colCnt = Fpspread1.Sheets[0].ColumnCount - 1;
                Fpspread1.Sheets[0].ColumnHeader.Cells[0, colCnt].Text            = columN;
                Fpspread1.Sheets[0].ColumnHeader.Cells[0, colCnt].ForeColor       = ColorTranslator.FromHtml("#000000");
                Fpspread1.Sheets[0].ColumnHeader.Cells[0, colCnt].Font.Bold       = true;
                Fpspread1.Sheets[0].ColumnHeader.Cells[0, colCnt].Font.Name       = "Book Antiqua";
                Fpspread1.Sheets[0].ColumnHeader.Cells[0, colCnt].Font.Size       = FontUnit.Medium;
                Fpspread1.Sheets[0].ColumnHeader.Cells[0, colCnt].HorizontalAlign = HorizontalAlign.Center;
                Fpspread1.Sheets[0].Columns[colCnt].HorizontalAlign = HorizontalAlign.Center;
                Fpspread1.Sheets[0].Columns[colCnt].Width           = 40;
                switch (columN)
                {
                case "Year Ending(₹)":
                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, colCnt].Text = columN + "-" + dateEnding;
                    Fpspread1.Sheets[0].Columns[colCnt].Width           = 150;
                    Fpspread1.Sheets[0].Columns[colCnt].HorizontalAlign = HorizontalAlign.Right;
                    break;

                case "Particulars":
                    Fpspread1.Sheets[0].Columns[colCnt].Width           = 200;
                    Fpspread1.Sheets[0].Columns[colCnt].HorizontalAlign = HorizontalAlign.Left;
                    break;

                case "Debit(₹)":
                    Fpspread1.Sheets[0].Columns[colCnt].Width           = 80;
                    Fpspread1.Sheets[0].Columns[colCnt].HorizontalAlign = HorizontalAlign.Right;
                    break;

                case "Credit(₹)":
                    Fpspread1.Sheets[0].Columns[colCnt].HorizontalAlign = HorizontalAlign.Right;
                    Fpspread1.Sheets[0].Columns[colCnt].Width           = 80;
                    break;
                }
            }

            #endregion

            #region Value
            Hashtable htSubTot = new Hashtable();
            int       rowNum   = 0;
            Dictionary <string, string> fnalYear = getFinancialYear();
            Dictionary <string, string> hdName   = getHeadername();
            Dictionary <string, string> feesName = getFeeName();
            int rowCnt = 0;
            //foreach (KeyValuePair<string, string> financialYear in fnalYear)
            //{
            //    int rowCnt = 0;
            //    Fpspread1.Sheets[0].RowCount++;
            //    rowCnt = Fpspread1.Sheets[0].RowCount - 1;
            //    Fpspread1.Sheets[0].Cells[rowCnt, 1].Text = Convert.ToString(financialYear.Value);
            //    Fpspread1.Sheets[0].SpanModel.Add(rowCnt, 0, 1, Fpspread1.Sheets[0].ColumnCount - 1);
            //    Fpspread1.Sheets[0].Rows[rowCnt].BackColor = Color.Green;
            bool boolCheck = false;
            if (rblType.SelectedIndex == 0)
            {
                #region header
                foreach (KeyValuePair <string, string> headName in feesName)
                {
                    //for (int hd = 0; hd < chkl_studhed.Items.Count; hd++)
                    //{
                    //    if (!chkl_studhed.Items[hd].Selected)
                    //        continue;
                    Fpspread1.Sheets[0].RowCount++;
                    rowCnt = Fpspread1.Sheets[0].RowCount - 1;
                    Fpspread1.Sheets[0].Cells[rowCnt, 0].Text = Convert.ToString(++rowNum);
                    double ob          = 0;
                    double openBalhead = 0;
                    if (dsVal.Tables[3].Rows.Count > 0 || dsVal.Tables[6].Rows.Count > 0)
                    {
                        dsVal.Tables[3].DefaultView.RowFilter = " headerfk='" + headName.Key + "' ";//and finyearfk='" + financialYear.Key + "'
                        dsVal.Tables[6].DefaultView.RowFilter = "headerpk='" + headName.Key + "' ";
                        DataTable dtOpen     = dsVal.Tables[3].DefaultView.ToTable();
                        DataTable dtopenhead = dsVal.Tables[6].DefaultView.ToTable();
                        if (dtOpen.Rows.Count > 0 || dtopenhead.Rows.Count > 0)
                        {
                            double.TryParse(Convert.ToString(dtOpen.Compute("sum(credit)", "")), out ob);
                        }
                        double.TryParse(Convert.ToString(dtopenhead.Compute("sum(openbal)", "")), out openBalhead);
                    }
                    double openBal = 0;
                    openBal = ob + openBalhead;
                    Fpspread1.Sheets[0].Cells[rowCnt, 1].Text = Convert.ToString(openBal);
                    if (openBal == 0)
                    {
                        Fpspread1.Sheets[0].Cells[rowCnt, 1].Text = "-";
                    }
                    if (!htSubTot.ContainsKey("OpenBal"))
                    {
                        htSubTot.Add("OpenBal", openBal);
                    }
                    else
                    {
                        double amount = 0;
                        double.TryParse(Convert.ToString(htSubTot["OpenBal"]), out amount);
                        amount += openBal;
                        htSubTot.Remove("OpenBal");
                        htSubTot.Add("OpenBal", Convert.ToString(amount));
                    }
                    Fpspread1.Sheets[0].Cells[rowCnt, 2].Text = Convert.ToString(headName.Value);
                    double debitAmt = 0;
                    if (dsVal.Tables[0].Rows.Count > 0)
                    {
                        dsVal.Tables[0].DefaultView.RowFilter = " headerfk='" + headName.Key + "' ";//and finyearfk='" + financialYear.Key + "'
                        DataTable dtDebit = dsVal.Tables[0].DefaultView.ToTable();
                        if (dtDebit.Rows.Count > 0)
                        {
                            double.TryParse(Convert.ToString(dtDebit.Compute("sum(debit)", "")), out debitAmt);
                        }
                    }
                    Fpspread1.Sheets[0].Cells[rowCnt, 3].Text = Convert.ToString(debitAmt);
                    if (debitAmt == 0)
                    {
                        Fpspread1.Sheets[0].Cells[rowCnt, 3].Text = "-";
                    }

                    if (!htSubTot.ContainsKey("Debit"))
                    {
                        htSubTot.Add("Debit", debitAmt);
                    }
                    else
                    {
                        double amount = 0;
                        double.TryParse(Convert.ToString(htSubTot["Debit"]), out amount);
                        amount += debitAmt;
                        htSubTot.Remove("Debit");
                        htSubTot.Add("Debit", Convert.ToString(amount));
                    }

                    double creditAmt = 0;
                    if (dsVal.Tables[0].Rows.Count > 0)
                    {
                        dsVal.Tables[0].DefaultView.RowFilter = " headerfk='" + headName.Key + "' ";//and finyearfk='" + financialYear.Key + "'
                        DataTable dtCredit = dsVal.Tables[0].DefaultView.ToTable();
                        if (dtCredit.Rows.Count > 0)
                        {
                            double.TryParse(Convert.ToString(dtCredit.Compute("sum(credit)", "")), out creditAmt);
                        }
                    }
                    Fpspread1.Sheets[0].Cells[rowCnt, 4].Text = Convert.ToString(creditAmt);
                    if (creditAmt == 0)
                    {
                        Fpspread1.Sheets[0].Cells[rowCnt, 4].Text = "-";
                    }

                    if (!htSubTot.ContainsKey("Credit"))
                    {
                        htSubTot.Add("Credit", creditAmt);
                    }
                    else
                    {
                        double amount = 0;
                        double.TryParse(Convert.ToString(htSubTot["Credit"]), out amount);
                        amount += creditAmt;
                        htSubTot.Remove("Credit");
                        htSubTot.Add("Credit", Convert.ToString(amount));
                    }
                    boolCheck = true;
                }
                #endregion
            }
            else
            {
                #region ledger
                string lastName = string.Empty;
                foreach (KeyValuePair <string, string> ldName in feesName)
                {
                    //  }
                    //for (int hd = 0; hd < chkl_studled.Items.Count; hd++)
                    //{
                    //    if (!chkl_studled.Items[hd].Selected)
                    //        continue;
                    if (hdName.ContainsKey(ldName.Key))
                    {
                        string NewName = Convert.ToString(hdName[ldName.Key]);
                        if (lastName != NewName)
                        {
                            Fpspread1.Sheets[0].RowCount++;
                            rowCnt   = Fpspread1.Sheets[0].RowCount - 1;
                            lastName = NewName;
                            Fpspread1.Sheets[0].Cells[rowCnt, 0].Text = lastName;
                            Fpspread1.Sheets[0].SpanModel.Add(rowCnt, 0, 1, Fpspread1.Sheets[0].ColumnCount - 1);
                            Fpspread1.Sheets[0].Rows[rowCnt].BackColor = Color.YellowGreen;
                        }
                    }
                    Fpspread1.Sheets[0].RowCount++;
                    rowCnt = Fpspread1.Sheets[0].RowCount - 1;
                    Fpspread1.Sheets[0].Cells[rowCnt, 0].Text = Convert.ToString(++rowNum);
                    double ob          = 0;
                    double openBalhead = 0;
                    if (dsVal.Tables[3].Rows.Count > 0)
                    {
                        dsVal.Tables[3].DefaultView.RowFilter = " ledgerfk='" + ldName.Key + "' ";
                        //and finyearfk='" + financialYear.Key + "'

                        //  dsVal.Tables[6].DefaultView.RowFilter = "headerpk='" + headName.Key + "' ";
                        DataTable dtOpen     = dsVal.Tables[3].DefaultView.ToTable();
                        DataTable dtopenhead = dsVal.Tables[6].DefaultView.ToTable();
                        if (dtOpen.Rows.Count > 0 || dtopenhead.Rows.Count > 0)
                        {
                            double.TryParse(Convert.ToString(dtOpen.Compute("sum(credit)", "")), out ob);
                        }
                        double.TryParse(Convert.ToString(dtopenhead.Compute("sum(openbal)", "")), out openBalhead);
                    }
                    double openBal = 0;
                    openBal = ob + openBalhead;
                    Fpspread1.Sheets[0].Cells[rowCnt, 1].Text = Convert.ToString(openBal);
                    if (openBal == 0)
                    {
                        Fpspread1.Sheets[0].Cells[rowCnt, 1].Text = "-";
                    }
                    if (!htSubTot.ContainsKey("OpenBal"))
                    {
                        htSubTot.Add("OpenBal", openBal);
                    }
                    else
                    {
                        double amount = 0;
                        double.TryParse(Convert.ToString(htSubTot["OpenBal"]), out amount);
                        amount += openBal;
                        htSubTot.Remove("OpenBal");
                        htSubTot.Add("OpenBal", Convert.ToString(amount));
                    }
                    Fpspread1.Sheets[0].Cells[rowCnt, 2].Text = Convert.ToString(ldName.Value);
                    double debitAmt = 0;
                    if (dsVal.Tables[0].Rows.Count > 0)
                    {
                        dsVal.Tables[0].DefaultView.RowFilter = " ledgerfk='" + ldName.Key + "' ";//and finyearfk='" + financialYear.Key + "'
                        DataTable dtDebit = dsVal.Tables[0].DefaultView.ToTable();
                        if (dtDebit.Rows.Count > 0)
                        {
                            double.TryParse(Convert.ToString(dtDebit.Compute("sum(debit)", "")), out debitAmt);
                        }
                    }
                    Fpspread1.Sheets[0].Cells[rowCnt, 3].Text = Convert.ToString(debitAmt);
                    if (debitAmt == 0)
                    {
                        Fpspread1.Sheets[0].Cells[rowCnt, 3].Text = "-";
                    }
                    if (!htSubTot.ContainsKey("Debit"))
                    {
                        htSubTot.Add("Debit", debitAmt);
                    }
                    else
                    {
                        double amount = 0;
                        double.TryParse(Convert.ToString(htSubTot["Debit"]), out amount);
                        amount += debitAmt;
                        htSubTot.Remove("Debit");
                        htSubTot.Add("Debit", Convert.ToString(amount));
                    }

                    double creditAmt = 0;
                    if (dsVal.Tables[0].Rows.Count > 0)
                    {
                        dsVal.Tables[0].DefaultView.RowFilter = " ledgerfk='" + ldName.Key + "' ";//and finyearfk='" + financialYear.Key + "'
                        DataTable dtCredit = dsVal.Tables[0].DefaultView.ToTable();
                        if (dtCredit.Rows.Count > 0)
                        {
                            double.TryParse(Convert.ToString(dtCredit.Compute("sum(credit)", "")), out creditAmt);
                        }
                    }
                    Fpspread1.Sheets[0].Cells[rowCnt, 4].Text = Convert.ToString(creditAmt);
                    if (creditAmt == 0)
                    {
                        Fpspread1.Sheets[0].Cells[rowCnt, 4].Text = "-";
                    }

                    if (!htSubTot.ContainsKey("Credit"))
                    {
                        htSubTot.Add("Credit", creditAmt);
                    }
                    else
                    {
                        double amount = 0;
                        double.TryParse(Convert.ToString(htSubTot["Credit"]), out amount);
                        amount += creditAmt;
                        htSubTot.Remove("Credit");
                        htSubTot.Add("Credit", Convert.ToString(amount));
                    }
                    boolCheck = true;
                }
                #endregion
            }
            if (boolCheck)
            {
                bool boolBank = false;
                for (int bnK = 0; bnK < ds.Tables[2].Rows.Count; bnK++)
                {
                    ds.Tables[1].DefaultView.RowFilter = "bankfk='" + Convert.ToString(ds.Tables[2].Rows[bnK]["bankpk"]) + "'";
                    DataTable dtBank = ds.Tables[1].DefaultView.ToTable();
                    if (dtBank.Rows.Count > 0)
                    {
                        if (!boolBank)
                        {
                            Fpspread1.Sheets[0].RowCount++;
                            rowCnt = Fpspread1.Sheets[0].RowCount - 1;
                            Fpspread1.Sheets[0].Cells[rowCnt, 0].Text = "Bank Balances";
                            Fpspread1.Sheets[0].SpanModel.Add(rowCnt, 0, 1, Fpspread1.Sheets[0].ColumnCount - 1);
                            Fpspread1.Sheets[0].Rows[rowCnt].BackColor = Color.Gray;
                            boolBank = true;
                        }
                        Fpspread1.Sheets[0].RowCount++;
                        rowCnt = Fpspread1.Sheets[0].RowCount - 1;
                        Fpspread1.Sheets[0].Cells[rowCnt, 0].Text = Convert.ToString(++rowNum);
                        // double openBal = 0;
                        double ob          = 0;
                        double openBalhead = 0;
                        if (dsVal.Tables[4].Rows.Count > 0)
                        {
                            dsVal.Tables[4].DefaultView.RowFilter = " bankfk='" + Convert.ToString(ds.Tables[2].Rows[bnK]["bankpk"]) + "' ";//and finyearfk='" + financialYear.Key + "'
                            DataTable dtOpen     = dsVal.Tables[3].DefaultView.ToTable();
                            DataTable dtopenhead = dsVal.Tables[6].DefaultView.ToTable();
                            if (dtOpen.Rows.Count > 0 || dtopenhead.Rows.Count > 0)
                            {
                                double.TryParse(Convert.ToString(dtOpen.Compute("sum(credit)", "")), out ob);
                            }
                            double.TryParse(Convert.ToString(dtopenhead.Compute("sum(openbal)", "")), out openBalhead);
                        }
                        double openBal = 0;
                        openBal = ob + openBalhead;
                        Fpspread1.Sheets[0].Cells[rowCnt, 1].Text = Convert.ToString(openBal);
                        if (!htSubTot.ContainsKey("OpenBal"))
                        {
                            htSubTot.Add("OpenBal", openBal);
                        }
                        else
                        {
                            double amount = 0;
                            double.TryParse(Convert.ToString(htSubTot["OpenBal"]), out amount);
                            amount += openBal;
                            htSubTot.Remove("OpenBal");
                            htSubTot.Add("OpenBal", Convert.ToString(amount));
                        }
                        Fpspread1.Sheets[0].Cells[rowCnt, 2].Text = Convert.ToString(ds.Tables[2].Rows[bnK]["bankname"]);
                        double debitAmt = 0;
                        double.TryParse(Convert.ToString(dtBank.Rows[0]["credit"]), out debitAmt);
                        Fpspread1.Sheets[0].Cells[rowCnt, 3].Text = Convert.ToString(debitAmt);
                        if (debitAmt == 0)
                        {
                            Fpspread1.Sheets[0].Cells[rowCnt, 3].Text = "-";
                        }

                        if (!htSubTot.ContainsKey("Debit"))
                        {
                            htSubTot.Add("Debit", debitAmt);
                        }
                        else
                        {
                            double amount = 0;
                            double.TryParse(Convert.ToString(htSubTot["Debit"]), out amount);
                            amount += debitAmt;
                            htSubTot.Remove("Debit");
                            htSubTot.Add("Debit", Convert.ToString(amount));
                        }

                        double creditAmt = 0;
                        double.TryParse(Convert.ToString(dtBank.Rows[0]["debit"]), out creditAmt);
                        Fpspread1.Sheets[0].Cells[rowCnt, 4].Text = Convert.ToString(creditAmt);
                        if (creditAmt == 0)
                        {
                            Fpspread1.Sheets[0].Cells[rowCnt, 4].Text = "-";
                        }

                        if (!htSubTot.ContainsKey("Credit"))
                        {
                            htSubTot.Add("Credit", creditAmt);
                        }
                        else
                        {
                            double amount = 0;
                            double.TryParse(Convert.ToString(htSubTot["Credit"]), out amount);
                            amount += creditAmt;
                            htSubTot.Remove("Credit");
                            htSubTot.Add("Credit", Convert.ToString(amount));
                        }
                    }
                }
            }


            // Fpspread1.Sheets[0].PageSize = ds.Tables[0].Rows.Count + 1;
            if (boolCheck)
            {
                Fpspread1.Sheets[0].Rows.Count++;
                Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].Rows.Count - 1, 2].Text  = "Deficit";
                Fpspread1.Sheets[0].Rows[Fpspread1.Sheets[0].Rows.Count - 1].Font.Bold = true;
                // Fpspread1.Sheets[0].Rows[Fpspread1.Sheets[0].Rows.Count - 1].BackColor = Color.Green;

                double debit  = 0;
                double credit = 0;
                double.TryParse(Convert.ToString(htSubTot["Debit"]), out debit);
                double.TryParse(Convert.ToString(htSubTot["Credit"]), out credit);
                Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].Rows.Count - 1, 3].Text = "-";
                if (debit > credit)
                {
                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].Rows.Count - 1, 3].Text = Convert.ToString(debit - credit);
                }

                Fpspread1.Sheets[0].Rows.Count++;
                Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].Rows.Count - 1, 0].Text  = "Total";
                Fpspread1.Sheets[0].Rows[Fpspread1.Sheets[0].Rows.Count - 1].Font.Bold = true;
                Fpspread1.Sheets[0].Rows[Fpspread1.Sheets[0].Rows.Count - 1].BackColor = Color.Green;
                Fpspread1.Sheets[0].Rows[Fpspread1.Sheets[0].Rows.Count - 1].ForeColor = Color.White;
                double grandvalue = 0;
                double.TryParse(Convert.ToString(htSubTot["OpenBal"]), out grandvalue);
                Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].Rows.Count - 1, 1].Text = Convert.ToString(grandvalue);
                Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].Rows.Count - 1, 3].Text = Convert.ToString(debit);
                Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].Rows.Count - 1, 4].Text = Convert.ToString(credit);
            }

            //for (int j = 2; j < FpSpread1.Sheets[0].ColumnCount; j++)
            //{
            //    double.TryParse(Convert.ToString(grandtotal[j]), out grandvalue);
            //    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].Rows.Count - 1, j].Text = Convert.ToString(grandvalue);
            //}

            // }
            Fpspread1.Sheets[0].PageSize = Fpspread1.Sheets[0].RowCount;
            Fpspread1.Visible            = true;
            print.Attributes.Add("Style", "display:block;");
            // print.Visible = true;
            Fpspread1.SaveChanges();


            #endregion
        }
        catch { }
    }
    protected void btn_go_Click(object sender, EventArgs e)
    {
        try
        {
            try
            {
                Printcontrol.Visible = false;
                string clgcode = "";
                clgcode = Convert.ToString(ddl_collegename.SelectedItem.Value);
                string itemheadercode = "";
                for (int i = 0; i < cbl_roomtype.Items.Count; i++)
                {
                    if (cbl_roomtype.Items[i].Selected == true)
                    {
                        if (itemheadercode == "")
                        {
                            itemheadercode = "" + cbl_roomtype.Items[i].Value.ToString() + "";
                        }
                        else
                        {
                            itemheadercode = itemheadercode + "'" + "," + "'" + cbl_roomtype.Items[i].Value.ToString() + "";
                        }
                    }
                }

                if (itemheadercode.Trim() != "")
                {
                    string selectquery = "";
                    selectquery = "select Room_Type,CONVERT(varchar(10), From_Date,103) as From_Date,CONVERT(varchar(10), To_Date,103) as To_Date, case when Rent_Type=1 then 'Monthly' when Rent_Type =2 then 'Yearly' when Rent_Type =3 then 'Semester' end as renttype,Room_Cost,CONVERT(varchar(10), Due_Date,103) as Due_Date,RoomCost_Code  from RoomCost_Master where  Room_Type in('" + itemheadercode + "')and college_code in('" + clgcode + "')";



                    ds.Clear();
                    ds = d2.select_method_wo_parameter(selectquery, "Text");
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        Fpspread1.Sheets[0].RowCount              = 0;
                        Fpspread1.Sheets[0].ColumnCount           = 0;
                        Fpspread1.CommandBar.Visible              = false;
                        Fpspread1.Sheets[0].AutoPostBack          = true;
                        Fpspread1.Sheets[0].ColumnHeader.RowCount = 1;
                        Fpspread1.Sheets[0].RowHeader.Visible     = false;
                        Fpspread1.Sheets[0].ColumnCount           = 7;
                        FarPoint.Web.Spread.StyleInfo darkstyle = new FarPoint.Web.Spread.StyleInfo();
                        darkstyle.BackColor = ColorTranslator.FromHtml("#0CA6CA");
                        darkstyle.ForeColor = Color.White;
                        Fpspread1.ActiveSheetView.ColumnHeader.DefaultStyle = darkstyle;

                        Fpspread1.Sheets[0].ColumnHeader.Cells[0, 0].Text            = "S.No";
                        Fpspread1.Sheets[0].ColumnHeader.Cells[0, 0].Font.Bold       = true;
                        Fpspread1.Sheets[0].ColumnHeader.Cells[0, 0].Font.Name       = "Book Antiqua";
                        Fpspread1.Sheets[0].ColumnHeader.Cells[0, 0].Font.Size       = FontUnit.Medium;
                        Fpspread1.Sheets[0].ColumnHeader.Cells[0, 0].HorizontalAlign = HorizontalAlign.Center;
                        Fpspread1.Columns[0].Width = 50;

                        Fpspread1.Sheets[0].ColumnHeader.Cells[0, 1].Text            = "Room Type";
                        Fpspread1.Sheets[0].ColumnHeader.Cells[0, 1].Font.Bold       = true;
                        Fpspread1.Sheets[0].ColumnHeader.Cells[0, 1].Font.Name       = "Book Antiqua";
                        Fpspread1.Sheets[0].ColumnHeader.Cells[0, 1].Font.Size       = FontUnit.Medium;
                        Fpspread1.Sheets[0].ColumnHeader.Cells[0, 1].HorizontalAlign = HorizontalAlign.Center;
                        Fpspread1.Columns[1].Width = 100;

                        Fpspread1.Sheets[0].ColumnHeader.Cells[0, 2].Text            = "From Date";
                        Fpspread1.Sheets[0].ColumnHeader.Cells[0, 2].Font.Bold       = true;
                        Fpspread1.Sheets[0].ColumnHeader.Cells[0, 2].Font.Name       = "Book Antiqua";
                        Fpspread1.Sheets[0].ColumnHeader.Cells[0, 2].Font.Size       = FontUnit.Medium;
                        Fpspread1.Sheets[0].ColumnHeader.Cells[0, 2].HorizontalAlign = HorizontalAlign.Center;
                        Fpspread1.Columns[2].Width = 100;

                        Fpspread1.Sheets[0].ColumnHeader.Cells[0, 3].Text            = "To Date";
                        Fpspread1.Sheets[0].ColumnHeader.Cells[0, 3].Font.Bold       = true;
                        Fpspread1.Sheets[0].ColumnHeader.Cells[0, 3].Font.Name       = "Book Antiqua";
                        Fpspread1.Sheets[0].ColumnHeader.Cells[0, 3].Font.Size       = FontUnit.Medium;
                        Fpspread1.Sheets[0].ColumnHeader.Cells[0, 3].HorizontalAlign = HorizontalAlign.Center;
                        Fpspread1.Columns[3].Width = 100;

                        Fpspread1.Sheets[0].ColumnHeader.Cells[0, 4].Text            = "Rent Type";
                        Fpspread1.Sheets[0].ColumnHeader.Cells[0, 4].Font.Bold       = true;
                        Fpspread1.Sheets[0].ColumnHeader.Cells[0, 4].Font.Name       = "Book Antiqua";
                        Fpspread1.Sheets[0].ColumnHeader.Cells[0, 4].Font.Size       = FontUnit.Medium;
                        Fpspread1.Sheets[0].ColumnHeader.Cells[0, 4].HorizontalAlign = HorizontalAlign.Center;
                        Fpspread1.Columns[4].Width = 100;


                        Fpspread1.Sheets[0].ColumnHeader.Cells[0, 5].Text            = "Room Cost";
                        Fpspread1.Sheets[0].ColumnHeader.Cells[0, 5].Font.Bold       = true;
                        Fpspread1.Sheets[0].ColumnHeader.Cells[0, 5].Font.Name       = "Book Antiqua";
                        Fpspread1.Sheets[0].ColumnHeader.Cells[0, 5].Font.Size       = FontUnit.Medium;
                        Fpspread1.Sheets[0].ColumnHeader.Cells[0, 5].HorizontalAlign = HorizontalAlign.Center;

                        Fpspread1.Sheets[0].ColumnHeader.Cells[0, 6].Text            = "Due Date";
                        Fpspread1.Sheets[0].ColumnHeader.Cells[0, 6].Font.Bold       = true;
                        Fpspread1.Sheets[0].ColumnHeader.Cells[0, 6].Font.Name       = "Book Antiqua";
                        Fpspread1.Sheets[0].ColumnHeader.Cells[0, 6].Font.Size       = FontUnit.Medium;
                        Fpspread1.Sheets[0].ColumnHeader.Cells[0, 6].HorizontalAlign = HorizontalAlign.Center;



                        //   FarPoint.Web.Spread.TextCellType txtcell = new FarPoint.Web.Spread.TextCellType();

                        for (int row = 0; row < ds.Tables[0].Rows.Count; row++)
                        {
                            Fpspread1.Sheets[0].RowCount++;
                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 0].Text            = Convert.ToString(row + 1);
                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 0].HorizontalAlign = HorizontalAlign.Center;
                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 0].Font.Size       = FontUnit.Medium;
                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 0].Font.Name       = "Book Antiqua";
                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 1].Text            = Convert.ToString(ds.Tables[0].Rows[row]["Room_Type"]);
                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 1].Tag             = Convert.ToString(ds.Tables[0].Rows[row]["RoomCost_Code"]);

                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 1].HorizontalAlign = HorizontalAlign.Left;
                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 1].Font.Size       = FontUnit.Medium;
                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 1].Font.Name       = "Book Antiqua";

                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 2].Text = Convert.ToString(ds.Tables[0].Rows[row]["From_Date"]);

                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 2].HorizontalAlign = HorizontalAlign.Left;
                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 2].Font.Size       = FontUnit.Medium;
                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 2].Font.Name       = "Book Antiqua";

                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 3].Text = Convert.ToString(ds.Tables[0].Rows[row]["To_Date"]);
                            //  Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 3].CellType = txtcell;

                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 3].HorizontalAlign = HorizontalAlign.Left;
                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 3].Font.Size       = FontUnit.Medium;
                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 3].Font.Name       = "Book Antiqua";

                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 4].Text            = Convert.ToString(ds.Tables[0].Rows[row]["renttype"]);
                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 4].HorizontalAlign = HorizontalAlign.Left;
                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 4].Font.Size       = FontUnit.Medium;
                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 4].Font.Name       = "Book Antiqua";

                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 5].Text            = Convert.ToString(ds.Tables[0].Rows[row]["Room_Cost"]);
                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 5].HorizontalAlign = HorizontalAlign.Right;
                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 5].Font.Size       = FontUnit.Medium;
                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 5].Font.Name       = "Book Antiqua";

                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 6].Text            = Convert.ToString(ds.Tables[0].Rows[row]["Due_Date"]);
                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 6].HorizontalAlign = HorizontalAlign.Left;
                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 6].Font.Size       = FontUnit.Medium;
                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 6].Font.Name       = "Book Antiqua";
                        }
                        Fpspread1.Visible            = true;
                        rptprint.Visible             = true;
                        div1.Visible                 = true;
                        lbl_error.Visible            = false;
                        Fpspread1.Sheets[0].PageSize = Fpspread1.Sheets[0].RowCount;
                    }
                    else
                    {
                        div1.Visible      = false;
                        Fpspread1.Visible = false;
                        rptprint.Visible  = false;
                        lbl_error.Visible = true;
                        lbl_error.Text    = "No Records Found";
                    }
                }
                else
                {
                    div1.Visible      = false;
                    Fpspread1.Visible = false;
                    rptprint.Visible  = false;
                    lbl_error.Visible = true;
                    lbl_error.Text    = "Please Select Any one Item Name";
                }
            }
            catch
            {
            }
        }
        catch
        {
        }
    }
    public void btn_go_Click(object sender, EventArgs e)
    {
        try
        {
            div_report.Visible   = false;
            Printcontrol.Visible = false;
            FpSpread1.Visible    = false;
            FpSpread1.SaveChanges();
            string itemheadercode = "";
            for (int i = 0; i < cbl_hostelname.Items.Count; i++)
            {
                if (cbl_hostelname.Items[i].Selected == true)
                {
                    if (itemheadercode == "")
                    {
                        itemheadercode = "" + cbl_hostelname.Items[i].Value.ToString() + "";
                    }
                    else
                    {
                        itemheadercode = itemheadercode + "'" + "," + "'" + cbl_hostelname.Items[i].Value.ToString() + "";
                    }
                }
            }

            string month = "";
            for (int i = 0; i < cbl_month.Items.Count; i++)
            {
                if (cbl_month.Items[i].Selected == true)
                {
                    if (month == "")
                    {
                        month = "" + cbl_month.Items[i].Value.ToString() + "";
                    }
                    else
                    {
                        month = month + "'" + "," + "'" + cbl_month.Items[i].Value.ToString() + "";
                    }
                }
            }
            if (txt_hostelname.Text == "--Select--")
            {
                lblerror.Visible  = true;
                lblerror.Text     = "Kindly Select The Hostel";
                btnsave.Visible   = false;
                btn_reset.Visible = false;
            }
            else
            {
                if (txt_month.Text == "--Select--")
                {
                    lblerror.Visible  = true;
                    lblerror.Text     = "Kindly Select The Month";
                    btnsave.Visible   = false;
                    btn_reset.Visible = false;
                    //FpSpread1.Visible = false;
                }
                else
                {
                    //FpSpread1.Visible = true;
                    if (itemheadercode.Trim() != "")
                    {
                        FpSpread1.Sheets[0].RowCount              = 0;
                        FpSpread1.Sheets[0].ColumnCount           = 0;
                        FpSpread1.CommandBar.Visible              = false;
                        FpSpread1.Sheets[0].AutoPostBack          = false;
                        FpSpread1.Sheets[0].ColumnHeader.RowCount = 1;
                        FpSpread1.Sheets[0].RowHeader.Visible     = false;
                        FpSpread1.Sheets[0].ColumnCount           = 1;


                        FarPoint.Web.Spread.StyleInfo darkstyle = new FarPoint.Web.Spread.StyleInfo();
                        darkstyle.BackColor = ColorTranslator.FromHtml("#0CA6CA");
                        darkstyle.ForeColor = Color.White;
                        FpSpread1.ActiveSheetView.ColumnHeader.DefaultStyle = darkstyle;

                        FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].Text            = "S.No";
                        FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].Font.Size       = FontUnit.Medium;
                        FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].Font.Name       = "Book Antiqua";
                        FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].HorizontalAlign = HorizontalAlign.Center;
                        FpSpread1.Columns[0].Width  = 50;
                        FpSpread1.Columns[0].Locked = true;

                        FpSpread1.Sheets[0].ColumnCount++;
                        FpSpread1.Sheets[0].ColumnHeader.Cells[0, FpSpread1.Sheets[0].ColumnCount - 1].Text            = "Days";
                        FpSpread1.Sheets[0].ColumnHeader.Cells[0, FpSpread1.Sheets[0].ColumnCount - 1].HorizontalAlign = HorizontalAlign.Center;
                        FpSpread1.Sheets[0].ColumnHeader.Cells[0, FpSpread1.Sheets[0].ColumnCount - 1].Font.Name       = "Book Antiqua";
                        FpSpread1.Sheets[0].ColumnHeader.Cells[0, FpSpread1.Sheets[0].ColumnCount - 1].Font.Size       = FontUnit.Medium;
                        FpSpread1.Columns[1].Width  = 150;
                        FpSpread1.Columns[1].Locked = true;

                        for (int i = 0; i < cbl_month.Items.Count; i++)
                        {
                            if (cbl_month.Items[i].Selected == true)
                            {
                                FpSpread1.Sheets[0].ColumnCount++;
                                FarPoint.Web.Spread.DoubleCellType db = new FarPoint.Web.Spread.DoubleCellType();
                                db.ErrorMessage = "Enter only Numbers";
                                FpSpread1.Columns[FpSpread1.Sheets[0].ColumnCount - 1].CellType = db;

                                // FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, i].HorizontalAlign = HorizontalAlign.Center;
                                FpSpread1.Sheets[0].ColumnHeader.Cells[0, FpSpread1.Sheets[0].ColumnCount - 1].Text            = Convert.ToString(cbl_month.Items[i].Text);
                                FpSpread1.Sheets[0].ColumnHeader.Cells[0, FpSpread1.Sheets[0].ColumnCount - 1].Tag             = Convert.ToString(cbl_month.Items[i].Value);
                                FpSpread1.Sheets[0].ColumnHeader.Cells[0, FpSpread1.Sheets[0].ColumnCount - 1].HorizontalAlign = HorizontalAlign.Center;
                                FpSpread1.Sheets[0].ColumnHeader.Cells[0, FpSpread1.Sheets[0].ColumnCount - 1].Font.Name       = "Book Antiqua";
                                FpSpread1.Sheets[0].ColumnHeader.Cells[0, FpSpread1.Sheets[0].ColumnCount - 1].Font.Size       = FontUnit.Medium;
                                FpSpread1.Columns[1].Width = 150;
                            }
                        }
                        for (int row = 0; row < 31; row++)
                        {
                            FpSpread1.Sheets[0].RowCount++;
                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Text            = Convert.ToString(row + 1);
                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].HorizontalAlign = HorizontalAlign.Center;
                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Font.Size       = FontUnit.Medium;
                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Font.Name       = "Book Antiqua";
                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Text            = Convert.ToString(row + 1);
                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].HorizontalAlign = HorizontalAlign.Center;
                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Font.Size       = FontUnit.Medium;
                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Font.Name       = "Book Antiqua";
                        }
                        DataView dv         = new DataView();
                        string   query      = "";
                        string   rebatetype = "";
                        if (rdbdate.Checked == true)
                        {
                            rebatetype = "1";
                        }
                        else
                        {
                            rebatetype = "2";
                        }
                        query = "select RebateActDays, RebateDays,RebateAmount  ,RebateMonth  from HM_RebateMaster where HostelFK in ('" + itemheadercode + "') and RebateMonth in ('" + month + "') and RebateType ='" + rebatetype + "'";
                        //}
                        //else
                        //{
                        //    rebatetype = "2";
                        //    query = "select Actual_Day, Grant_Day,Grant_Amount  ,Rebate_Month  from Rebate_Master where Hostel_Code in ('" + itemheadercode + "') and Rebate_Month in ('" + month + "') and Rebate_Type ='" + rebatetype + "'";
                        //}
                        ds1 = d2.select_method_wo_parameter(query, "Text");
                        if (ds1.Tables[0].Rows.Count > 0)
                        {
                            if (FpSpread1.Sheets[0].ColumnCount > 2)
                            {
                                for (int ik = 2; ik < FpSpread1.Sheets[0].ColumnCount; ik++)
                                {
                                    string getmonthvalue = Convert.ToString(FpSpread1.Sheets[0].ColumnHeader.Cells[0, ik].Tag);
                                    if (FpSpread1.Sheets[0].RowCount > 0)
                                    {
                                        for (int row = 0; row < FpSpread1.Sheets[0].RowCount; row++)
                                        {
                                            string currentday = Convert.ToString(FpSpread1.Sheets[0].Cells[row, 1].Text);

                                            ds1.Tables[0].DefaultView.RowFilter = "RebateActDays='" + currentday + "' and RebateMonth='" + getmonthvalue + "'";
                                            dv = ds1.Tables[0].DefaultView;
                                            if (dv.Count > 0)
                                            {
                                                if (rdbdate.Checked == true)
                                                {
                                                    FpSpread1.Sheets[0].Cells[row, ik].Text            = Convert.ToString(dv[0]["RebateDays"]);
                                                    FpSpread1.Sheets[0].Cells[row, ik].HorizontalAlign = HorizontalAlign.Right;
                                                }
                                                else
                                                {
                                                    FpSpread1.Sheets[0].Cells[row, ik].Text            = Convert.ToString(dv[0]["RebateAmount"]);
                                                    FpSpread1.Sheets[0].Cells[row, ik].HorizontalAlign = HorizontalAlign.Right;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        //25.04.16
                        //if (txt_allmonth.Text.Trim() != "")
                        //{
                        //    if (FpSpread1.Sheets[0].ColumnCount > 2)
                        //    {
                        //        for (int i = 0; i < FpSpread1.Sheets[0].ColumnCount - 2; i++)
                        //        {
                        //            int k = 0;
                        //            for (int row = 0; row < 31; row++)
                        //            {
                        //                k++;
                        //                FpSpread1.Sheets[0].Cells[k - 1, i + 2].Text = Convert.ToString(txt_allmonth.Text);
                        //                FpSpread1.Sheets[0].Cells[k - 1, i + 2].HorizontalAlign = HorizontalAlign.Center;
                        //                FpSpread1.Sheets[0].Cells[k - 1, i + 2].Font.Size = FontUnit.Medium;
                        //                FpSpread1.Sheets[0].Cells[k - 1, i + 2].Font.Name = "Book Antiqua";
                        //            }
                        //        }
                        //    }
                        //}
                    }
                    FpSpread1.Visible  = true;
                    div_report.Visible = true;
                    //div1.Visible = true;
                    lblerror.Visible             = false;
                    btnsave.Visible              = true;
                    btn_reset.Visible            = true;
                    FpSpread1.Sheets[0].PageSize = FpSpread1.Sheets[0].RowCount;
                }
            }
        }
        catch
        {
        }
    }
    protected void btn_go_Click(object sender, EventArgs e)
    {
        try
        {
            Printcontrol.Visible = false;
            string itemheadercode = "";
            for (int i = 0; i < cbl_menuname.Items.Count; i++)
            {
                if (cbl_menuname.Items[i].Selected == true)
                {
                    if (itemheadercode == "")
                    {
                        itemheadercode = "" + cbl_menuname.Items[i].Value.ToString() + "";
                    }
                    else
                    {
                        itemheadercode = itemheadercode + "'" + "," + "'" + cbl_menuname.Items[i].Value.ToString() + "";
                    }
                }
            }

            string itemheadercode1 = "";
            for (int i = 0; i < cbl_menutype.Items.Count; i++)
            {
                if (cbl_menutype.Items[i].Selected == true)
                {
                    if (itemheadercode1 == "")
                    {
                        itemheadercode1 = "" + cbl_menutype.Items[i].Value.ToString() + "";
                    }
                    else
                    {
                        itemheadercode1 = itemheadercode1 + "'" + "," + "'" + cbl_menutype.Items[i].Value.ToString() + "";
                    }
                }
            }

            string selectquery = "";
            if (txt_menuid.Text.Trim() != "")
            {
                selectquery = " select (select StudentTypeName From HostelStudentType where StudentType-1=MenuType)  as MenuType,MenuType as MenuTypecode,MenuCode,MenuName,MenuMasterPK from HM_MenuMaster where CollegeCode='" + collegecode1 + "' and MenuCode like '%" + txt_menuid.Text + "%'  order by MenuCode";
            }
            else if (txt_search.Text.Trim() != "")
            {
                selectquery = "select (select StudentTypeName From HostelStudentType where StudentType-1=MenuType)  as MenuType,MenuType as MenuTypecode,MenuCode,MenuName,MenuMasterPK  from HM_MenuMaster where CollegeCode='" + collegecode1 + "' and MenuName like '%" + txt_search.Text + "%' order by MenuCode";
            }
            else
            {
                if (itemheadercode.Trim() != "" && itemheadercode1.Trim() != "")
                {
                    selectquery = "select (select StudentTypeName From HostelStudentType where StudentType-1=MenuType)  as MenuType,MenuType as MenuTypecode,MenuCode,MenuName ,MenuMasterPK from HM_MenuMaster  where CollegeCode='" + collegecode1 + "' and MenuCode in ('" + itemheadercode + "') and MenuType in ('" + itemheadercode1 + "') order by MenuCode";
                }//case when MenuType ='0' then 'Veg' else 'Non Veg' end
                else
                {
                    div1.Visible      = false;
                    Fpspread1.Visible = false;
                    rptprint.Visible  = false;
                    lbl_error.Visible = true;
                    lbl_error.Text    = "Please Select All Field";
                }
            }
            ds.Clear();
            if (selectquery.Trim() != "")
            {
                ds = d2.select_method_wo_parameter(selectquery, "Text");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    Fpspread1.Sheets[0].RowCount              = 0;
                    Fpspread1.Sheets[0].ColumnCount           = 0;
                    Fpspread1.CommandBar.Visible              = false;
                    Fpspread1.Sheets[0].AutoPostBack          = true;
                    Fpspread1.Sheets[0].ColumnHeader.RowCount = 1;
                    Fpspread1.Sheets[0].RowHeader.Visible     = false;
                    Fpspread1.Sheets[0].ColumnCount           = 4;
                    FarPoint.Web.Spread.StyleInfo darkstyle = new FarPoint.Web.Spread.StyleInfo();
                    darkstyle.BackColor = ColorTranslator.FromHtml("#0CA6CA");
                    darkstyle.ForeColor = Color.White;
                    Fpspread1.ActiveSheetView.ColumnHeader.DefaultStyle = darkstyle;

                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 0].Text            = "S.No";
                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 0].Font.Bold       = true;
                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 0].Font.Name       = "Book Antiqua";
                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 0].Font.Size       = FontUnit.Medium;
                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 0].HorizontalAlign = HorizontalAlign.Center;
                    Fpspread1.Columns[0].Width = 50;

                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 1].Text            = "Menu Type";
                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 1].Font.Bold       = true;
                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 1].Font.Name       = "Book Antiqua";
                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 1].Font.Size       = FontUnit.Medium;
                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 1].HorizontalAlign = HorizontalAlign.Center;


                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 2].Text            = "Menu Code";
                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 2].Font.Bold       = true;
                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 2].Font.Name       = "Book Antiqua";
                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 2].Font.Size       = FontUnit.Medium;
                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 2].HorizontalAlign = HorizontalAlign.Center;

                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 3].Text            = "Menu Name";
                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 3].Font.Bold       = true;
                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 3].Font.Name       = "Book Antiqua";
                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 3].Font.Size       = FontUnit.Medium;
                    Fpspread1.Sheets[0].ColumnHeader.Cells[0, 3].HorizontalAlign = HorizontalAlign.Center;


                    for (int row = 0; row < ds.Tables[0].Rows.Count; row++)
                    {
                        Fpspread1.Sheets[0].RowCount++;
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 0].Text            = Convert.ToString(row + 1);
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 0].HorizontalAlign = HorizontalAlign.Center;
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 0].Font.Size       = FontUnit.Medium;
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 0].Font.Name       = "Book Antiqua";
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 1].Text            = Convert.ToString(ds.Tables[0].Rows[row]["MenuType"]);
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 1].Tag             = Convert.ToString(ds.Tables[0].Rows[row]["MenuMasterPK"]);
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 1].HorizontalAlign = HorizontalAlign.Left;
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 1].Font.Size       = FontUnit.Medium;
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 1].Font.Name       = "Book Antiqua";

                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 2].Text            = Convert.ToString(ds.Tables[0].Rows[row]["MenuCode"]);
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 2].Tag             = Convert.ToString(ds.Tables[0].Rows[row]["MenuTypecode"]);
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 2].HorizontalAlign = HorizontalAlign.Left;
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 2].Font.Size       = FontUnit.Medium;
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 2].Font.Name       = "Book Antiqua";
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 3].Text            = Convert.ToString(ds.Tables[0].Rows[row]["MenuName"]);
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 3].HorizontalAlign = HorizontalAlign.Left;
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 3].Font.Size       = FontUnit.Medium;
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 3].Font.Name       = "Book Antiqua";
                    }
                    Fpspread1.Visible            = true;
                    rptprint.Visible             = true;
                    div1.Visible                 = true;
                    lbl_error.Visible            = false;
                    Fpspread1.Sheets[0].PageSize = Fpspread1.Sheets[0].RowCount;
                }
                else
                {
                    div1.Visible      = false;
                    Fpspread1.Visible = false;
                    rptprint.Visible  = false;
                    lbl_error.Visible = true;
                    lbl_error.Text    = "No Records Found";
                }
            }
            else
            {
                div1.Visible      = false;
                Fpspread1.Visible = false;
                rptprint.Visible  = false;
                lbl_error.Visible = true;
                lbl_error.Text    = "Please Select All Fields";
            }
        }
        catch
        {
        }
    }
Ejemplo n.º 30
0
    public void btn_go_Click(object sender, EventArgs e)
    {
        try
        {
            Printcontrol.Visible = false;
            if (txt_hostelname.Text.Trim() != "--Select--" && txt_groupname.Text.Trim() != "--Select--" && txt_description.Text.Trim() != "--Select--")
            {
                DateTime dt         = new DateTime();
                DateTime dt1        = new DateTime();
                string   firstdate  = Convert.ToString(txt_fromdate.Text);
                string   seconddate = Convert.ToString(txt_todate.Text);
                string[] split      = firstdate.Split('/');
                dt = Convert.ToDateTime(split[1] + "/" + split[0] + "/" + split[2]);
                string[] split1 = seconddate.Split('/');
                dt1 = Convert.ToDateTime(split1[1] + "/" + split1[0] + "/" + split1[2]);
                string hostel = "";
                for (int i = 0; i < cbl_hostelname.Items.Count; i++)
                {
                    if (cbl_hostelname.Items[i].Selected == true)
                    {
                        if (hostel == "")
                        {
                            hostel = "" + cbl_hostelname.Items[i].Value.ToString() + "";
                        }
                        else
                        {
                            hostel = hostel + "'" + "," + "" + "'" + cbl_hostelname.Items[i].Value.ToString() + "";
                        }
                    }
                }

                string group = "";
                for (int i = 0; i < cbl_groupname.Items.Count; i++)
                {
                    if (cbl_groupname.Items[i].Selected == true)
                    {
                        if (group == "")
                        {
                            group = "" + cbl_groupname.Items[i].Value.ToString() + "";
                        }
                        else
                        {
                            group = group + "'" + "," + "" + "'" + cbl_groupname.Items[i].Value.ToString() + "";
                        }
                    }
                }

                string gn = d2.GetFunction("");
                string q1 = "";
                if (rdb_datewise.Checked == true)
                {
                    // q1 = "select CONVERT(varchar(10), Entry_Date,103) as Entry_Date, hd.Hostel_Name,hi.IncGroup_Code,(select TextVal from TextValTable where TextCode = ISNULL( hi.IncGroup_Code,0)) as IncGroup_Code_txt,hi.Inc_Amount,hi.Inc_Description from Hostel_Income hi,Hostel_Details hd where  hd.Hostel_code=hi.Hostel_Code and hd.college_code='" + collegecode1 + "' and hi.Entry_Date between '" + dt.ToString("MM/dd/yyyy") + "' and '" + dt1.ToString("MM/dd/yyyy") + "' and hi.Hostel_Code=hd.Hostel_code and hi.Hostel_Code in('" + hostel + "')and hi.IncGroup_Code in('" + group + "')";
                    q1 = "select CONVERT(varchar(10), IncomeDate,103) as IncomeDate, hd.HostelName,hi.IncomeGroup,(select MasterValue from CO_MasterValues where MasterCode = ISNULL( hi.IncomeGroup,0)) as IncGroup_Code_txt,hi.IncomeAmount,hi.IncomeDesc from HT_HostelIncome hi,HM_HostelMaster hd where  hd.HostelMasterPK=hi.HostelMasterFK and hi.IncomeDate between '" + dt.ToString("MM/dd/yyyy") + "' and '" + dt1.ToString("MM/dd/yyyy") + "' and hi.HostelMasterFK in('" + hostel + "')and hi.IncomeGroup in('" + group + "')";//and hd.collegecode='" + collegecode1 + "'
                }
                else
                {
                    lbl_error1.Visible = false;
                    q1 = "select CONVERT(varchar(10), IncomeDate,103) as IncomeDate, hd.HostelName,hi.IncomeGroup,(select MasterValue from CO_MasterValues where MasterCode = ISNULL( hi.IncomeGroup,0)) as IncGroup_Code_txt,SUM(hi.IncomeAmount)as IncomeAmount,hi.IncomeDesc from HT_HostelIncome hi,HM_HostelMaster hd where hd.HostelMasterPK=hi.HostelMasterFK  and hi.HostelMasterFK in('" + hostel + "') and hi.IncomeGroup in('" + group + "') group by hi.IncomeGroup,hd.HostelName,hi.IncomeDesc,hi.IncomeDate";//
                }

                ds.Clear();
                ds = d2.select_method_wo_parameter(q1, "Text");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    Fpspread2.Sheets[0].RowCount              = 0;
                    Fpspread2.Sheets[0].ColumnCount           = 0;
                    Fpspread2.CommandBar.Visible              = false;
                    Fpspread2.Sheets[0].AutoPostBack          = true;
                    Fpspread2.Sheets[0].ColumnHeader.RowCount = 1;
                    Fpspread2.Sheets[0].RowHeader.Visible     = false;
                    Fpspread2.Sheets[0].ColumnCount           = 6;

                    FarPoint.Web.Spread.StyleInfo darkstyle = new FarPoint.Web.Spread.StyleInfo();
                    darkstyle.BackColor = ColorTranslator.FromHtml("#0CA6CA");
                    darkstyle.ForeColor = Color.White;
                    Fpspread2.ActiveSheetView.ColumnHeader.DefaultStyle = darkstyle;

                    Fpspread2.Sheets[0].ColumnHeader.Cells[0, 0].Text            = "S.No";
                    Fpspread2.Sheets[0].ColumnHeader.Cells[0, 0].Font.Bold       = true;
                    Fpspread2.Sheets[0].ColumnHeader.Cells[0, 0].HorizontalAlign = HorizontalAlign.Center;
                    Fpspread2.Sheets[0].ColumnHeader.Cells[0, 0].Font.Name       = "Book Antiqua";
                    Fpspread2.Sheets[0].ColumnHeader.Cells[0, 0].Font.Size       = FontUnit.Medium;
                    Fpspread2.Columns[0].Width = 50;

                    Fpspread2.Sheets[0].ColumnHeader.Cells[0, 1].Text            = "Hostel Name";
                    Fpspread2.Sheets[0].ColumnHeader.Cells[0, 1].Font.Bold       = true;
                    Fpspread2.Sheets[0].ColumnHeader.Cells[0, 1].HorizontalAlign = HorizontalAlign.Center;
                    Fpspread2.Sheets[0].ColumnHeader.Cells[0, 1].Font.Name       = "Book Antiqua";
                    Fpspread2.Sheets[0].ColumnHeader.Cells[0, 1].Font.Size       = FontUnit.Medium;
                    Fpspread2.Columns[1].Width = 200;

                    Fpspread2.Sheets[0].ColumnHeader.Cells[0, 2].Text            = "Group Name";
                    Fpspread2.Sheets[0].ColumnHeader.Cells[0, 2].Font.Bold       = true;
                    Fpspread2.Sheets[0].ColumnHeader.Cells[0, 2].HorizontalAlign = HorizontalAlign.Center;
                    Fpspread2.Sheets[0].ColumnHeader.Cells[0, 2].Font.Name       = "Book Antiqua";
                    Fpspread2.Sheets[0].ColumnHeader.Cells[0, 2].Font.Size       = FontUnit.Medium;
                    Fpspread2.Columns[2].Width = 100;

                    Fpspread2.Sheets[0].ColumnHeader.Cells[0, 3].Text            = "Description";
                    Fpspread2.Sheets[0].ColumnHeader.Cells[0, 3].Font.Bold       = true;
                    Fpspread2.Sheets[0].ColumnHeader.Cells[0, 3].HorizontalAlign = HorizontalAlign.Center;
                    Fpspread2.Sheets[0].ColumnHeader.Cells[0, 3].Font.Name       = "Book Antiqua";
                    Fpspread2.Sheets[0].ColumnHeader.Cells[0, 3].Font.Size       = FontUnit.Medium;
                    Fpspread2.Columns[3].Width = 200;

                    Fpspread2.Sheets[0].ColumnHeader.Cells[0, 4].Text            = "Amount";
                    Fpspread2.Sheets[0].ColumnHeader.Cells[0, 4].Font.Bold       = true;
                    Fpspread2.Sheets[0].ColumnHeader.Cells[0, 4].HorizontalAlign = HorizontalAlign.Center;
                    Fpspread2.Sheets[0].ColumnHeader.Cells[0, 4].Font.Name       = "Book Antiqua";
                    Fpspread2.Sheets[0].ColumnHeader.Cells[0, 4].Font.Size       = FontUnit.Medium;
                    Fpspread2.Columns[4].Width = 150;

                    Fpspread2.Sheets[0].ColumnHeader.Cells[0, 5].Text            = "Date";
                    Fpspread2.Sheets[0].ColumnHeader.Cells[0, 5].Font.Bold       = true;
                    Fpspread2.Sheets[0].ColumnHeader.Cells[0, 5].HorizontalAlign = HorizontalAlign.Center;
                    Fpspread2.Sheets[0].ColumnHeader.Cells[0, 5].Font.Name       = "Book Antiqua";
                    Fpspread2.Sheets[0].ColumnHeader.Cells[0, 5].Font.Size       = FontUnit.Medium;
                    Fpspread2.Columns[4].Width = 150;


                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        Fpspread2.Sheets[0].RowCount++;
                        Fpspread2.Sheets[0].Cells[Fpspread2.Sheets[0].RowCount - 1, 0].Text = Convert.ToString(i + 1);

                        Fpspread2.Sheets[0].Cells[Fpspread2.Sheets[0].RowCount - 1, 0].HorizontalAlign = HorizontalAlign.Center;
                        Fpspread2.Sheets[0].Cells[Fpspread2.Sheets[0].RowCount - 1, 0].Font.Size       = FontUnit.Medium;
                        Fpspread2.Sheets[0].Cells[Fpspread2.Sheets[0].RowCount - 1, 0].Font.Name       = "Book Antiqua";

                        Fpspread2.Sheets[0].Cells[Fpspread2.Sheets[0].RowCount - 1, 1].Text            = Convert.ToString(ds.Tables[0].Rows[i]["HostelName"]);
                        Fpspread2.Sheets[0].Cells[Fpspread2.Sheets[0].RowCount - 1, 1].HorizontalAlign = HorizontalAlign.Left;
                        Fpspread2.Sheets[0].Cells[Fpspread2.Sheets[0].RowCount - 1, 1].Font.Size       = FontUnit.Medium;
                        Fpspread2.Sheets[0].Cells[Fpspread2.Sheets[0].RowCount - 1, 1].Font.Name       = "Book Antiqua";

                        Fpspread2.Sheets[0].Cells[Fpspread2.Sheets[0].RowCount - 1, 2].Text            = Convert.ToString(ds.Tables[0].Rows[i]["IncGroup_Code_txt"]);
                        Fpspread2.Sheets[0].Cells[Fpspread2.Sheets[0].RowCount - 1, 2].Tag             = Convert.ToString(ds.Tables[0].Rows[i]["IncomeGroup"]);
                        Fpspread2.Sheets[0].Cells[Fpspread2.Sheets[0].RowCount - 1, 2].HorizontalAlign = HorizontalAlign.Left;
                        Fpspread2.Sheets[0].Cells[Fpspread2.Sheets[0].RowCount - 1, 2].Font.Size       = FontUnit.Medium;
                        Fpspread2.Sheets[0].Cells[Fpspread2.Sheets[0].RowCount - 1, 2].Font.Name       = "Book Antiqua";

                        Fpspread2.Sheets[0].Cells[Fpspread2.Sheets[0].RowCount - 1, 3].Text            = Convert.ToString(ds.Tables[0].Rows[i]["IncomeDesc"]);
                        Fpspread2.Sheets[0].Cells[Fpspread2.Sheets[0].RowCount - 1, 3].HorizontalAlign = HorizontalAlign.Left;
                        Fpspread2.Sheets[0].Cells[Fpspread2.Sheets[0].RowCount - 1, 3].Font.Size       = FontUnit.Medium;
                        Fpspread2.Sheets[0].Cells[Fpspread2.Sheets[0].RowCount - 1, 3].Font.Name       = "Book Antiqua";

                        Fpspread2.Sheets[0].Cells[Fpspread2.Sheets[0].RowCount - 1, 4].Text            = Convert.ToString(ds.Tables[0].Rows[i]["IncomeAmount"]);
                        Fpspread2.Sheets[0].Cells[Fpspread2.Sheets[0].RowCount - 1, 4].HorizontalAlign = HorizontalAlign.Right;
                        Fpspread2.Sheets[0].Cells[Fpspread2.Sheets[0].RowCount - 1, 4].Font.Size       = FontUnit.Medium;
                        Fpspread2.Sheets[0].Cells[Fpspread2.Sheets[0].RowCount - 1, 4].Font.Name       = "Book Antiqua";

                        Fpspread2.Sheets[0].Cells[Fpspread2.Sheets[0].RowCount - 1, 5].Text            = Convert.ToString(ds.Tables[0].Rows[i]["IncomeDate"]);
                        Fpspread2.Sheets[0].Cells[Fpspread2.Sheets[0].RowCount - 1, 5].HorizontalAlign = HorizontalAlign.Right;
                        Fpspread2.Sheets[0].Cells[Fpspread2.Sheets[0].RowCount - 1, 5].Font.Size       = FontUnit.Medium;
                        Fpspread2.Sheets[0].Cells[Fpspread2.Sheets[0].RowCount - 1, 5].Font.Name       = "Book Antiqua";
                    }
                    Fpspread2.Sheets[0].PageSize = Fpspread2.Sheets[0].RowCount;
                    Fpspread2.SaveChanges();
                    Fpspread2.Visible = true;
                    rptprint.Visible  = true;
                    div2.Visible      = true;
                    lbl_error.Visible = false;
                }
                else
                {
                    Fpspread2.Visible = false;
                    div2.Visible      = false;
                    rptprint.Visible  = false;
                    lbl_error.Visible = true;
                    lbl_error.Text    = "No Record Found";
                }
            }

            else
            {
                Fpspread2.Visible = false;
                rptprint.Visible  = false;
                div2.Visible      = false;
                lbl_error.Visible = true;
                lbl_error.Text    = "Please Select All Field";
            }
        }

        catch
        {
        }
    }