public void binddegree()
    {
        try
        {
            ds.Clear();
            //txtDegree.Text = "---Select---";
            string batchCode = string.Empty;
            //chkDegree.Checked = false;
            //cblDegree.Items.Clear();
            //userCode = Session["usercode"].ToString();
            //singleUser = Session["single_user"].ToString();
            //groupUserCode = Session["group_code"].ToString();
            collegeCode = string.Empty;
            if (ddlCollege.Items.Count > 0)
            {
                collegeCode = ddlCollege.SelectedValue.ToString().Trim();
            }

            string columnfield = string.Empty;
            string group_user  = ((Session["group_code"] != null) ? Convert.ToString(Session["group_code"]) : string.Empty);
            if (group_user.Contains(';'))
            {
                string[] group_semi = group_user.Split(';');
                group_user = Convert.ToString(group_semi[0]);
            }
            if ((Convert.ToString(group_user).Trim() != "") && Session["single_user"] != null && (Convert.ToString(Session["single_user"]) != "1" && Convert.ToString(Session["single_user"]) != "true" && Convert.ToString(Session["single_user"]) != "TRUE" && Convert.ToString(Session["single_user"]) != "True"))
            {
                columnfield = " and group_code='" + group_user + "'";
            }
            else if (Session["usercode"] != null)
            {
                columnfield = " and user_code='" + Convert.ToString(Session["usercode"]).Trim() + "'";
            }
            string valBatch = string.Empty;
            if (cblBatch.Items.Count > 0)
            {
                valBatch = rs.GetSelectedItemsValueAsString(cblBatch);
            }
            if (!string.IsNullOrEmpty(collegeCode) && !string.IsNullOrEmpty(valBatch))
            {
                string selDegree = "SELECT DISTINCT c.Edu_Level FROM Degree dg,Course c,Department dt,DeptPrivilages dp,Registration r WHERE r.degree_code = dg.Degree_Code AND dp.degree_code = dg.Degree_Code AND dg.Course_Id = c.Course_Id AND dg.Dept_Code = dt.Dept_Code AND r.college_code = c.college_code AND r.college_code = dg.college_code AND dt.college_code = r.college_code AND c.college_code = dg.college_code  and r.Exam_Flag<>'debar' AND r.college_code in('" + collegeCode + "') AND r.Batch_Year in('" + valBatch + "') " + columnfield + " ORDER BY c.Edu_Level ";
                ds = da.select_method_wo_parameter(selDegree, "Text");
            }
            if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                ddlEdulevl.DataSource     = ds;
                ddlEdulevl.DataTextField  = "Edu_Level";
                ddlEdulevl.DataValueField = "Edu_Level";
                ddlEdulevl.DataBind();
                //checkBoxListselectOrDeselect(cblDegree, true);
                //CallCheckboxListChange(chkDegree, cblDegree, txtDegree, lblDegree.Text, "--Select--");
            }
        }
        catch (Exception ex)
        {
        }
    }
Пример #2
0
 public void bindbranch()
 {
     try
     {
         string rights = "";
         txt_branch.Text = "--Select--";
         if (group_user.Contains(";"))
         {
             string[] group_semi = group_user.Split(';');
             group_user = group_semi[0].ToString();
         }
         if ((group_user.ToString().Trim() != "") && (group_user.Trim() != "0") && (group_user.ToString().Trim() != "-1"))
         {
             rights = "and group_code='" + group_user + "'";
         }
         else
         {
             rights = " and user_code='" + usercode + "'";
         }
         cbl_branch.Items.Clear();
         string commname = "";
         string branch   = rs.GetSelectedItemsValueAsString(cbl_degree);
         if (branch != "")
         {
             commname = "select distinct degree.degree_code,department.dept_name,degree.Acronym  from degree,department,course,deptprivilages where course.course_id=degree.course_id  and department.dept_code=degree.dept_code and course.college_code = degree.college_code and department.college_code = degree.college_code and degree.course_id in('" + branch + "') and deptprivilages.Degree_code=degree.Degree_code and degree.college_code='" + ddlcollege.SelectedItem.Value + "' " + rights + " ";
             ds       = d2.select_method(commname, hat, "Text");
             if (ds.Tables[0].Rows.Count > 0)
             {
                 cbl_branch.DataSource     = ds;
                 cbl_branch.DataTextField  = "dept_name";
                 cbl_branch.DataValueField = "degree_code";
                 cbl_branch.DataBind();
                 if (cbl_branch.Items.Count > 0)
                 {
                     //for (int i = 0; i < cbl_branch.Items.Count; i++)
                     //{
                     cbl_branch.Items[0].Selected = true;
                     //}
                     txt_branch.Text = lbl_branchT.Text + "(" + 1 + ")";
                 }
             }
         }
     }
     catch (Exception ex)
     {
     }
 }
 protected void binddept()
 {
     try
     {
         ds.Clear();
         cbl_dept.Items.Clear();
         string getcolcode = rs.GetSelectedItemsValueAsString(cbl_clg);
         string item       = "select distinct dept_code,dept_name from hrdept_master where college_code  in('" + getcolcode + "') order by dept_name";
         ds = d2.select_method_wo_parameter(item, "Text");
         if (ds.Tables[0].Rows.Count > 0)
         {
             cbl_dept.DataSource     = ds;
             cbl_dept.DataTextField  = "dept_name";
             cbl_dept.DataValueField = "dept_code";
             cbl_dept.DataBind();
             if (cbl_dept.Items.Count > 0)
             {
                 for (int i = 0; i < cbl_dept.Items.Count; i++)
                 {
                     cbl_dept.Items[i].Selected = true;
                 }
                 txt_dept.Text   = "Department (" + cbl_dept.Items.Count + ")";
                 cb_dept.Checked = true;
             }
         }
         else
         {
             txt_dept.Text   = "--Select--";
             cb_dept.Checked = false;
         }
     }
     catch { }
 }
Пример #4
0
 protected void bind_district()//delsi2701
 {
     try
     {
         q1 = "";
         //q1 = " select distinct textval,a.Districtp from textvaltable t,applyn a,Registration r where r.App_No=a.app_no and a.Districtp= convert(nvarchar(100),t.TextCode) and textcriteria='dis' ";
         string clg_code    = Convert.ToString(ddl_college.SelectedItem.Value);
         string batch_year  = Convert.ToString(ddl_batch.SelectedItem.Value);
         string branch_code = rs.GetSelectedItemsValueAsString(cbl_branch);
         if (clg_code != "" && batch_year != "" && branch_code != "")
         {
             // q1 = "select distinct textval,a.Districtp from textvaltable t,applyn a,Registration r where r.App_No=a.app_no and a.Districtp= convert(nvarchar(100),t.TextCode) and textcriteria='dis' and r.college_code='" + clg_code + "' and  r.Batch_Year='" + batch_year + "' and r.degree_code in('" + branch_code + "')";
             q1 = "select distinct textval,a.cityp from textvaltable t,applyn a,Registration r where r.App_No=a.app_no and a.cityp= convert(nvarchar(100),t.TextCode) and textcriteria='city'  and r.college_code='" + clg_code + "' and  r.Batch_Year='" + batch_year + "' and r.degree_code in('" + branch_code + "')";//modified
         }
         ds.Clear();
         ds = d2.select_method_wo_parameter(q1, "text");
         cbl_comm.Items.Clear();
         if (ds.Tables[0].Rows.Count > 0)
         {
             cbl_comm.DataSource     = ds;
             cbl_comm.DataTextField  = "textval";
             cbl_comm.DataValueField = "cityp";//modified
             cbl_comm.DataBind();
             if (cbl_comm.Items.Count > 0)
             {
                 for (int i = 0; i < cbl_comm.Items.Count; i++)
                 {
                     cbl_comm.Items[i].Selected = true;
                 }
                 txt_comm.Text   = "District (" + cbl_comm.Items.Count + ")";
                 cb_comm.Checked = true;
             }
         }
         else
         {
             txt_comm.Text = "--Select--";
         }
     }
     catch
     { }
 }
 public void binddept()
 {
     try
     {
         cbldepartment.Items.Clear();
         string build  = "";
         string build2 = "";
         build  = Convert.ToString(ddledulevel.SelectedItem.Value);
         build2 = rs.GetSelectedItemsValueAsString(cbldegree);
         if (build != "" && build2 != "")
         {
             string deptquery = "select distinct degree.degree_code,department.dept_name,department.dept_code from degree,department,course,deptprivilages where course.course_id=degree.course_id and  department .dept_code=degree.dept_code and course.college_code = degree.college_code and department.college_code = degree.college_code and degree.course_id in('" + build2 + "') and degree.college_code in ('" + clgcode + "') and deptprivilages.Degree_code=degree.Degree_code and user_code in ('" + usercode + "') and course.Edu_Level in ('" + build + "')";
             ds.Clear();
             ds = d2.select_method_wo_parameter(deptquery, "Text");
             if (ds.Tables[0].Rows.Count > 0)
             {
                 cbldepartment.DataSource     = ds;
                 cbldepartment.DataTextField  = "dept_name";
                 cbldepartment.DataValueField = "degree_code";
                 cbldepartment.DataBind();
                 if (cbldepartment.Items.Count > 0)
                 {
                     for (i = 0; i < cbldepartment.Items.Count; i++)
                     {
                         cbldepartment.Items[i].Selected = true;
                     }
                     cbdepartment1.Checked = true;
                     txt_department.Text   = lblBran.Text + "(" + cbldepartment.Items.Count + ")";
                 }
             }
         }
         else
         {
             cbdepartment1.Checked = false;
             txt_department.Text   = "--Select--";
         }
     }
     catch (Exception ex) { }
 }
Пример #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["collegecode"] == null)
     {
         Response.Redirect("~/Default.aspx");
     }
     usercode   = Session["usercode"].ToString();
     singleuser = Session["single_user"].ToString();
     group_user = Session["group_code"].ToString();
     if (!IsPostBack)
     {
         bindcollege();
         collegecode = rs.GetSelectedItemsValueAsString(cblclg);
         binddept();
         designation();
         category();
         stafftype();
         staffstatus();
         bindyear();
         bindmonth();
     }
     lbl_alert.Visible = false;
     lblerror.Text     = "";
 }
    private void bindStaff()
    {
        try
        {
            string DeptCode  = Rs.GetSelectedItemsValueAsString(cbl_dept);
            string DesigCode = Rs.GetSelectedItemsValueAsString(cblDesig);
            string staffType = Rs.GetSelectedItemsValueAsString(cblStfType);
            ds.Clear();
            ddlStfName.Items.Clear();
            string SelQ = "select sm.staff_code,(sm.staff_code+' - '+sm.staff_name) as Staff_Name from staffmaster sm,stafftrans st,staff_appl_master sa where sm.staff_code=st.staff_code and sm.appl_no=sa.appl_no and sm.resign='0' and sm.settled='0' and ISNULL(sm.Discontinue,'0')='0' and st.latestrec='1' and sm.college_code='" + collegecode + "' ";
            if (DeptCode.Trim() != "")
            {
                SelQ += " and st.dept_code in ('" + DeptCode + "')";
            }
            if (DesigCode.Trim() != "")
            {
                SelQ += " and st.desig_code in ('" + DesigCode + "')";
            }
            if (staffType.Trim() != "")
            {
                SelQ += " and st.stftype in ('" + staffType + "')";
            }

            SelQ += " order by len(sm.staff_code),sm.staff_Code";

            ds = d2.select_method_wo_parameter(SelQ, "Text");
            if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                ddlStfName.DataSource     = ds;
                ddlStfName.DataTextField  = "Staff_Name";
                ddlStfName.DataValueField = "staff_code";
                ddlStfName.DataBind();
                ddlStfName.Items.Insert(0, "All");
            }
            else
            {
                ddlStfName.Items.Insert(0, "All");
            }
        }
        catch { }
    }
    public void bindbranch()
    {
        try
        {
            //ddl_branch.Items.Clear();
            cbl_branch.Items.Clear();
            txt_branch.Text   = lbl_branch.Text;
            cb_branch.Checked = true;
            string degree = "";
            degree = reUse.GetSelectedItemsValueAsString(cbl_degree);//ddl_degree.Items.Count > 0 ? ddl_degree.SelectedValue : "";


            string commname = "";
            if (degree != "")
            {
                commname = "select distinct degree.degree_code,department.dept_name,degree.Acronym,department.dept_code  from degree,department,course,deptprivilages where course.course_id=degree.course_id  and department.dept_code=degree.dept_code and course.college_code = degree.college_code and department.college_code = degree.college_code and degree.course_id in('" + degree + "') and deptprivilages.Degree_code=degree.Degree_code ";
            }
            else
            {
                commname = " select distinct degree.degree_code,department.dept_name,degree.Acronym,department.dept_code  from degree,department,course,deptprivilages where course.course_id=degree.course_id  and department.dept_code=degree.dept_code and course.college_code = degree.college_code and department.college_code = degree.college_code and deptprivilages.Degree_code=degree.Degree_code";
            }

            DataSet ds = DA.select_method_wo_parameter(commname, "Text");
            if (ds.Tables[0].Rows.Count > 0)
            {
                //ddl_branch.DataSource = ds;
                //ddl_branch.DataTextField = "dept_name";
                //ddl_branch.DataValueField = "degree_code";
                //ddl_branch.DataBind();
                cbl_branch.DataSource     = ds;
                cbl_branch.DataTextField  = "dept_name";
                cbl_branch.DataValueField = "degree_code";
                cbl_branch.DataBind();
                reUse.CallCheckBoxChangedEvent(cbl_branch, cb_branch, txt_branch, lbl_branch.Text);
            }
        }
        catch (Exception ex) { }
    }
Пример #9
0
    protected void btngo_Click(object sender, EventArgs e)
    {
        try
        {
            string   valCollege            = string.Empty;
            int      exMonthName           = 0;
            int      colspanbranch         = 0;
            int      colspansubj           = 0;
            int      coldeg                = 0;
            int      coldegr               = 0;
            int      dsrow                 = 0;
            int      inrow                 = 0;
            string   sess                  = string.Empty;
            string   collegeCode1          = string.Empty;
            int      total                 = 0;
            bool     colspanBool           = false;
            string   BranchCodeReplication = string.Empty;
            string   degree                = string.Empty;
            string   subjcode              = string.Empty;
            DataView colSpanDV             = new DataView();
            DataView colSpansub            = new DataView();
            DataSet  dsCollege             = new DataSet();
            Fpspread.Sheets[0].Visible              = true;
            Fpspread.Sheets[0].AutoPostBack         = true;
            Fpspread.Sheets[0].RowHeader.Visible    = false;
            Fpspread.Sheets[0].ColumnHeader.Visible = true;
            MyStyle.Font.Size       = FontUnit.Medium;
            MyStyle.Font.Name       = "Book Antiqua";
            MyStyle.Font.Bold       = true;
            MyStyle.HorizontalAlign = HorizontalAlign.Center;
            MyStyle.ForeColor       = Color.White;
            MyStyle.BackColor       = ColorTranslator.FromHtml("#0CA6CA");
            Fpspread.Sheets[0].ColumnHeader.DefaultStyle = MyStyle;
            Fpspread.CommandBar.Visible    = false;
            Fpspread.Sheets[0].ColumnCount = 8;
            Fpspread.Sheets[0].RowCount    = 2;
            Fpspread.BorderWidth           = 2;
            valCollege = rs.GetSelectedItemsValueAsString(cblCollege);
            btn_directprint.Visible = true;
            if (valCollege.ToString() != "")
            {
                if (ddlDate.SelectedValue != "" && ddlSession.SelectedValue != "")
                {
                    lblerror.Visible = false;
                    Fpspread.Visible = true;
                    int.TryParse(Convert.ToString(ddlMonth.SelectedValue).Trim(), out exMonthName);
                    string   exdate      = Convert.ToString(ddlDate.SelectedValue).Trim();
                    string[] spl1        = exdate.Split('-');
                    DateTime dtl1        = Convert.ToDateTime(spl1[1] + '-' + spl1[0] + '-' + spl1[2]);
                    string   exmdate     = dtl1.ToString("dd");
                    string   exmmonth    = dtl1.ToString("MM");
                    string   exmmonthful = dtl1.ToString("MMMM");
                    string   exmyear     = dtl1.ToString("yyyy");
                    string   examdate    = exmyear + '-' + exmmonth + '-' + exmdate;
                    string   prmonthyea  = exmmonthful + '-' + exmyear;

                    // string sql ="select distinct s.subject_code, de.Dept_Name,c.Course_Name,d.Degree_Code,s.subject_name,d.Acronym,et.exam_date,et.exam_session from exmtt e,exmtt_det et,course c,Degree d,Department de,subject s  where  e.degree_code=d.Degree_Code and c.Course_Id=d.Course_Id and d.Dept_Code=de.Dept_Code  and et.exam_date='" + examdate + "' and e.exam_Month='" + exMonthName + "' and e.Exam_Year='" + ddlYear.SelectedItem.Text + "' and et.exam_session='" + ddlSession.SelectedItem.Text + "' and et.coll_code in('" + valCollege + "')and e.exam_code=et.exam_code and et.subject_no=s.subject_no group by c.Course_Name, de.Dept_Name,d.Degree_Code,s.subject_name,d.Acronym,et.exam_date,et.exam_session,s.subject_code order by de.Dept_Name";
                    //string sql = "select distinct s.subject_code,de.Dept_Name,c.Course_Name,s.subject_name,et.exam_date,et.exam_session,d.Acronym,COUNT(ea.roll_no) as stucount from Exam_Details e,exam_application ea,exam_appl_details ed,subject s,exmtt_det et, Registration r,Degree d,course c,Department de where e.exam_code=ea.exam_code and ea.appl_no=ed.appl_no and ed.subject_no=s.subject_no and s.subject_no=et.subject_no and ea.roll_no =r.Roll_No and r.degree_code=d.Degree_Code and d.Dept_Code=de.Dept_Code and d.Course_Id=c.Course_Id and e.Exam_Month='" + exMonthName + "'and et.coll_code in('" + valCollege + "') and e.Exam_year='" + ddlYear.SelectedItem.Text + "' and  et.exam_date='" + examdate + "' and et.exam_session='" + ddlSession.SelectedItem.Text + "' group by s.subject_code,de.Dept_Name,c.Course_Name,s.subject_name,et.exam_date,et.exam_session,d.Acronym,c.type order by de.Dept_Name";

                    string sql = "select  s.subject_code,(c.Course_Name+'-'+de.Dept_Name) as course,c.Edu_Level,s.subject_name,et.exam_date,et.exam_session,d.Acronym,COUNT(ea.roll_no) as stucount from Exam_Details e,exam_application ea,exam_appl_details ed,subject s,exmtt_det et, Registration r,Degree d,course c,Department de where e.exam_code=ea.exam_code and ea.appl_no=ed.appl_no and ed.subject_no=s.subject_no and s.subject_no=et.subject_no and ea.roll_no =r.Roll_No and r.degree_code=d.Degree_Code and d.Dept_Code=de.Dept_Code and d.Course_Id=c.Course_Id and e.Exam_Month='" + exMonthName + "' and et.coll_code in('" + valCollege + "') and e.Exam_year='" + ddlYear.SelectedItem.Text + "'  and  et.exam_date='" + examdate + "' and et.exam_session='" + ddlSession.SelectedItem.Text + "'  group by s.subject_code,de.Dept_Name,c.Course_Name,s.subject_name,et.exam_date,et.exam_session,d.Acronym,c.Edu_Level,c.type order by  s.subject_code";
                    ds = dt.select_method_wo_parameter(sql, "text");
                    int tabrow = ds.Tables[0].Rows.Count;
                    if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                    {
                        Fpspread.Sheets[0].RowCount = 0;
                        for (int j = 0; j < ds.Tables[0].Rows.Count; j++)
                        {
                            Fpspread.Sheets[0].RowCount++;
                            Fpspread.Sheets[0].ColumnHeader.Cells[0, 0].Text            = "Date of Exam";
                            Fpspread.Sheets[0].ColumnHeader.Cells[0, 0].Font.Bold       = true;
                            Fpspread.Sheets[0].ColumnHeader.Cells[0, 0].Font.Name       = "Book Antiqua";
                            Fpspread.Sheets[0].ColumnHeader.Cells[0, 0].Font.Size       = FontUnit.Medium;
                            Fpspread.Sheets[0].ColumnHeader.Cells[0, 0].HorizontalAlign = HorizontalAlign.Center;
                            Fpspread.Columns[0].Width = 50;
                            Fpspread.Sheets[0].ColumnHeader.Cells[0, 1].Text            = "Session";
                            Fpspread.Sheets[0].ColumnHeader.Cells[0, 1].Font.Bold       = true;
                            Fpspread.Sheets[0].ColumnHeader.Cells[0, 1].Font.Name       = "Book Antiqua";
                            Fpspread.Sheets[0].ColumnHeader.Cells[0, 1].Font.Size       = FontUnit.Medium;
                            Fpspread.Sheets[0].ColumnHeader.Cells[0, 1].HorizontalAlign = HorizontalAlign.Center;
                            Fpspread.Columns[1].Width = 50;
                            Fpspread.Sheets[0].ColumnHeader.Cells[0, 2].Text            = "Subject Code";
                            Fpspread.Sheets[0].ColumnHeader.Cells[0, 2].Font.Bold       = true;
                            Fpspread.Sheets[0].ColumnHeader.Cells[0, 2].Font.Name       = "Book Antiqua";
                            Fpspread.Sheets[0].ColumnHeader.Cells[0, 2].Font.Size       = FontUnit.Medium;
                            Fpspread.Sheets[0].ColumnHeader.Cells[0, 2].HorizontalAlign = HorizontalAlign.Center;
                            Fpspread.Columns[1].Width = 50;
                            string subj     = Convert.ToString(ds.Tables[0].Rows[j]["subject_code"]).Trim();
                            string subjname = Convert.ToString(ds.Tables[0].Rows[j]["subject_name"]).Trim();
                            Fpspread.Sheets[0].ColumnHeader.Cells[0, 3].Text            = "Branch";
                            Fpspread.Sheets[0].ColumnHeader.Cells[0, 3].Font.Bold       = true;
                            Fpspread.Sheets[0].ColumnHeader.Cells[0, 3].Font.Name       = "Book Antiqua";
                            Fpspread.Sheets[0].ColumnHeader.Cells[0, 3].Font.Size       = FontUnit.Medium;
                            Fpspread.Sheets[0].ColumnHeader.Cells[0, 3].HorizontalAlign = HorizontalAlign.Center;
                            Fpspread.Columns[1].Width = 50;
                            string edulevel = Convert.ToString(ds.Tables[0].Rows[j]["Edu_Level"]).Trim();
                            ds.Tables[0].DefaultView.RowFilter = " Edu_Level='" + Convert.ToString(ds.Tables[0].Rows[j]["Edu_Level"]) + "' ";
                            if (!hat.ContainsKey(edulevel))
                            {
                                hat.Add(edulevel, subjname);
                                Spdegree.InnerHtml = "DEGREE: " + edulevel + "";
                            }
                            string bran = Convert.ToString(ds.Tables[0].Rows[j]["course"]).Trim();
                            ds.Tables[0].DefaultView.RowFilter = " course='" + Convert.ToString(ds.Tables[0].Rows[j]["course"]) + "' ";
                            colSpanDV = ds.Tables[0].DefaultView;
                            if (BranchCodeReplication != Convert.ToString(ds.Tables[0].Rows[j]["course"]))
                            {
                                Fpspread.Sheets[0].Cells[j, 3].Text            = Convert.ToString(bran).Trim();
                                Fpspread.Sheets[0].Cells[j, 3].VerticalAlign   = VerticalAlign.Middle;
                                Fpspread.Sheets[0].Cells[j, 3].HorizontalAlign = HorizontalAlign.Left;
                                if (BranchCodeReplication != "")
                                {
                                    if (colSpanDV.Count > 0)
                                    {
                                        Fpspread.Sheets[0].SpanModel.Add(Fpspread.Sheets[0].RowCount - colspanbranch - 1, 3, colspanbranch, 1);
                                    }
                                }
                                colspanbranch = 0;
                            }
                            colspanbranch++;
                            BranchCodeReplication = Convert.ToString(ds.Tables[0].Rows[j]["course"]).Trim();
                            Fpspread.Sheets[0].ColumnHeader.Cells[0, 4].Text            = "Q.P Code/Booklet code";
                            Fpspread.Sheets[0].ColumnHeader.Cells[0, 4].Font.Bold       = true;
                            Fpspread.Sheets[0].ColumnHeader.Cells[0, 4].Font.Name       = "Book Antiqua";
                            Fpspread.Sheets[0].ColumnHeader.Cells[0, 4].Font.Size       = FontUnit.Medium;
                            Fpspread.Sheets[0].ColumnHeader.Cells[0, 4].HorizontalAlign = HorizontalAlign.Center;
                            Fpspread.Columns[1].Width = 50;
                            Fpspread.Sheets[0].ColumnHeader.Cells[0, 5].Text            = "Answer Paper Packet Number Alloted by College";
                            Fpspread.Sheets[0].ColumnHeader.Cells[0, 5].Font.Bold       = true;
                            Fpspread.Sheets[0].ColumnHeader.Cells[0, 5].Font.Name       = "Book Antiqua";
                            Fpspread.Sheets[0].ColumnHeader.Cells[0, 5].Font.Size       = FontUnit.Medium;
                            Fpspread.Sheets[0].ColumnHeader.Cells[0, 5].HorizontalAlign = HorizontalAlign.Center;
                            Fpspread.Columns[1].Width = 50;
                            Fpspread.Sheets[0].ColumnHeader.Cells[0, 6].Text            = "Subject";
                            Fpspread.Sheets[0].ColumnHeader.Cells[0, 6].Font.Bold       = true;
                            Fpspread.Sheets[0].ColumnHeader.Cells[0, 6].Font.Name       = "Book Antiqua";
                            Fpspread.Sheets[0].ColumnHeader.Cells[0, 6].Font.Size       = FontUnit.Medium;
                            Fpspread.Sheets[0].ColumnHeader.Cells[0, 6].HorizontalAlign = HorizontalAlign.Center;
                            Fpspread.Columns[1].Width = 50;
                            Fpspread.Sheets[0].ColumnHeader.Cells[0, 7].Text            = "Total Answer scripts";
                            Fpspread.Sheets[0].ColumnHeader.Cells[0, 7].Font.Bold       = true;
                            Fpspread.Sheets[0].ColumnHeader.Cells[0, 7].Font.Name       = "Book Antiqua";
                            Fpspread.Sheets[0].ColumnHeader.Cells[0, 7].Font.Size       = FontUnit.Medium;
                            Fpspread.Sheets[0].ColumnHeader.Cells[0, 7].HorizontalAlign = HorizontalAlign.Center;
                            Fpspread.Columns[1].Width = 50;
                            string  strquery = "select *,district+' - '+pincode  as districtpin from collinfo where college_code='" + Convert.ToString(Session["collegecode"]).Trim() + "'";
                            DataSet ds1      = new DataSet();
                            ds1.Dispose();
                            ds1.Reset();
                            ds1 = dt.select_method_wo_parameter(strquery, "Text");
                            spF1College.InnerText = ds1.Tables[0].Rows[0]["Collname"].ToString();
                            string catagor = ds1.Tables[0].Rows[0]["category"].ToString();
                            // string[] strpa = Convert.ToString(ds1.Tables[0].Rows[0]["affliatedby"]).Trim().Split(',');
                            spcategory.InnerHtml = "(" + Convert.ToString(catagor).Trim() + " & " + Convert.ToString(ds1.Tables[0].Rows[0]["university"]).Trim() + ")";
                            spF1Date.InnerText   = "Month & year of Exam: " + Convert.ToString(prmonthyea).Trim() + "";
                            spHead.InnerText     = "DESPATCH OF ANSWER PACKETS ";
                            dateoedel.InnerHtml  = "Date of Delvery:" + Convert.ToString(ddlDate.SelectedValue).Trim() + "";
                            spsign.InnerHtml     = "Signature of the Anna University Representative";
                            spsignchif.InnerHtml = "Signature of the Chief Superintendent";
                            spsig.InnerHtml      = "Authorized Signatory office of COE";
                            spnbun.InnerHtml     = "Received " + ds.Tables[0].Rows.Count + " bundles from exam cell";
                            ds.Tables[0].DefaultView.RowFilter = " subject_code='" + Convert.ToString(ds.Tables[0].Rows[j]["subject_code"]) + "' ";
                            colSpansub = ds.Tables[0].DefaultView;
                            if (subjcode != Convert.ToString(ds.Tables[0].Rows[j]["subject_code"]))
                            {
                                if (subjcode != "")
                                {
                                    if (colSpansub.Count > 0)
                                    {
                                        dsrow = j;
                                        inrow = j;
                                        dsrow = ds.Tables[0].Rows.Count - 1;
                                        Fpspread.Sheets[0].SpanModel.Add(Fpspread.Sheets[0].RowCount - colspansubj - 1, 2, colspansubj, 1);
                                        Fpspread.Sheets[0].SpanModel.Add(Fpspread.Sheets[0].RowCount - colspansubj - 1, 6, colspansubj, 1);
                                    }
                                }
                                colspansubj = 0;
                            }
                            colspansubj++;
                            if (dsrow == 0 && j == ds.Tables[0].Rows.Count - 1)
                            {
                                Fpspread.Sheets[0].SpanModel.Add(0, 2, ds.Tables[0].Rows.Count, 1);
                                Fpspread.Sheets[0].SpanModel.Add(0, 6, ds.Tables[0].Rows.Count, 1);
                            }
                            if (dsrow == j)
                            {
                                Fpspread.Sheets[0].SpanModel.Add(inrow, 2, colspansubj, 1);
                                Fpspread.Sheets[0].SpanModel.Add(inrow, 6, colspansubj, 1);
                            }
                            subjcode = Convert.ToString(ds.Tables[0].Rows[j]["subject_code"]).Trim();
                            if (!hat.ContainsKey(subj))
                            {
                                hat.Add(subj, bran);
                                Fpspread.Sheets[0].Cells[j, 2].Text            = Convert.ToString(subj).Trim();
                                Fpspread.Sheets[0].Cells[j, 2].Font.Size       = FontUnit.Medium;
                                Fpspread.Sheets[0].Cells[j, 2].VerticalAlign   = VerticalAlign.Middle;
                                Fpspread.Sheets[0].Cells[j, 2].HorizontalAlign = HorizontalAlign.Center;
                                Fpspread.Sheets[0].Cells[j, 6].Text            = Convert.ToString(subjname).Trim();
                                Fpspread.Sheets[0].Cells[j, 6].Font.Size       = FontUnit.Medium;
                                Fpspread.Sheets[0].Cells[j, 6].VerticalAlign   = VerticalAlign.Middle;
                                Fpspread.Sheets[0].Cells[j, 6].HorizontalAlign = HorizontalAlign.Left;
                            }
                            Fpspread.Sheets[0].Cells[j, 7].Text            = Convert.ToString(ds.Tables[0].Rows[j]["stucount"]).Trim();
                            Fpspread.Sheets[0].Cells[j, 7].HorizontalAlign = HorizontalAlign.Center;
                            Fpspread.Sheets[0].Cells[j, 7].Font.Size       = FontUnit.Medium;
                            total += Convert.ToInt32(ds.Tables[0].Rows[j]["stucount"].ToString());
                        }
                        Fpspread.Sheets[0].SpanModel.Add(0, 0, Fpspread.Sheets[0].RowCount, 1);
                        Fpspread.Sheets[0].Cells[0, 0].Text            = Convert.ToString(exdate).Trim();
                        Fpspread.Sheets[0].Cells[0, 0].Font.Size       = FontUnit.Medium;
                        Fpspread.Sheets[0].Cells[0, 0].VerticalAlign   = VerticalAlign.Middle;
                        Fpspread.Sheets[0].Cells[0, 0].HorizontalAlign = HorizontalAlign.Center;
                        Fpspread.Sheets[0].SpanModel.Add(0, 1, Fpspread.Sheets[0].RowCount, 1);
                        Fpspread.Sheets[0].Cells[0, 1].Text            = Convert.ToString(ddlSession.SelectedValue).Trim();
                        Fpspread.Sheets[0].Cells[0, 1].Font.Size       = FontUnit.Medium;
                        Fpspread.Sheets[0].Cells[0, 1].VerticalAlign   = VerticalAlign.Middle;
                        Fpspread.Sheets[0].Cells[0, 1].HorizontalAlign = HorizontalAlign.Center;
                        Fpspread.Sheets[0].RowCount++;
                        Fpspread.Sheets[0].SpanModel.Add(Fpspread.Sheets[0].RowCount - 1, 0, 1, 5);
                        Fpspread.Sheets[0].Cells[Fpspread.Sheets[0].RowCount - 1, 0].Text            = "Total";
                        Fpspread.Sheets[0].Cells[Fpspread.Sheets[0].RowCount - 1, 7].Text            = Convert.ToString(total).Trim();
                        Fpspread.Sheets[0].Cells[Fpspread.Sheets[0].RowCount - 1, 7].Font.Size       = FontUnit.Medium;
                        Fpspread.Sheets[0].Cells[Fpspread.Sheets[0].RowCount - 1, 7].HorizontalAlign = HorizontalAlign.Center;
                        Fpspread.Sheets[0].Cells[Fpspread.Sheets[0].RowCount - 1, 0].HorizontalAlign = HorizontalAlign.Right;
                        Fpspread.Sheets[0].RowCount++;
                        Fpspread.Sheets[0].SpanModel.Add(Fpspread.Sheets[0].RowCount - 1, 0, 1, Fpspread.Sheets[0].Columns.Count);
                        if (ddlSession.SelectedValue.Trim() == "A.N")
                        {
                            sess = "Afternoon";
                        }
                        else
                        {
                            sess = "Forenoon";
                        }
                        Fpspread.Sheets[0].Cells[Fpspread.Sheets[0].RowCount - 1, 0].Text            = "1.Certificate of opening of sessionwise package of Q.P for " + sess + "";
                        Fpspread.Sheets[0].Cells[Fpspread.Sheets[0].RowCount - 1, 0].HorizontalAlign = HorizontalAlign.Left;
                        Fpspread.Sheets[0].RowCount++;
                        Fpspread.Sheets[0].SpanModel.Add(Fpspread.Sheets[0].RowCount - 1, 0, 1, Fpspread.Sheets[0].Columns.Count);
                        Fpspread.Sheets[0].Cells[Fpspread.Sheets[0].RowCount - 1, 0].Text            = "2.Student Attendance Sheet original copies for " + sess + "";
                        Fpspread.Sheets[0].Cells[Fpspread.Sheets[0].RowCount - 1, 0].HorizontalAlign = HorizontalAlign.Left;
                        Fpspread.Sheets[0].PageSize = Fpspread.Sheets[0].RowCount;
                        Fpspread.Width  = 900;
                        Fpspread.Height = 900;
                        Fpspread.SaveChanges();
                    }

                    else
                    {
                        lblerror.Text    = "No Records Found";
                        lblerror.Visible = true;
                    }
                }

                else
                {
                    lblerror.Text           = "Please select the date and session";
                    Fpspread.Visible        = false;
                    lblerror.Visible        = true;
                    btn_directprint.Visible = false;
                }
            }
            else
            {
                lblerror.Text           = "Please select all field";
                Fpspread.Visible        = false;
                lblerror.Visible        = true;
                btn_directprint.Visible = false;
            }
        }
        catch (Exception ex)
        { da.sendErrorMail(ex, collegeCode, "DespatchOfAnswerPackets"); }
    }
Пример #10
0
    private void loadheaderstaffwise(string DeptCode, string DesigCode) /* poomalar 16.10.17 */
    {
        try
        {
            Fpspread1.Visible  = false;
            rprint.Visible     = false;
            lblMainErr.Visible = false;
            string collCode = Convert.ToString(ddlcollege.SelectedItem.Value);

            Fpspread1.Sheets[0].AutoPostBack          = false;
            Fpspread1.Sheets[0].ColumnHeader.RowCount = 1;
            Fpspread1.Sheets[0].RowCount    = 0;
            Fpspread1.Sheets[0].ColumnCount = 7;

            Fpspread1.Sheets[0].RowHeader.Visible = false;
            Fpspread1.CommandBar.Visible          = false;
            darkstyle.Font.Name       = "Book Antiqua";
            darkstyle.Font.Bold       = true;
            darkstyle.Font.Size       = FontUnit.Medium;
            darkstyle.HorizontalAlign = HorizontalAlign.Center;
            darkstyle.ForeColor       = Color.Black;
            darkstyle.BackColor       = ColorTranslator.FromHtml("#0CA6CA");
            Fpspread1.Sheets[0].ColumnHeader.DefaultStyle = darkstyle;

            Fpspread1.Sheets[0].ColumnHeader.Cells[0, 0].Text = "S.No.";
            Fpspread1.Sheets[0].ColumnHeader.Cells[0, 1].Text = "Select";
            Fpspread1.Sheets[0].ColumnHeader.Cells[0, 2].Text = "Staff Name";
            Fpspread1.Sheets[0].ColumnHeader.Cells[0, 3].Text = "Staff Code";
            Fpspread1.Sheets[0].ColumnHeader.Cells[0, 4].Text = "Designation";
            Fpspread1.Sheets[0].ColumnHeader.Cells[0, 5].Text = "Total Hours";
            Fpspread1.Sheets[0].ColumnHeader.Cells[0, 6].Text = "Amount/Hrs";


            Fpspread1.Columns[0].Width = 50;
            Fpspread1.Columns[1].Width = 50;
            Fpspread1.Columns[2].Width = 200;
            Fpspread1.Columns[3].Width = 100;
            Fpspread1.Columns[4].Width = 200;
            Fpspread1.Columns[5].Width = 100;
            Fpspread1.Columns[6].Width = 100;


            Fpspread1.Columns[0].Locked = true;
            Fpspread1.Columns[2].Locked = true;
            Fpspread1.Columns[3].Locked = true;
            Fpspread1.Columns[4].Locked = true;

            CheckAll.AutoPostBack   = true;
            CheckInd.AutoPostBack   = false;
            DoubleHrs.MaximumValue  = 70;
            DoubleHrs.ErrorMessage  = "Allow only Numerics & Max Hours is 70!";
            DoubleAmnt.ErrorMessage = "Allow only Numerics!";
            string           query        = "";
            ReuasableMethods rs           = new ReuasableMethods();
            string           deptcodesel  = rs.GetSelectedItemsValueAsString(cbl_dept);
            string           desigcodesel = rs.GetSelectedItemsValueAsString(cblDesig);

            query = "select sm.staff_code,sm.staff_name,h.dept_name,desig.desig_name,st.stftype,sc.category_name,h.dept_code,desig.desig_code,sm.college_Code,sm.appl_no,isnull(Tot_Hrs,0) Tot_Hrs,isnull(Amnt_Per_Hrs,0) Amnt_Per_Hrs from staffmaster sm,hrdept_master h,desig_master desig,staffcategorizer sc,stafftrans st LEFT JOIN HourWise_PaySettings HW ON st.staff_code=hw.StaffCode and hw.dept_code=st.dept_code and hw.desig_code=hw.desig_code  where sm.staff_code=st.staff_code and sm.college_code=h.college_code and sm.college_code=desig.collegeCode and sm.college_code=sc.college_code and (isnull(st.stfnature,0)='1' or isnull(st.stfnature,'')='part') and st.dept_code=h.dept_code and st.desig_code=desig.desig_code and st.category_code=sc.category_code and st.latestrec='1' and sm.resign='0' and sm.settled='0' and ISNULL(Discontinue,'0')='0' and sm.college_code='" + collCode + "' and h.dept_code in('" + deptcodesel + "') and desig.desig_code in('" + desigcodesel + "')";// and isnull(hw.PayType,0)='"+paytype+"'";
            DataSet dquery = new DataSet();


            dquery = d2.select_method_wo_parameter(query, "Text");
            int sno      = 1;
            int rowcount = 0;
            if (dquery.Tables.Count > 0 && dquery.Tables[0].Rows.Count > 0)
            {
                if (cbl_dept.Items.Count > 0 && txt_dept.Text.Trim() != "--Select--")
                {
                    Fpspread1.Sheets[0].RowCount++;
                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 1].CellType        = CheckAll;
                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 1].HorizontalAlign = HorizontalAlign.Center;
                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 1].Font.Name       = "Book Antiqua";
                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 1].Font.Bold       = true;

                    for (int st = 0; st < cbl_dept.Items.Count; st++)
                    {
                        if (cbl_dept.Items[st].Selected == true)
                        {
                            rowcount = 0;
                            Fpspread1.Sheets[0].RowCount++;
                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 0].Text            = Convert.ToString(cbl_dept.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, 7);

                            DataView dv = new DataView();
                            dquery.Tables[0].DefaultView.RowFilter = " dept_code='" + Convert.ToString(cbl_dept.Items[st].Value) + "'";
                            dv = dquery.Tables[0].DefaultView;
                            if (dv.Count > 0)
                            {
                                for (int i = 0; i < dv.Count; i++)
                                {
                                    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].CellType        = CheckInd;

                                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 1].HorizontalAlign = HorizontalAlign.Center;
                                    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[i]["staff_name"]);
                                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 2].HorizontalAlign = HorizontalAlign.Left;
                                    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[i]["staff_code"]);
                                    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";

                                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 4].Text            = Convert.ToString(dv[i]["desig_name"]);
                                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 4].Tag             = Convert.ToString(dv[i]["desig_code"]);
                                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 4].Note            = Convert.ToString(dv[i]["dept_code"]);
                                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 4].HorizontalAlign = HorizontalAlign.Left;
                                    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        = DoubleHrs;
                                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 5].Text            = Convert.ToString(dv[i]["Tot_Hrs"]);
                                    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";

                                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 6].Text            = Convert.ToString(dv[i]["Amnt_Per_Hrs"]);
                                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 6].HorizontalAlign = HorizontalAlign.Center;
                                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 6].Font.Name       = "Book Antiqua";
                                }
                            }
                            else
                            {
                                Fpspread1.Sheets[0].Rows[Fpspread1.Sheets[0].RowCount - 1].Remove();
                            }
                        }
                    }
                }
            }
            else
            {
                Fpspread1.Sheets[0].Rows[Fpspread1.Sheets[0].RowCount - 1].Remove();
            }

            Fpspread1.Sheets[0].PageSize = Fpspread1.Sheets[0].RowCount;
            Fpspread1.Sheets[0].SetColumnMerge(2, FarPoint.Web.Spread.Model.MergePolicy.Always);
            Fpspread1.Visible  = true;
            rprint.Visible     = true;
            btnSave.Visible    = true;
            lblMainErr.Visible = false;
        }
        catch (Exception e)
        {
            e.ToString();
        }
    }
    protected void btn_go_Click(object sender, EventArgs e)
    {
        try
        {
            Printcontrol.Visible = false;
            Hashtable DeductionHash = new Hashtable();
            int       sno           = 0;
            string    query         = "";
            string    deptcode      = rs.GetSelectedItemsValueAsString(cbl_dept);
            string    designation   = rs.GetSelectedItemsValueAsString(cbl_desig);
            string    stafftype     = rs.GetSelectedItemsValueAsString(cbl_staffc);
            Fpspread1.Sheets[0].Visible               = true;
            Fpspread1.Sheets[0].RowHeader.Visible     = false;
            Fpspread1.CommandBar.Visible              = false;
            Fpspread1.Sheets[0].AutoPostBack          = false;
            Fpspread1.Sheets[0].RowCount              = 0;
            Fpspread1.Sheets[0].ColumnHeader.RowCount = 1;
            Fpspread1.Sheets[0].ColumnCount           = 13;
            FarPoint.Web.Spread.StyleInfo darkstyle2 = new FarPoint.Web.Spread.StyleInfo();
            darkstyle2.BackColor       = ColorTranslator.FromHtml("#0CA6CA");
            darkstyle2.ForeColor       = Color.Black;
            darkstyle2.HorizontalAlign = HorizontalAlign.Center;
            Fpspread1.ActiveSheetView.ColumnHeader.DefaultStyle = darkstyle2;
            FarPoint.Web.Spread.TextCellType txt = new FarPoint.Web.Spread.TextCellType();
            // string deductiondates = Convert.ToString(txt_deduction.Text);
            //string[] deductiondates = txt_deduction.Text.Split('/');
            //string month = Convert.ToString(deductiondates[1].ToString());
            string frommonth = "";
            string tomonth   = "";
            string fromyear  = "";
            string toyear    = "";
            frommonth = Convert.ToString(ddl_frommonth.SelectedItem.Value);
            tomonth   = Convert.ToString(ddl_tomonth.SelectedItem.Value);
            fromyear  = Convert.ToString(ddl_fromyear.SelectedItem.Value);
            toyear    = Convert.ToString(ddl_toyear.SelectedItem.Value);
            query     = "select  s.staff_code,s.staff_name,appl_id,h.dept_name,d.desig_name,pangirnumber,m.netadd,convert(varchar(max),m.deductions)deductions,m.paymonth,m.payyear from staffmaster s,hrdept_master h,desig_master d,stafftrans st,staff_appl_master sm,monthlypay m where  m.staff_code=s.staff_code and m.staff_code=st.staff_code and s.staff_code=st.staff_code and st.Dept_Code = h.Dept_Code and d.desig_code=st.desig_code and s.college_code =  h.college_code and s.college_code = d.collegecode  and s.appl_no=sm.appl_no and h.dept_code in('" + deptcode + "')  and s.college_code='" + ddlcollege.SelectedItem.Value + "' and resign = 0 and settled = 0 and ISNULL(Discontinue,'0')='0' and st.latestrec=1  and CAST(CONVERT(varchar(20),m.PayMonth)+'/01/'+CONVERT(varchar(20),m.PayYear) as Datetime) between CAST(CONVERT(varchar(20),'" + frommonth + "')+'/01/'+CONVERT(varchar(20),'" + fromyear + "') as Datetime) and CAST(CONVERT(varchar(20),'" + tomonth + "')+'/01/'+CONVERT(varchar(20),'" + toyear + "') as Datetime) group by m.payyear,m.paymonth, LEN(s.staff_code),s.staff_code,s.staff_name,appl_id,h.dept_name,d.desig_name,pangirnumber,m.netadd,convert(varchar(max),m.deductions)order by  year(m.payyear),month(m.paymonth)";
            ds.Clear();
            ds = d2.select_method_wo_parameter(query, "text");
            DataSet data        = new DataSet();
            string  collegecode = ddlcollege.SelectedItem.Value;
            string  query1      = "select MasterCriteria1,MasterValue from CO_MasterValues where MasterCriteria='Quarterly Report Date' and collegecode='" + collegecode + "'";
            query1 += " select MasterCriteria1,MasterCriteriaValue1,MasterCriteriaValue2,MasterValue  from CO_MasterValues where MasterCriteria='Quarterly Report DepositDate' and collegecode='" + collegecode + "'";
            data    = d2.select_method_wo_parameter(query1, "text");
            if (ds.Tables[0].Rows.Count > 0)
            {
                ermsg.Visible     = false;
                Fpspread1.Visible = true;
                Fpspread1.ActiveSheetView.ColumnHeader.DefaultStyle.Font.Size = FontUnit.Medium;
                Fpspread1.ActiveSheetView.ColumnHeader.DefaultStyle.Font.Bold = true;
                Fpspread1.ActiveSheetView.ColumnHeader.DefaultStyle.Font.Name = "Book Antiqua";
                //Fpspread1.Sheets[0].ColumnHeader.Columns[0].Label = "Month";
                Fpspread1.Sheets[0].ColumnHeader.Columns[0].Label  = "S.No";
                Fpspread1.Sheets[0].ColumnHeader.Columns[1].Label  = "Employee No";
                Fpspread1.Sheets[0].ColumnHeader.Columns[2].Label  = "PAN No";
                Fpspread1.Sheets[0].ColumnHeader.Columns[3].Label  = "Name of the Employee";
                Fpspread1.Sheets[0].ColumnHeader.Columns[4].Label  = "Date of the payment/ credited";
                Fpspread1.Sheets[0].ColumnHeader.Columns[5].Label  = "Taxable amount on which tax Deducted";
                Fpspread1.Sheets[0].ColumnHeader.Columns[6].Label  = "TDS";
                Fpspread1.Sheets[0].ColumnHeader.Columns[7].Label  = "Education CESS";
                Fpspread1.Sheets[0].ColumnHeader.Columns[8].Label  = "Total Tax Deducted";
                Fpspread1.Sheets[0].ColumnHeader.Columns[9].Label  = "Total Tax Deposited";
                Fpspread1.Sheets[0].ColumnHeader.Columns[10].Label = "Date of Deduction";
                Fpspread1.Sheets[0].ColumnHeader.Columns[11].Label = "Date of Deposit";
                Fpspread1.Sheets[0].ColumnHeader.Columns[12].Label = "CHALLAN No";
                //  Fpspread1.Sheets[0].Columns[0].Width = 100;
                Fpspread1.Sheets[0].Columns[0].Width   = 80;
                Fpspread1.Sheets[0].Columns[1].Width   = 100;
                Fpspread1.Sheets[0].Columns[2].Width   = 150;
                Fpspread1.Sheets[0].Columns[3].Width   = 250;
                Fpspread1.Sheets[0].Columns[0].Locked  = true;
                Fpspread1.Sheets[0].Columns[1].Locked  = true;
                Fpspread1.Sheets[0].Columns[2].Locked  = true;
                Fpspread1.Sheets[0].Columns[3].Locked  = true;
                Fpspread1.Sheets[0].Columns[4].Locked  = true;
                Fpspread1.Sheets[0].Columns[5].Locked  = true;
                Fpspread1.Sheets[0].Columns[6].Locked  = true;
                Fpspread1.Sheets[0].Columns[7].Locked  = true;
                Fpspread1.Sheets[0].Columns[8].Locked  = true;
                Fpspread1.Sheets[0].Columns[9].Locked  = true;
                Fpspread1.Sheets[0].Columns[10].Locked = true;
                Fpspread1.Sheets[0].Columns[11].Locked = true;
                Fpspread1.Sheets[0].Columns[12].Locked = true;
                ArrayList arrPayMonthYear = new ArrayList();
                string    Amt             = string.Empty;
                string    preMon          = string.Empty;
                for (int rolcount = 0; rolcount < ds.Tables[0].Rows.Count; rolcount++)
                {
                    string paymonth  = ds.Tables[0].Rows[rolcount]["paymonth"].ToString();
                    string payYear   = ds.Tables[0].Rows[rolcount]["payyear"].ToString();
                    int    months    = Convert.ToInt32(paymonth);
                    string monthyear = Convert.ToString(months) + "/" + payYear;
                    if (monthyear != preMon)//barath 17.01.18
                    {
                        sno = 0;
                    }
                    preMon   = monthyear;
                    paymonth = getmonth(months);
                    string datemon    = string.Empty;
                    string deductdate = string.Empty;
                    //int year = Convert.ToInt32(payYear);
                    DataView dv = new DataView();
                    data.Tables[0].DefaultView.RowFilter = " MasterValue='" + monthyear + "'";
                    dv = data.Tables[0].DefaultView;
                    if (dv.Count > 0)
                    {
                        datemon    = Convert.ToString(dv[0]["MasterCriteria1"]);
                        deductdate = datemon + "/" + monthyear;
                    }
                    else
                    {
                        deductdate = string.Empty;
                    }
                    if (!arrPayMonthYear.Contains(Convert.ToString(paymonth + "@" + payYear).Trim().ToLower()))
                    {
                        if (arrPayMonthYear.Count > 0)
                        {
                            Fpspread1.Sheets[0].RowCount++;
                            Fpspread1.Sheets[0].Rows[Fpspread1.Sheets[0].RowCount - 1].BackColor           = Color.Bisque;
                            Fpspread1.Sheets[0].Rows[Fpspread1.Sheets[0].RowCount - 1].ForeColor           = Color.DarkRed;
                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 4].Text            = "Total";
                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 4].HorizontalAlign = HorizontalAlign.Center;
                            for (int Totalcol = 5; Totalcol < 10; Totalcol++)
                            {
                                Amt = string.Empty;
                                if (DeductionHash.ContainsKey(Totalcol))
                                {
                                    Amt = Convert.ToString(DeductionHash[Totalcol]);
                                }
                                Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, Totalcol].Text            = Amt;
                                Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, Totalcol].HorizontalAlign = HorizontalAlign.Right;
                            }
                            DeductionHash.Clear();
                        }
                        Fpspread1.Sheets[0].RowCount++;
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 0].Text            = Convert.ToString(paymonth) + "-" + payYear;
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 0].HorizontalAlign = HorizontalAlign.Left;
                        Fpspread1.Sheets[0].SpanModel.Add(Fpspread1.Sheets[0].RowCount - 1, 0, 1, 12);
                        arrPayMonthYear.Add(Convert.ToString(paymonth + "@" + payYear).Trim().ToLower());
                    }
                    sno++;
                    string name  = ds.Tables[0].Rows[rolcount]["staff_name"].ToString();
                    string code  = ds.Tables[0].Rows[rolcount]["staff_code"].ToString();
                    string panno = ds.Tables[0].Rows[rolcount]["pangirnumber"].ToString();
                    double gross = 0;
                    double.TryParse(Convert.ToString(ds.Tables[0].Rows[rolcount]["netadd"]), out gross);
                    string   tds           = ds.Tables[0].Rows[rolcount]["deductions"].ToString();
                    string   incTax        = "";
                    string   deductions    = Convert.ToString(ds.Tables[0].Rows[rolcount]["deductions"]);
                    string[] deductionlist = deductions.Split('\\');
                    for (int k = 0; k < deductionlist.GetUpperBound(0); k++)
                    {
                        string getactal = deductionlist[k];
                        if (getactal.Trim() != "" && getactal != null)
                        {
                            string[] actallspv = getactal.Split(';');
                            if (actallspv.GetUpperBound(0) >= 3)
                            {
                                if (actallspv[0].ToString().Trim().ToLower() == "inc tax" || actallspv[0].ToString().Trim().ToLower() == "income tax")
                                {
                                    string   de     = actallspv[0];
                                    string   de1    = actallspv[1];
                                    string   de2    = actallspv[2];
                                    string[] dedspl = de2.Split('-');
                                    if (dedspl.Length == 2)
                                    {
                                        if (de1.Trim().ToUpper() == "PERCENT")
                                        {
                                            incTax = Convert.ToString(dedspl[1]);
                                        }
                                        else if (de1.Trim().ToUpper() == "SLAB")
                                        {
                                            incTax = Convert.ToString(dedspl[1]);
                                        }
                                        else
                                        {
                                            incTax = Convert.ToString(dedspl[0]);
                                        }
                                    }
                                    else
                                    {
                                        incTax = Convert.ToString(actallspv[3]);
                                    }
                                    //double InctaxAmt = 0;
                                    //double.TryParse(incTax, out InctaxAmt);
                                    // TotalTaxAmt = InctaxAmt;
                                }
                            }
                        }
                    }
                    string date          = "";
                    double educationcess = 0;
                    double tax           = 0;
                    double.TryParse(incTax, out tax);
                    educationcess = Math.Round(tax / 100 * 3);
                    double totaltaxdeduct = Math.Round(tax + educationcess);
                    //string challan = "";
                    Fpspread1.Sheets[0].RowCount = Fpspread1.Sheets[0].RowCount + 1;
                    Fpspread1.Sheets[0].Rows[Fpspread1.Sheets[0].RowCount - 1].Font.Bold            = false;
                    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, 1].Text             = code;
                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 1].HorizontalAlign  = HorizontalAlign.Left;
                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 2].Text             = panno;
                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 2].HorizontalAlign  = HorizontalAlign.Left;
                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 3].Text             = name;
                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 3].HorizontalAlign  = HorizontalAlign.Left;
                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 4].Text             = date;
                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 4].HorizontalAlign  = HorizontalAlign.Left;
                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 5].Text             = Convert.ToString(gross);
                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 5].HorizontalAlign  = HorizontalAlign.Right;
                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 6].Text             = incTax;
                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 6].HorizontalAlign  = HorizontalAlign.Right;
                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 7].Text             = Convert.ToString(educationcess);
                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 7].HorizontalAlign  = HorizontalAlign.Right;
                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 8].Text             = Convert.ToString(totaltaxdeduct);
                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 8].HorizontalAlign  = HorizontalAlign.Right;
                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 9].Text             = Convert.ToString(totaltaxdeduct);
                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 9].HorizontalAlign  = HorizontalAlign.Right;
                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 10].CellType        = txt;
                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 10].Text            = deductdate;
                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 10].HorizontalAlign = HorizontalAlign.Left;

                    //barath 18.12.17

                    for (int Totalcol = 5; Totalcol < 10; Totalcol++)
                    {
                        double PrevAmt = 0;
                        double Amount  = 0;
                        double.TryParse(Convert.ToString(Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, Totalcol].Text), out Amount);
                        if (!DeductionHash.ContainsKey(Totalcol))
                        {
                            DeductionHash.Add(Totalcol, Amount);
                        }
                        else
                        {
                            PrevAmt = 0;
                            double.TryParse(Convert.ToString(DeductionHash[Totalcol]), out PrevAmt);
                            Amount += PrevAmt;
                            DeductionHash[Totalcol] = Amount;
                        }
                    }
                    string   depositDate = string.Empty;
                    string   challanNo   = string.Empty;
                    string   monyears    = string.Empty;
                    DataView dv1         = new DataView();
                    data.Tables[1].DefaultView.RowFilter = " MasterValue='" + monthyear + "'";
                    dv1 = data.Tables[1].DefaultView;
                    if (dv1.Count > 0)
                    {
                        monyears  = Convert.ToString(dv1[0]["MasterCriteriavalue2"]);
                        challanNo = Convert.ToString(dv1[0]["MasterCriteriavalue1"]);
                        datemon   = Convert.ToString(dv1[0]["MasterCriteria1"]);
                        // depositDate = datemon + "/" + monthyear;
                        depositDate = datemon + "/" + monyears;
                    }
                    else
                    {
                        depositDate = string.Empty;
                        challanNo   = string.Empty;
                    }
                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 11].CellType        = txt;
                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 11].Text            = depositDate;
                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 11].HorizontalAlign = HorizontalAlign.Left;

                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 12].CellType        = txt;
                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 12].Text            = challanNo;
                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 12].HorizontalAlign = HorizontalAlign.Left;
                }
                //barath 18.12.17
                Amt = string.Empty;
                if (DeductionHash.Count > 0)
                {
                    Fpspread1.Sheets[0].RowCount++;
                    Fpspread1.Sheets[0].Rows[Fpspread1.Sheets[0].RowCount - 1].BackColor           = Color.Bisque;
                    Fpspread1.Sheets[0].Rows[Fpspread1.Sheets[0].RowCount - 1].ForeColor           = Color.DarkRed;
                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 4].Text            = "Total";
                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 4].HorizontalAlign = HorizontalAlign.Center;
                    for (int Totalcol = 5; Totalcol < 10; Totalcol++)
                    {
                        Amt = string.Empty;
                        if (DeductionHash.ContainsKey(Totalcol))
                        {
                            Amt = Convert.ToString(DeductionHash[Totalcol]);
                        }
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, Totalcol].Text            = Amt;
                        Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, Totalcol].HorizontalAlign = HorizontalAlign.Right;
                    }
                }
                Fpspread1.Sheets[0].PageSize = Fpspread1.Sheets[0].RowCount;
                Fpspread1.Width  = 1000;
                Fpspread1.Height = 500;
                rptprint.Visible = true;
            }
            else
            {
                if ((txt_dept.Text == "--Select--") || (txt_desig.Text == "--Select--") || (txt_staffc.Text == "--Select--"))
                {
                    ermsg.Visible = true;
                    ermsg.Text    = "Please Select Atleast One Item";
                }
                else
                {
                    Fpspread1.Visible = false;
                    ermsg.Visible     = true;
                    ermsg.Text        = "No Records Found";
                    rptprint.Visible  = false;
                    //btnprintmaster.Visible = false;
                }
            }
        }
        catch (Exception ex)
        {
            alertmessage.Visible   = true;
            lbl_alerterror.Visible = true;
            lbl_alerterror.Text    = ex.ToString();
        }
    }
 void binddegree()
 {
     try
     {
         string query = "";
         cbl_degree.Items.Clear();
         txt_degree.Text = "--Select--";
         if (ddlcollege.Items.Count > 0)
         {
             string educationlevel = rs.GetSelectedItemsValueAsString(cbl_edu);
             if (educationlevel == "")
             {
                 query = "select distinct d.Course_Id,c.Course_Name from Degree d,course c where d.Course_Id=c.Course_Id and d.college_code=c.college_code and d.college_code='" + ddlcollege.SelectedItem.Value + "' order by d.Course_Id";
             }
             else
             {
                 query = "select distinct d.Course_Id,c.Course_Name from Degree d,course c where d.Course_Id=c.Course_Id and d.college_code=c.college_code and d.college_code='" + ddlcollege.SelectedItem.Value + "' and Edu_Level in('" + educationlevel + "') order by d.Course_Id";
             }
             ds.Clear();
             ds = d2.select_method_wo_parameter(query, "Text");
             if (ds.Tables[0].Rows.Count > 0)
             {
                 cbl_degree.DataSource     = ds;
                 cbl_degree.DataTextField  = "course_name";
                 cbl_degree.DataValueField = "course_id";
                 cbl_degree.DataBind();
                 //for (int i = 0; i < cbl_degree.Items.Count; i++)
                 //{
                 cbl_degree.Items[0].Selected = true;
                 txt_degree.Text   = lbl_degree.Text + "(1)";
                 cb_degree.Checked = true;
                 //}
             }
             else
             {
                 txt_degree.Text = "--Select--";
             }
         }
     }
     catch (Exception ex)
     {
     }
 }
Пример #13
0
 public void BindBatch()
 {
     try
     {
         cbl_batch.Items.Clear();
         cb_batch.Checked = false;
         txt_batch.Text   = "--Select--";
         string college_cd = rs.GetSelectedItemsValueAsString(Cbl_college);
         if (college_cd != "")
         {
             ds = d2.BindBatch();
             if (ds.Tables[0].Rows.Count > 0)
             {
                 cbl_batch.DataSource     = ds;
                 cbl_batch.DataTextField  = "batch_year";
                 cbl_batch.DataValueField = "batch_year";
                 cbl_batch.DataBind();
             }
             if (cbl_batch.Items.Count > 0)
             {
                 //for (int row = 0; row < cbl_batch.Items.Count; row++)
                 //{
                 cbl_batch.Items[0].Selected = true;
                 //cb_batch.Checked = true;
                 //}
                 txt_batch.Text = "Batch(1)";
             }
             else
             {
                 txt_batch.Text = "--Select--";
             }
         }
         BindDegree();
     }
     catch (Exception ex)
     {
         d2.sendErrorMail(ex, collegecode1, "Feedback_anonymousisgender");
     }
 }
Пример #14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            //****************************************************//
            //string PageLogOut = "";
            //string sess = Convert.ToString(Session["IsLogin"]);
            //PageLogOut = Convert.ToString(Session["PageLogout"]);
            //if (sess == "")
            //{
            //}
            //else
            //{
            //    if (!Request.FilePath.Contains("HRM"))
            //    {
            //        string strPreviousPage = "";
            //        if (Request.UrlReferrer != null)
            //        {
            //            strPreviousPage = Request.UrlReferrer.Segments[Request.UrlReferrer.Segments.Length - 1];
            //        }
            //        if (strPreviousPage == "")
            //        {
            //            string redrURI = ConfigurationManager.AppSettings["HR"].Trim();
            //            Response.Redirect(redrURI, false);
            //            return;
            //        }
            //    }
            //}
            //if (Session["collegecode"] == null)
            //{
            //    string redrURI = ConfigurationManager.AppSettings["Logout"].Trim();
            //    Response.Redirect(redrURI, false);
            //    return;
            //}
            if (Session["collegecode"] == null)
            {
                Response.Redirect("~/Default.aspx");
            }

            if (!Request.FilePath.Contains("HRMenuIndex"))
            {
                string strPreviousPage = "";
                if (Request.UrlReferrer != null)
                {
                    strPreviousPage = Request.UrlReferrer.Segments[Request.UrlReferrer.Segments.Length - 1];
                }
                if (strPreviousPage == "")
                {
                    Response.Redirect("~/HRMOD/HRMenuIndex.aspx");
                    return;
                }
            }
            //****************************************************//
            usercode   = Session["usercode"].ToString();
            singleuser = Session["single_user"].ToString();
            group_user = Session["group_code"].ToString();
            if (!IsPostBack)
            {
                bindcollege();
                collegecode = rs.GetSelectedItemsValueAsString(cblclg);
                binddept();
                designation();
                category();
                stafftype();
                staffstatus();
                bindyear();
                bindmonth();
            }
            lbl_alert.Visible = false;
            lblerror.Text     = "";
        }
        catch (Exception ex) { }
    }
Пример #15
0
    protected void btn_go_Click(object sender, EventArgs e)
    {
        try
        {
            Printcontrol.Visible = false;
            Hashtable totalvalue_dic = new Hashtable();
            if (txt_degree.Text != "--Select--" && txt_branch.Text != "--Select--" && txt_batch.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            = "Institution 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, 1].Font.Size       = FontUnit.Medium;
                Fpspread1.Sheets[0].ColumnHeader.Cells[0, 1].HorizontalAlign = HorizontalAlign.Center;

                Fpspread1.Sheets[0].ColumnCount++;
                Fpspread1.Sheets[0].ColumnHeader.Cells[0, Fpspread1.Sheets[0].ColumnCount - 1].Text            = lbl_branch.Text;
                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 = 200;

                Fpspread1.Sheets[0].ColumnCount++;
                Fpspread1.Sheets[0].ColumnHeader.Cells[0, Fpspread1.Sheets[0].ColumnCount - 1].Text            = "Enquiry";
                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            = "Applied";
                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            = "Admitted";
                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            = "Total";
                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 (cb_onlyadmission.Checked)
                {
                    Fpspread1.Columns[Fpspread1.Sheets[0].ColumnCount - 4].Visible = false;
                    Fpspread1.Columns[Fpspread1.Sheets[0].ColumnCount - 3].Visible = false;
                    Fpspread1.Columns[Fpspread1.Sheets[0].ColumnCount - 1].Visible = false;
                }
                double totalvalue = 0; double totalval = 0;
                if (cbl_branch.Items.Count > 0)//delsi Modified IsEnquiry Instead is confirm  ISNULL(Admission_Status,0)=1
                {
                    string batchyear  = rs.GetSelectedItemsValueAsString(cbl_batch);
                    string degreecode = GetSelectedItemsValueAsString(cbl_branch, 1);
                    string clgcode    = rs.GetSelectedItemsValueAsString(cbl_clgname);
                    q1  = "";
                    q1  = " select count(app_no)Enquiry,degree_code,c.Coll_acronymn from applyn a,collinfo c where a.college_code=c.college_code and ISNULL(IsEnquiry,0)=1 and ISNULL(IsConfirm,0)=0 and ISNULL(Admission_Status,0)=0 and degree_code in('" + degreecode + "') and batch_year in('" + batchyear + "') and date_applied between '" + Convert.ToString(dt.ToString("MM/dd/yyyy")) + "' and '" + Convert.ToString(dt1.ToString("MM/dd/yyyy")) + "'  and a.college_code in('" + clgcode + "') group by degree_code ,c.Coll_acronymn ";
                    q1 += " select count(app_no)Applied,degree_code,c.Coll_acronymn from applyn a,collinfo c where a.college_code=c.college_code and ISNULL(IsConfirm,0)=1 and ISNULL(Admission_Status,0)=0 and degree_code in('" + degreecode + "') and batch_year in('" + batchyear + "') and date_applied between '" + Convert.ToString(dt.ToString("MM/dd/yyyy")) + "' and '" + Convert.ToString(dt1.ToString("MM/dd/yyyy")) + "' and a.college_code in('" + clgcode + "') group by degree_code  ,c.Coll_acronymn ";
                    q1 += " select COUNT(r.app_no)Admitted,r.degree_code,c.Coll_acronymn from applyn a,Registration r,collinfo c where r.college_code=c.college_code and a.app_no=r.App_No and cc=0 and DelFlag=0 and Exam_Flag<>'debar' and r.degree_code in('" + degreecode + "') and r.batch_year in('" + batchyear + "') and r.adm_date between '" + Convert.ToString(dt.ToString("MM/dd/yyyy")) + "' and '" + Convert.ToString(dt1.ToString("MM/dd/yyyy")) + "' and r.college_code in('" + clgcode + "') group by r.degree_code,c.Coll_acronymn ";
                    //q1 = "  select count(app_no)Enquiry,degree_code from applyn where ISNULL(IsConfirm,0)=0 and ISNULL(Admission_Status,0)=0 and degree_code in('" + degreecode + "') and batch_year in('" + batchyear + "') and date_applied between '" + Convert.ToString(dt.ToString("MM/dd/yyyy")) + "' and '" + Convert.ToString(dt1.ToString("MM/dd/yyyy")) + "'  and college_code in('" + clgcode + "')  group by degree_code  ";
                    //q1 += "  select count(app_no)Applied,degree_code from applyn where ISNULL(IsConfirm,0)=1 and ISNULL(Admission_Status,0)=1 and degree_code in('" + degreecode + "') and batch_year in('" + batchyear + "') and date_applied between '" + Convert.ToString(dt.ToString("MM/dd/yyyy")) + "' and '" + Convert.ToString(dt1.ToString("MM/dd/yyyy")) + "' and college_code in('" + clgcode + "') group by degree_code  ";
                    //q1 += " select COUNT(r.app_no)Admitted,r.degree_code from applyn a,Registration r where a.app_no=r.App_No and cc=0 and DelFlag=0 and Exam_Flag<>'debar' and r.degree_code in('" + degreecode + "') and r.batch_year in('" + batchyear + "') and r.adm_date between '" + Convert.ToString(dt.ToString("MM/dd/yyyy")) + "' and '" + Convert.ToString(dt1.ToString("MM/dd/yyyy")) + "'  r.college_code in('" + clgcode + "') group by r.degree_code";
                    ds.Clear();
                    ds = d2.select_method_wo_parameter(q1, "text");
                    int r = 1; string collegename = "";
                    for (i = 0; i < cbl_branch.Items.Count; i++)
                    {
                        if (cbl_branch.Items[i].Selected == true)
                        {
                            #region branch wise Bindvalue
                            totalvalue = 0; totalval = 0;
                            if (Convert.ToString(cbl_branch.Items[i].Value.Split('$')[0]) != collegename)
                            {
                                Fpspread1.Sheets[0].RowCount++;
                                Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 0].Text            = Convert.ToString(cbl_branch.Items[i].Value.Split('$')[2]);
                                Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 0].HorizontalAlign = HorizontalAlign.Left;
                                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].Rows[Fpspread1.Sheets[0].RowCount - 1].BackColor           = Color.Bisque;
                                Fpspread1.Sheets[0].Rows[Fpspread1.Sheets[0].RowCount - 1].ForeColor           = Color.Brown;

                                collegename = Convert.ToString(cbl_branch.Items[i].Value.Split('$')[0]);
                                Fpspread1.Sheets[0].SpanModel.Add(Fpspread1.Sheets[0].RowCount - 1, 0, 1, 7);
                            }
                            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].Value.Split('$')[0]);
                            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(cbl_branch.Items[i].Text);
                            Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 2].Tag             = Convert.ToString(cbl_branch.Items[i].Value.Split('$')[1]);
                            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";
                            string headervalue = Convert.ToString(Fpspread1.Sheets[0].ColumnHeader.Cells[0, 3].Text);
                            if (headervalue.Trim().ToLower() == "enquiry")
                            {
                                ds.Tables[0].DefaultView.RowFilter = " degree_code=" + Convert.ToString(cbl_branch.Items[i].Value.Split('$')[1]);
                                DataView dv = ds.Tables[0].DefaultView;
                                if (dv.Count > 0)
                                {
                                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 3].Text = Convert.ToString(dv[0]["Enquiry"]);
                                    if (totalvalue_dic.Contains(headervalue))
                                    {
                                        string value = totalvalue_dic[headervalue].ToString();
                                        totalvalue_dic.Remove(headervalue);
                                        int total = Convert.ToInt32(value) + Convert.ToInt32(dv[0]["Enquiry"]);
                                        totalvalue_dic.Add(headervalue, total);
                                    }
                                    else
                                    {
                                        totalvalue_dic.Add(headervalue, Convert.ToInt32(dv[0]["Enquiry"]));
                                    }
                                    double.TryParse(Convert.ToString(dv[0]["Enquiry"]), out totalval);
                                    totalvalue += totalval;
                                }
                                else
                                {
                                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 3].Text = " - ";
                                }
                            }
                            headervalue = Convert.ToString(Fpspread1.Sheets[0].ColumnHeader.Cells[0, 4].Text);
                            if (headervalue.Trim().ToLower() == "applied")
                            {
                                ds.Tables[1].DefaultView.RowFilter = " degree_code=" + Convert.ToString(cbl_branch.Items[i].Value.Split('$')[1]);
                                DataView dv = ds.Tables[1].DefaultView;
                                if (dv.Count > 0)
                                {
                                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 4].Text = Convert.ToString(dv[0]["Applied"]);
                                    if (totalvalue_dic.Contains(headervalue))
                                    {
                                        string value = totalvalue_dic[headervalue].ToString();
                                        totalvalue_dic.Remove(headervalue);
                                        int total = Convert.ToInt32(value) + Convert.ToInt32(dv[0]["Applied"]);
                                        totalvalue_dic.Add(headervalue, total);
                                    }
                                    else
                                    {
                                        totalvalue_dic.Add(headervalue, Convert.ToInt32(dv[0]["Applied"]));
                                    }
                                    double.TryParse(Convert.ToString(dv[0]["Applied"]), out totalval);
                                    totalvalue += totalval;
                                }
                                else
                                {
                                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 4].Text = " - ";
                                }
                            }
                            headervalue = Convert.ToString(Fpspread1.Sheets[0].ColumnHeader.Cells[0, 5].Text);
                            if (headervalue.Trim().ToLower() == "admitted")
                            {
                                ds.Tables[2].DefaultView.RowFilter = " degree_code=" + Convert.ToString(cbl_branch.Items[i].Value.Split('$')[1]);
                                DataView dv = ds.Tables[2].DefaultView;
                                if (dv.Count > 0)
                                {
                                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 5].Text = Convert.ToString(dv[0]["Admitted"]);
                                    if (totalvalue_dic.Contains(headervalue))
                                    {
                                        string value = totalvalue_dic[headervalue].ToString();
                                        totalvalue_dic.Remove(headervalue);
                                        int total = Convert.ToInt32(value) + Convert.ToInt32(dv[0]["Admitted"]);
                                        totalvalue_dic.Add(headervalue, total);
                                    }
                                    else
                                    {
                                        totalvalue_dic.Add(headervalue, Convert.ToInt32(dv[0]["Admitted"]));
                                    }
                                    double.TryParse(Convert.ToString(dv[0]["Admitted"]), out totalval);
                                    totalvalue += totalval;
                                }
                                else
                                {
                                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 5].Text = " - ";
                                }
                            }
                            headervalue = Convert.ToString(Fpspread1.Sheets[0].ColumnHeader.Cells[0, 6].Text);
                            if (headervalue.Trim().ToLower() == "total")
                            {
                                Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 6].Text = Convert.ToString(totalvalue);
                                if (totalvalue_dic.Contains(headervalue))
                                {
                                    string value = totalvalue_dic[headervalue].ToString();
                                    totalvalue_dic.Remove(headervalue);
                                    int total = Convert.ToInt32(value) + Convert.ToInt32(totalvalue);
                                    totalvalue_dic.Add(headervalue, total);
                                }
                                else
                                {
                                    totalvalue_dic.Add(headervalue, Convert.ToInt32(totalvalue));
                                }
                            }
                            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].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.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].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].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, 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";
                            #endregion
                        }
                    }
                    Fpspread1.Sheets[0].RowCount++;
                    Fpspread1.Sheets[0].Cells[Fpspread1.Sheets[0].RowCount - 1, 2].Text            = "Grant Total";
                    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";
                    for (int k = 3; k < Fpspread1.Sheets[0].ColumnHeader.Columns.Count; k++)
                    {
                        string seattypevalue = Convert.ToString(Fpspread1.Sheets[0].ColumnHeader.Cells[0, k].Text);
                        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].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, "AdmisstionDetails_report");
        }
    }
Пример #16
0
 protected void BindQuestion()
 {
     try
     {
         if (ddl_college.Items.Count > 0 && ddl_header.Items.Count > 0 && ddl_feedback.Items.Count > 0)
         {
             string headercode = ""; cbl_question.Items.Clear(); txt_question.Text = "--Select--";
             cbl_question1.Items.Clear(); txt_question1.Text = "--Select--";
             string headercode1 = rs.GetSelectedItemsValueAsString(cbl_header1);
             headercode = Convert.ToString(ddl_header.SelectedItem.Value);
             if (headercode.Trim() != "")
             {
                 string q1 = " select FeedBackMasterPK from CO_FeedBackMaster where FeedBackName='" + ddl_feedback.SelectedItem.Value + "'";
                 ds.Clear();
                 ds = d2.select_method_wo_parameter(q1, "text");
                 string FeedBackMasterPK = GetdatasetRowstring(ds, "FeedBackMasterPK");
                 string selqry           = " select distinct Question,QuestionMasterPK from CO_QuestionMaster q, CO_FeedBackQuestions fq where q.QuestionMasterPK=fq.QuestionMasterFK and  CollegeCode='" + ddl_college.SelectedItem.Value + "' and HeaderCode in('" + headercode + "') and fq.FeedBackMasterFK in('" + FeedBackMasterPK + "') order by question";
                 selqry += " select distinct Question,QuestionMasterPK from CO_QuestionMaster where CollegeCode='" + ddl_college1.SelectedItem.Value + "' and HeaderCode in('" + headercode1 + "') order by question";
                 ds      = d2.select_method_wo_parameter(selqry, "Text");
                 cbl_question.Items.Clear();
                 txt_question.Text   = "--Select--";
                 cb_question.Checked = false;
                 if (ds.Tables[0].Rows.Count > 0)
                 {
                     cbl_question.DataSource     = ds.Tables[0];
                     cbl_question.DataTextField  = "Question";
                     cbl_question.DataValueField = "QuestionMasterPK";
                     cbl_question.DataBind();
                     if (cbl_question.Items.Count > 0)
                     {
                         for (int row = 0; row < cbl_question.Items.Count; row++)
                         {
                             cbl_question.Items[row].Selected = true;
                             cb_question.Checked = true;
                         }
                         txt_question.Text = "Question(" + cbl_question.Items.Count + ")";
                     }
                 }
                 else
                 {
                     cb_question.Checked = false;
                     txt_question.Text   = "--Select--";
                 }
                 if (ds.Tables[1].Rows.Count > 0)
                 {
                     cbl_question1.DataSource     = ds.Tables[1];
                     cbl_question1.DataTextField  = "Question";
                     cbl_question1.DataValueField = "QuestionMasterPK";
                     cbl_question1.DataBind();
                     if (cbl_question1.Items.Count > 0)
                     {
                         for (int row = 0; row < cbl_question1.Items.Count; row++)
                         {
                             cbl_question1.Items[row].Selected = true;
                             cb_question1.Checked = true;
                         }
                         txt_question1.Text = "Question(" + cbl_question1.Items.Count + ")";
                     }
                 }
                 else
                 {
                     cb_question1.Checked = false;
                     txt_question1.Text   = "--Select--";
                 }
             }
         }
     }
     catch { }
 }
    public void btn_go_Click(object sender, EventArgs e)
    {
        try
        {
            string colno        = "";
            string hostelFk     = rs.GetSelectedItemsValueAsString(cbl_hostelname);
            string sessionFk    = rs.GetSelectedItemsValueAsString(cbl_sessionname);
            string ItemFk       = rs.GetSelectedItemsValueAsString(cbl_itemname);
            string menumasterFk = rs.GetSelectedItemsValueAsString(cbl_menuname);
            if (ItemList.Count == 0)
            {
                ItemList.Add("MessName");
                ItemList.Add("SessionName");
                ItemList.Add("MenuName");
                ItemList.Add("ItemCode");
                ItemList.Add("itemname");
                ItemList.Add("RPU");
                ItemList.Add("Consumption_Date");
                ItemList.Add("qut");
                ItemList.Add("value");
                ItemList.Add("Total_Present");
                //ItemList.Add("VegCount");
                //ItemList.Add("NonVegCount");
            }

            Hashtable columnhash = new Hashtable();
            columnhash.Clear();

            int colinc = 0;
            columnhash.Add("MessName", "Mess Name");
            columnhash.Add("SessionName", "Session Name");
            columnhash.Add("MenuName", "Menu Name");
            columnhash.Add("ItemCode", "Item Code");
            columnhash.Add("itemname", "Item Name");
            columnhash.Add("RPU", "RPU");
            columnhash.Add("Consumption_Date", "Consumption Date");
            columnhash.Add("qut", "Consumption QTY");
            columnhash.Add("value", "Consumption Value");
            columnhash.Add("Total_Present", "Strength");
            columnhash.Add("VegStrength", "VegCount");
            columnhash.Add("NonvegStrength", "NonVegCount");

            string getday   = "";
            string gettoday = "";
            string from     = "";
            string to       = "";
            from = Convert.ToString(txt_fromdate.Text);
            string[] splitdate = from.Split('-');
            splitdate = splitdate[0].Split('/');
            DateTime dt = new DateTime();
            if (splitdate.Length > 0)
            {
                dt = Convert.ToDateTime(splitdate[1] + "/" + splitdate[0] + "/" + splitdate[2]);
            }
            getday = dt.ToString("MM/dd/yyyy");

            to = Convert.ToString(txt_todate.Text);
            string[] splitdate1 = to.Split('-');
            splitdate1 = splitdate1[0].Split('/');
            DateTime dt1 = new DateTime();
            if (splitdate1.Length > 0)
            {
                dt1 = Convert.ToDateTime(splitdate1[1] + "/" + splitdate1[0] + "/" + splitdate1[2]);
            }
            gettoday = dt1.ToString("MM/dd/yyyy");
            if (hostelFk != "" && ItemFk != "" && sessionFk.Trim() != "" && menumasterFk.Trim() != "")
            {
                string selectquery = "  select me.MessName,s.SessionName,i.ItemCode,i.itemname,MenuName,RPU,CONVERT(varchar(10), DailyConsDate,103) as Consumption_Date,SUM( ConsumptionQty)qut,SUM( ConsumptionQty*RPU)value,dm.Total_Present,dm.VegStrength,dm.NonvegStrength from HM_MenuMaster Ma ,HT_DailyConsumptionMaster dm ,HT_DailyConsumptionDetail dd,HM_SessionMaster s,IM_ItemMaster i,HM_MessMaster me where dd.DailyConsumptionMasterFK =dm.DailyConsumptionMasterPK and s.SessionMasterPK=dm.SessionFK and i.ItemPK=dd.ItemFK and dm.SessionFK=s.SessionMasterPK and dm.MessMasterFK=me.MessMasterPK and dm.MessMasterFK in ('" + hostelFk + "') and s.SessionMasterPK in ('" + sessionFk + "') and  dd.ItemFK in ('" + ItemFk + "') and DailyConsDate between  '" + dt.ToString("MM/dd/yyyy") + "' and '" + dt1.ToString("MM/dd/yyyy") + "' and dm.MenumasterFK in('" + menumasterFk + "') and dm.MenumasterFK=ma.MenuMasterPK  group by DailyConsDate , dd.ItemFK , s.SessionName,MenuName, i.itemname, me.MessName ,RPU,dm.Total_Present,ItemCode,dm.VegStrength,dm.NonvegStrength order by DailyConsDate ";
                ds.Clear();
                ds = d2.select_method_wo_parameter(selectquery, "Text");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    pcolumnorder.Visible = true;
                    Fpspread1.Sheets[0].RowHeader.Visible = false;
                    //Fpspread1.Sheets[0].ColumnCount = 11;
                    Fpspread1.CommandBar.Visible      = false;
                    Fpspread1.Sheets[0].RowCount      = 0;
                    Fpspread1.SheetCorner.ColumnCount = 0;

                    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.RowCount = 1;
                    Fpspread1.Sheets[0].RowHeader.Visible     = false;
                    Fpspread1.Sheets[0].ColumnCount           = ItemList.Count + 1;
                    Fpspread1.Sheets[0].RowCount     = ds.Tables[0].Rows.Count;
                    Fpspread1.Sheets[0].AutoPostBack = true;

                    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.Sheets[0].Columns[0].HorizontalAlign = HorizontalAlign.Center;
                    FarPoint.Web.Spread.TextCellType txt = new FarPoint.Web.Spread.TextCellType();
                    for (int j = 0; j < ds.Tables[0].Columns.Count; j++)
                    {
                        colno = Convert.ToString(ds.Tables[0].Columns[j]);
                        if (ItemList.Contains(Convert.ToString(colno)))
                        {
                            int index = ItemList.IndexOf(Convert.ToString(colno));
                            Fpspread1.Sheets[0].ColumnHeader.Cells[0, index + 1].Text            = Convert.ToString(columnhash[colno]);
                            Fpspread1.Sheets[0].ColumnHeader.Cells[0, index + 1].Font.Bold       = true;
                            Fpspread1.Sheets[0].ColumnHeader.Cells[0, index + 1].Font.Name       = "Book Antiqua";
                            Fpspread1.Sheets[0].ColumnHeader.Cells[0, index + 1].Font.Size       = FontUnit.Medium;
                            Fpspread1.Sheets[0].ColumnHeader.Cells[0, index + 1].HorizontalAlign = HorizontalAlign.Center;
                        }
                    }
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        Fpspread1.Sheets[0].Cells[i, 0].Text            = Convert.ToString(i + 1);
                        Fpspread1.Sheets[0].Cells[i, 0].HorizontalAlign = HorizontalAlign.Center;

                        for (int j = 0; j < ds.Tables[0].Columns.Count; j++)
                        {
                            if (ItemList.Contains(Convert.ToString(ds.Tables[0].Columns[j].ToString())))
                            {
                                int index = ItemList.IndexOf(Convert.ToString(ds.Tables[0].Columns[j].ToString()));
                                Fpspread1.Sheets[0].Columns[index + 1].Width      = 150;
                                Fpspread1.Sheets[0].Columns[index + 1].Locked     = true;
                                Fpspread1.Sheets[0].Cells[i, index + 1].CellType  = txt;
                                Fpspread1.Sheets[0].Cells[i, index + 1].Text      = ds.Tables[0].Rows[i][j].ToString();
                                Fpspread1.Sheets[0].Cells[i, index + 1].Font.Name = "Book Antiqua";
                                Fpspread1.Sheets[0].Cells[i, index + 1].Font.Size = FontUnit.Medium;
                                if (ds.Tables[0].Columns[j].ToString() == "qut")
                                {
                                    Fpspread1.Sheets[0].Cells[i, index + 1].HorizontalAlign = HorizontalAlign.Center;
                                }
                                if (ds.Tables[0].Columns[j].ToString() == "value")
                                {
                                    Fpspread1.Sheets[0].Cells[i, index + 1].HorizontalAlign = HorizontalAlign.Right;
                                }
                                if (ds.Tables[0].Columns[j].ToString() == "Total_Present" || ds.Tables[0].Columns[j].ToString() == "VegStrength" || ds.Tables[0].Columns[j].ToString() == "NonvegStrength")
                                {
                                    Fpspread1.Sheets[0].Cells[i, index + 1].HorizontalAlign = HorizontalAlign.Right;
                                }
                            }
                        }
                    }
                    rptprint.Visible      = true;
                    Fpspread1.Visible     = true;
                    div1.Visible          = true;
                    lbl_error.Visible     = false;
                    pheaderfilter.Visible = true;
                    pcolumnorder.Visible  = true;
                    Fpspread1.Sheets[0].SetColumnMerge(1, FarPoint.Web.Spread.Model.MergePolicy.Always);
                    Fpspread1.Sheets[0].SetColumnMerge(2, FarPoint.Web.Spread.Model.MergePolicy.Always);
                    Fpspread1.Sheets[0].SetColumnMerge(3, FarPoint.Web.Spread.Model.MergePolicy.Always);
                    Fpspread1.Sheets[0].SetColumnMerge(4, FarPoint.Web.Spread.Model.MergePolicy.Always);
                    Fpspread1.Sheets[0].SetColumnMerge(5, FarPoint.Web.Spread.Model.MergePolicy.Always);
                    Fpspread1.Sheets[0].PageSize = Fpspread1.Sheets[0].RowCount;
                }
                else
                {
                    rptprint.Visible = false;
                    // imgdiv2.Visible = true;
                    //lbl_alert.Text = "No records found";
                    lbl_error.Text        = "No records found";
                    pheaderfilter.Visible = false;
                    pcolumnorder.Visible  = false;
                    div1.Visible          = false;
                    Fpspread1.Visible     = false;
                }
            }
            else
            {
                rptprint.Visible = false;
                // imgdiv2.Visible = true;
                //lbl_alert.Text = "No records found";
                lbl_error.Visible     = true;
                lbl_error.Text        = "Please Select Any One Record";
                pheaderfilter.Visible = false;
                pcolumnorder.Visible  = false;
                div1.Visible          = false;
                Fpspread1.Visible     = false;
            }
        }
        catch (Exception ex)
        {
        }
    }
Пример #18
0
    protected void btngo_Click(object sender, EventArgs e)
    {
        try
        {
            //divfpspread.Visible = true;
            btnxl.Visible              = true;
            lblrptname.Visible         = true;
            txtexcelname.Visible       = true;
            Printcontrol.Visible       = false;
            btnprintmaster.Visible     = true;
            pnlContent1.Visible        = true;
            Fpspread.Sheets[0].Visible = true;
            string valCollege = string.Empty;
            lblnorec.Visible = false;
            string sumpart = string.Empty;
            int    value   = 0;
            int    sno     = 0;
            valCollege = rs.GetSelectedItemsValueAsString(cblCollege);
            if (valCollege != "")
            {
                if (txtfromDate.Text != "" && txttoDate.Text != "")
                {
                    frdate = txtfromDate.Text;
                    todate = txttoDate.Text;
                    string   dt     = frdate;
                    string[] dsplit = dt.Split(new Char[] { '-' });
                    frdate               = dsplit[2].ToString() + "-" + dsplit[1].ToString() + "-" + dsplit[0].ToString();
                    demfcal              = int.Parse(dsplit[2].ToString());
                    demfcal              = demfcal * 12;
                    cal_from_date        = demfcal + int.Parse(dsplit[1].ToString());
                    cal_from_attdate_tmp = demfcal + int.Parse(dsplit[1].ToString());

                    monthcal           = cal_from_date.ToString();
                    dt                 = todate;
                    dsplit             = dt.Split(new Char[] { '-' });
                    spltodate          = dsplit[1].ToString() + "/" + dsplit[0].ToString() + "/" + dsplit[2].ToString();
                    todate             = dsplit[2].ToString() + "-" + dsplit[1].ToString() + "-" + dsplit[0].ToString();
                    demtcal            = int.Parse(dsplit[2].ToString());
                    demtcal            = demtcal * 12;
                    cal_to_date        = demtcal + int.Parse(dsplit[1].ToString());
                    cal_to_attdate_tmp = demtcal + int.Parse(dsplit[1].ToString());
                    per_from_attdate   = Convert.ToDateTime(frdate);
                    per_to_attdate     = Convert.ToDateTime(todate);
                    if (per_from_attdate <= per_to_attdate)
                    {
                        #region colbinding
                        Fpspread.Sheets[0].AutoPostBack         = true;
                        Fpspread.Sheets[0].RowHeader.Visible    = false;
                        Fpspread.Sheets[0].ColumnHeader.Visible = true;
                        MyStyle.Font.Size       = FontUnit.Medium;
                        MyStyle.Font.Name       = "Book Antiqua";
                        MyStyle.Font.Bold       = true;
                        MyStyle.HorizontalAlign = HorizontalAlign.Center;
                        MyStyle.ForeColor       = Color.White;
                        MyStyle.BackColor       = ColorTranslator.FromHtml("#0CA6CA");
                        Fpspread.Sheets[0].ColumnHeader.DefaultStyle = MyStyle;
                        Fpspread.CommandBar.Visible    = false;
                        Fpspread.Sheets[0].ColumnCount = 5;
                        Fpspread.Sheets[0].RowCount    = 0;
                        Fpspread.BorderWidth           = 2;
                        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].Font.Name       = "Book Antiqua";
                        Fpspread.Sheets[0].ColumnHeader.Cells[0, 0].Font.Size       = FontUnit.Medium;
                        Fpspread.Sheets[0].ColumnHeader.Cells[0, 0].HorizontalAlign = HorizontalAlign.Center;
                        Fpspread.Sheets[0].ColumnHeader.Cells[0, 1].Text            = "College Name";
                        Fpspread.Sheets[0].ColumnHeader.Cells[0, 1].Font.Bold       = true;
                        Fpspread.Sheets[0].ColumnHeader.Cells[0, 1].Font.Name       = "Book Antiqua";
                        Fpspread.Sheets[0].ColumnHeader.Cells[0, 1].Font.Size       = FontUnit.Medium;
                        Fpspread.Sheets[0].ColumnHeader.Cells[0, 1].HorizontalAlign = HorizontalAlign.Center;
                        Fpspread.Sheets[0].ColumnHeader.Cells[0, 2].Text            = "Total Strenth";
                        Fpspread.Sheets[0].ColumnHeader.Cells[0, 2].Font.Bold       = true;
                        Fpspread.Sheets[0].ColumnHeader.Cells[0, 2].Font.Name       = "Book Antiqua";
                        Fpspread.Sheets[0].ColumnHeader.Cells[0, 2].Font.Size       = FontUnit.Medium;
                        Fpspread.Sheets[0].ColumnHeader.Cells[0, 2].HorizontalAlign = HorizontalAlign.Center;
                        Fpspread.Sheets[0].ColumnHeader.Cells[0, 3].Text            = "Present %";
                        Fpspread.Sheets[0].ColumnHeader.Cells[0, 3].Font.Bold       = true;
                        Fpspread.Sheets[0].ColumnHeader.Cells[0, 3].Font.Name       = "Book Antiqua";
                        Fpspread.Sheets[0].ColumnHeader.Cells[0, 3].Font.Size       = FontUnit.Medium;
                        Fpspread.Sheets[0].ColumnHeader.Cells[0, 3].HorizontalAlign = HorizontalAlign.Center;
                        Fpspread.Sheets[0].ColumnHeader.Cells[0, 4].Text            = "Absent %";
                        Fpspread.Columns[4].Width = 25;
                        Fpspread.Sheets[0].ColumnHeader.Cells[0, 4].Font.Bold       = true;
                        Fpspread.Sheets[0].ColumnHeader.Cells[0, 4].Font.Name       = "Book Antiqua";
                        Fpspread.Sheets[0].ColumnHeader.Cells[0, 4].Font.Size       = FontUnit.Medium;
                        Fpspread.Sheets[0].ColumnHeader.Cells[0, 4].HorizontalAlign = HorizontalAlign.Center;
                        #endregion
                        //  // string sql = "select * from Registration r,attendance a where r.Roll_No=a.roll_no and r.App_No=a.Att_App_no and a.Att_CollegeCode= r.college_code and r.CC='0' and r.DelFlag='0' and r.Exam_Flag <>'debar' and a.month_year between '" + cal_from_attdate_tmp + "' and '" + cal_to_attdate_tmp + "' and r.college_code in('" + valCollege + "')";
                        string sql = "select * from Registration r,attendance a where r.Roll_No=a.roll_no and r.App_No=a.Att_App_no and a.Att_CollegeCode= r.college_code and r.CC='0' and r.DelFlag='0' and r.Exam_Flag <>'debar' and a.month_year between '" + cal_from_attdate_tmp + "' and '" + cal_to_attdate_tmp + "' and r.college_code in('" + valCollege + "') order by r.degree_code,r.Roll_No";

                        ds = da.select_method_wo_parameter(sql, "text");
                        int fprow = 0;
                        for (int clg = 0; clg < cblCollege.Items.Count; clg++)
                        {
                            if (cblCollege.Items[clg].Selected == true)
                            {
                                double present        = 0;
                                double absent         = 0;
                                int    hour           = 0;
                                double tolhour_perclg = 0;
                                int    cunstu         = 0;
                                //int tolhour_perclg = 0;
                                Fpspread.Sheets[0].RowCount++;
                                sno++;
                                string stucon = da.GetFunction("select count(distinct r.app_no) from Registration r where r.CC='0' and r.DelFlag='0' and r.Exam_Flag <>'debar' and r.college_code='" + cblCollege.Items[clg].Value + "' and Adm_Date<='" + spltodate + "'");


                                //string stucon = da.GetFunction("select count(distinct r.roll_no) from Registration r,attendance a where r.Roll_No=a.roll_no and r.App_No=a.Att_App_no and a.Att_CollegeCode= r.college_code and r.CC='0' and r.DelFlag='0' and r.Exam_Flag <>'debar' and a.month_year between '" + cal_from_attdate_tmp + "' and '" + cal_to_attdate_tmp + "' and r.college_code in('" + cblCollege.Items[clg].Value + "')");
                                //ds = da.select_method("bind_branch", has, "sp");
                                //string gendegree = "select distinct r.degree_code from Registration r,attendance a where r.Roll_No=a.roll_no and r.App_No=a.Att_App_no and a.Att_CollegeCode= r.college_code  and r.CC='0' and r.DelFlag='0' and r.Exam_Flag <>'debar' and a.month_year between '" + cal_from_attdate_tmp + "'  and '" + cal_to_attdate_tmp + "' and  r.college_code='" + cblCollege.Items[clg].Value +"' order by r.degree_code";
                                string valcolle_code = Convert.ToString(cblCollege.Items[clg].Value).Trim();
                                int    valcoll_code;
                                int.TryParse(valcolle_code, out valcoll_code);
                                has.Clear();
                                has.Add("valcoll_code", valcoll_code);
                                has.Add("cal_from_attdate_tmp", cal_from_attdate_tmp);
                                has.Add("cal_to_attdate_tmp", cal_to_attdate_tmp);
                                DataSet degreegener = da.select_method("attoverallclg_coll", has, "sp");
                                //DataSet degreegener = da.select_method_wo_parameter(gendegree, "text");
                                for (int degrow = 0; degrow < degreegener.Tables[0].Rows.Count; degrow++)
                                {
                                    int    tolhour_perdeg = 0;
                                    string hrs            = da.GetFunction("select No_of_hrs_per_day from PeriodAttndSchedule where degree_code='" + degreegener.Tables[0].Rows[degrow]["degree_code"] + "'");
                                    int.TryParse(hrs, out hour);
                                    //string stud =da.GetFunction(" select count(distinct r.roll_no) from Registration r,attendance a where r.Roll_No=a.roll_no and r.App_No=a.Att_App_no and a.Att_CollegeCode= r.college_code  and r.CC='0' and r.DelFlag='0' and r.Exam_Flag <>'debar' and a.month_year between '" + cal_from_attdate_tmp + "'  and '" + cal_to_attdate_tmp + "'and r.degree_code='" + degreegener.Tables[0].Rows[degrow]["degree_code"] + "' and  r.college_code='" + cblCollege.Items[clg].Value + "'");

                                    ds.Tables[0].DefaultView.RowFilter = "college_code='" + cblCollege.Items[clg].Value + "' and degree_code='" + degreegener.Tables[0].Rows[degrow]["degree_code"] + "'";
                                    DataView clgfilter = ds.Tables[0].DefaultView;
                                    for (DateTime dtt = per_from_attdate; dtt <= per_to_attdate; dtt = dtt.AddDays(1))
                                    {
                                        //for (int degrow = 0; degrow < clgfilter.Count; degrow++)
                                        // {

                                        //ds.Tables[0].DefaultView.RowFilter = "month_year='" + cal_from_date + "'";

                                        for (int i = 1; i <= hour; i++)
                                        {
                                            for (int sturow = 0; sturow < clgfilter.Count; sturow++)
                                            {
                                                date = "d" + dtt.Day.ToString("") + "d" + i.ToString();
                                                string maxval = Convert.ToString(clgfilter[sturow][date]).Trim();
                                                if (maxval != "" && maxval != "0" && maxval != "NULL" && maxval != "Null" && maxval != "null" && maxval != "H" && maxval != "NJ" && maxval != "Null")
                                                {
                                                    int.TryParse(maxval, out value);

                                                    string valqu = da.GetFunction("select CalcFlag  from AttMasterSetting where collegecode=13 and LeaveCode='" + value + "'  group by CalcFlag");
                                                    int.TryParse(valqu, out value);

                                                    if (value == 0)
                                                    {
                                                        present = present + 1;
                                                    }
                                                    else
                                                    {
                                                        absent = absent + 1;
                                                    }
                                                }
                                                else
                                                {
                                                }
                                            }
                                        }
                                        tolhour_perdeg += hour;
                                    }
                                    //int.TryParse(stud, out cunstu);
                                    //tolhour_perdeg *= cunstu;
                                    //tolhour_perclg += tolhour_perdeg;
                                    tolhour_perclg = present + absent;
                                }

                                if (present != 0)
                                {
                                    present = (present / tolhour_perclg);
                                    present = Math.Round(present, 3);
                                    present = present * 100;
                                    sumpart = String.Format("{0:0.00}", present);
                                }
                                if (absent != 0)
                                {
                                    absent  = (absent / tolhour_perclg);
                                    absent  = Math.Round(absent, 3);
                                    absent  = absent * 100;
                                    sumpart = String.Format("{0:0.00}", absent);
                                }
                                Fpspread.Sheets[0].Cells[fprow, 0].Text = sno.ToString();
                                Fpspread.Columns[0].Width = 10;
                                Fpspread.Sheets[0].Cells[fprow, 0].Font.Bold       = true;
                                Fpspread.Sheets[0].Cells[fprow, 0].Font.Name       = "Book Antiqua";
                                Fpspread.Sheets[0].Cells[fprow, 0].Font.Size       = FontUnit.Medium;
                                Fpspread.Sheets[0].Cells[fprow, 0].HorizontalAlign = HorizontalAlign.Center;
                                Fpspread.Sheets[0].Cells[fprow, 1].Text            = cblCollege.Items[clg].ToString();
                                Fpspread.Columns[1].Width = 100;
                                Fpspread.Sheets[0].Cells[fprow, 1].Font.Bold       = true;
                                Fpspread.Sheets[0].Cells[fprow, 1].Font.Name       = "Book Antiqua";
                                Fpspread.Sheets[0].Cells[fprow, 1].Font.Size       = FontUnit.Medium;
                                Fpspread.Sheets[0].Cells[fprow, 1].HorizontalAlign = HorizontalAlign.Left;
                                Fpspread.Sheets[0].Cells[fprow, 2].Text            = stucon.ToString();
                                Fpspread.Columns[2].Width = 25;
                                Fpspread.Sheets[0].Cells[fprow, 2].Font.Bold       = true;
                                Fpspread.Sheets[0].Cells[fprow, 2].Font.Name       = "Book Antiqua";
                                Fpspread.Sheets[0].Cells[fprow, 2].Font.Size       = FontUnit.Medium;
                                Fpspread.Sheets[0].Cells[fprow, 2].HorizontalAlign = HorizontalAlign.Center;
                                Fpspread.Sheets[0].Cells[fprow, 3].Text            = present.ToString();
                                Fpspread.Columns[3].Width = 25;
                                Fpspread.Sheets[0].Cells[fprow, 3].Font.Bold       = true;
                                Fpspread.Sheets[0].Cells[fprow, 3].Font.Name       = "Book Antiqua";
                                Fpspread.Sheets[0].Cells[fprow, 3].Font.Size       = FontUnit.Medium;
                                Fpspread.Sheets[0].Cells[fprow, 3].HorizontalAlign = HorizontalAlign.Center;
                                Fpspread.Sheets[0].Cells[fprow, 4].Text            = absent.ToString();
                                Fpspread.Sheets[0].Cells[fprow, 4].Font.Bold       = true;
                                Fpspread.Sheets[0].Cells[fprow, 4].Font.Name       = "Book Antiqua";
                                Fpspread.Sheets[0].Cells[fprow, 4].Font.Size       = FontUnit.Medium;
                                Fpspread.Sheets[0].Cells[fprow, 4].HorizontalAlign = HorizontalAlign.Center;
                                Fpspread.Sheets[0].PageSize = Fpspread.Sheets[0].RowCount;
                                Fpspread.Width  = 900;
                                Fpspread.Height = 700;
                                Fpspread.SaveChanges();
                                fprow++;
                            }
                        }
                    }
                    else
                    {
                        Fpspread.Visible       = false;
                        btnxl.Visible          = false;
                        lblrptname.Visible     = false;
                        txtexcelname.Visible   = false;
                        Printcontrol.Visible   = false;
                        btnprintmaster.Visible = false;
                        lblnorec.Visible       = true;
                        lblnorec.Text          = "Please select the To date  is greater then From date";
                    }
                }
                else
                {
                    Fpspread.Visible       = false;
                    btnxl.Visible          = false;
                    lblrptname.Visible     = false;
                    txtexcelname.Visible   = false;
                    Printcontrol.Visible   = false;
                    btnprintmaster.Visible = false;
                    lblnorec.Visible       = true;
                    lblnorec.Text          = "Please select the From date and To date";
                }
            }
            else
            {
                btnxl.Visible          = false;
                lblrptname.Visible     = false;
                txtexcelname.Visible   = false;
                Printcontrol.Visible   = false;
                btnprintmaster.Visible = false;
                Printcontrol.Visible   = false;
                Fpspread.Visible       = false;
                lblnorec.Visible       = true;
                lblnorec.Text          = "Please select the College";
            }
        }
        catch (Exception ex)
        {
            da.sendErrorMail(ex, collegeCode, "OverallcollegeAttendancepercentage");
        }
    }
    protected void btngo_click(object sender, EventArgs e)
    {
        try
        {
            // btnresetpriority_click(sender, e);
            string degreecode  = rs.GetSelectedItemsValueAsString(cbl_degree);
            string collegecode = Convert.ToString(ddlcolhouse.SelectedItem.Value);
            if (!string.IsNullOrEmpty(degreecode) && ddlcolhouse.Items.Count > 0)
            {
                string selectquery = "select Degree_Code,isnull(c.type,'')+'-'+c.Course_Name+'-'+dt.Dept_Name as Dept_Name,Dept_Priority,Acronym from Degree d,Department dt,course c where d.Dept_Code=dt.Dept_Code and c.Course_Id =d.Course_Id and d.college_code in ('" + collegecode + "') and d.Degree_Code in('" + degreecode + "') order by ISNULL(c.Priority,0)";
                ds.Clear();
                ds = d2.select_method_wo_parameter(selectquery, "Text");
                if (ds.Tables.Count > 0)
                {
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        Fpspreadpophouse.Sheets[0].RowCount              = 0;
                        Fpspreadpophouse.Sheets[0].ColumnCount           = 0;
                        Fpspreadpophouse.CommandBar.Visible              = false;
                        Fpspreadpophouse.Sheets[0].AutoPostBack          = false;
                        Fpspreadpophouse.Sheets[0].ColumnHeader.RowCount = 1;
                        Fpspreadpophouse.Sheets[0].RowHeader.Visible     = false;
                        Fpspreadpophouse.Sheets[0].ColumnCount           = 5;

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


                        FarPoint.Web.Spread.StyleInfo darkstyle = new FarPoint.Web.Spread.StyleInfo();
                        darkstyle.BackColor          = ColorTranslator.FromHtml("#0CA6CA");
                        darkstyle.Font.Name          = "Book Antiqua";
                        darkstyle.Font.Size          = FontUnit.Medium;
                        darkstyle.Font.Bold          = true;
                        darkstyle.Border.BorderSize  = 1;
                        darkstyle.HorizontalAlign    = HorizontalAlign.Center;
                        darkstyle.VerticalAlign      = VerticalAlign.Middle;
                        darkstyle.Border.BorderColor = System.Drawing.Color.Transparent;
                        Fpspreadpophouse.ActiveSheetView.ColumnHeader.DefaultStyle = darkstyle;

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

                        Fpspreadpophouse.Sheets[0].ColumnHeader.Cells[0, 1].Text            = "Degree";
                        Fpspreadpophouse.Sheets[0].ColumnHeader.Cells[0, 1].Font.Bold       = true;
                        Fpspreadpophouse.Sheets[0].ColumnHeader.Cells[0, 1].Font.Name       = "Book Antiqua";
                        Fpspreadpophouse.Sheets[0].ColumnHeader.Cells[0, 1].Font.Size       = FontUnit.Medium;
                        Fpspreadpophouse.Sheets[0].ColumnHeader.Cells[0, 1].HorizontalAlign = HorizontalAlign.Center;
                        Fpspreadpophouse.Sheets[0].ColumnHeader.Columns[1].Locked           = true;
                        Fpspreadpophouse.Columns[1].Width = 400;

                        Fpspreadpophouse.Sheets[0].ColumnHeader.Cells[0, 2].Text            = "Degree Acronym";
                        Fpspreadpophouse.Sheets[0].ColumnHeader.Cells[0, 2].Font.Bold       = true;
                        Fpspreadpophouse.Sheets[0].ColumnHeader.Cells[0, 2].Font.Name       = "Book Antiqua";
                        Fpspreadpophouse.Sheets[0].ColumnHeader.Cells[0, 2].Font.Size       = FontUnit.Medium;
                        Fpspreadpophouse.Sheets[0].ColumnHeader.Cells[0, 2].HorizontalAlign = HorizontalAlign.Center;
                        Fpspreadpophouse.Sheets[0].ColumnHeader.Columns[2].Locked           = true;
                        Fpspreadpophouse.Columns[2].Width = 150;

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

                        Fpspreadpophouse.Sheets[0].ColumnHeader.Cells[0, 4].Text            = "Degree Priority";
                        Fpspreadpophouse.Sheets[0].ColumnHeader.Cells[0, 4].Font.Bold       = true;
                        Fpspreadpophouse.Sheets[0].ColumnHeader.Cells[0, 4].Font.Name       = "Book Antiqua";
                        Fpspreadpophouse.Sheets[0].ColumnHeader.Cells[0, 4].Font.Size       = FontUnit.Medium;
                        Fpspreadpophouse.Sheets[0].ColumnHeader.Cells[0, 4].HorizontalAlign = HorizontalAlign.Center;
                        Fpspreadpophouse.Sheets[0].ColumnHeader.Columns[4].Locked           = true;
                        Fpspreadpophouse.Columns[4].Width = 85;

                        for (int row = 0; row < ds.Tables[0].Rows.Count; row++)
                        {
                            Fpspreadpophouse.Sheets[0].RowCount++;
                            Fpspreadpophouse.Sheets[0].Cells[Fpspreadpophouse.Sheets[0].RowCount - 1, 0].Text            = Convert.ToString(row + 1);
                            Fpspreadpophouse.Sheets[0].Cells[Fpspreadpophouse.Sheets[0].RowCount - 1, 0].HorizontalAlign = HorizontalAlign.Center;
                            Fpspreadpophouse.Sheets[0].Cells[Fpspreadpophouse.Sheets[0].RowCount - 1, 1].Text            = Convert.ToString(ds.Tables[0].Rows[row]["Dept_Name"]);
                            Fpspreadpophouse.Sheets[0].Cells[Fpspreadpophouse.Sheets[0].RowCount - 1, 1].Tag             = Convert.ToString(ds.Tables[0].Rows[row]["Degree_Code"]);
                            Fpspreadpophouse.Sheets[0].Cells[Fpspreadpophouse.Sheets[0].RowCount - 1, 1].HorizontalAlign = HorizontalAlign.Left;
                            Fpspreadpophouse.Sheets[0].Cells[Fpspreadpophouse.Sheets[0].RowCount - 1, 2].Text            = Convert.ToString(ds.Tables[0].Rows[row]["Acronym"]);
                            Fpspreadpophouse.Sheets[0].Cells[Fpspreadpophouse.Sheets[0].RowCount - 1, 2].HorizontalAlign = HorizontalAlign.Left;
                            Fpspreadpophouse.Sheets[0].Cells[Fpspreadpophouse.Sheets[0].RowCount - 1, 3].CellType        = cbhousepriority;
                            if (Convert.ToString(ds.Tables[0].Rows[row]["Dept_Priority"]).Trim() != "" && Convert.ToString(ds.Tables[0].Rows[row]["Dept_Priority"]).Trim() != "0")
                            {
                                Fpspreadpophouse.Sheets[0].Cells[Fpspreadpophouse.Sheets[0].RowCount - 1, 3].Value  = 1;
                                Fpspreadpophouse.Sheets[0].Cells[Fpspreadpophouse.Sheets[0].RowCount - 1, 3].Locked = true;
                            }
                            else
                            {
                                Fpspreadpophouse.Sheets[0].Cells[Fpspreadpophouse.Sheets[0].RowCount - 1, 3].Value  = 0;
                                Fpspreadpophouse.Sheets[0].Cells[Fpspreadpophouse.Sheets[0].RowCount - 1, 3].Locked = false;
                            }
                            Fpspreadpophouse.Sheets[0].Cells[Fpspreadpophouse.Sheets[0].RowCount - 1, 3].HorizontalAlign = HorizontalAlign.Center;
                            Fpspreadpophouse.Sheets[0].Cells[Fpspreadpophouse.Sheets[0].RowCount - 1, 4].Text            = (Convert.ToString(ds.Tables[0].Rows[row]["Dept_Priority"]) == "0") ? "" : Convert.ToString(ds.Tables[0].Rows[row]["Dept_Priority"]);
                            Fpspreadpophouse.Sheets[0].Cells[Fpspreadpophouse.Sheets[0].RowCount - 1, 4].HorizontalAlign = HorizontalAlign.Center;
                        }
                        spreadDiv.Visible = true;
                        Fpspreadpophouse.Sheets[0].PageSize = Fpspreadpophouse.Sheets[0].RowCount;
                    }
                    else
                    {
                        spreadDiv.Visible = false;
                    }
                }
                else
                {
                    spreadDiv.Visible = false;
                }
                Fpspreadpophouse.SaveChanges();
            }
            else
            {
                spreadDiv.Visible = false;
                alertpop.Visible  = true;
                lbl_alert.Visible = true;
                lbl_alert.Text    = "Please Select All Fields";
            }
        }
        catch { }
    }
    public void Gofuncation()
    {
        try
        {
            string   Branch   = Rs.GetSelectedItemsValueAsString(cbl_branch);
            string   batch    = Convert.ToString(ddl_batch.SelectedItem.Text);
            string   college  = Convert.ToString(ddlcollege.SelectedValue);
            string[] fromDate = txtFromDate.Text.Split('/');
            string[] toDate   = txtToDate.Text.Split('/');

            string fromDt   = fromDate[1] + "/" + fromDate[0] + "/" + fromDate[2];
            string toDt     = toDate[1] + "/" + toDate[0] + "/" + toDate[2];
            string Stream   = string.Empty;
            string Category = string.Empty;
            if (ddlStream.SelectedItem.Text != "All")
            {
                Stream = ddlStream.SelectedValue;
            }
            if (ddlSession.SelectedItem.Text != "All")
            {
                Category = ddlSession.SelectedValue;
            }
            DataTable data   = new DataTable();
            DataView  Dsview = new DataView();
            DataView  DvRank = new DataView();
            string    Query  = "select r.app_no,r.Roll_Admit,r.Stud_Name,CONVERT(varchar(10),r.Adm_Date,103) as AdmitDate,(select Mastervalue from CO_MasterValues where MasterCode=a.quota) as Categroy,a.quota,a.StreamAdmission,(select TextVal from TextValTable where TextCode= a.StreamAdmission) as Stream,r.degree_code,st.HSCMarkSec,st.CombinedScore,st.CombinedScoreSII,enrollment_card_date,(c.Course_Name +''+dt.Dept_Name) as Departmet from applyn a,Registration r,ST_Student_Mark_Detail st ,Degree d,Department dt,Course c where d.Degree_Code =r.degree_code and d.Dept_Code =dt.Dept_Code and c.Course_Id =d.Course_Id and a.app_no =r.App_No and a.app_no =st.ST_AppNo and r.App_No =st.ST_AppNo and CC=0 and DelFlag =0 and Exam_Flag <>'Debar' and r.college_code ='" + college + "' and r.Batch_Year ='" + batch + "' and r.degree_code in ('" + Branch + "') and Adm_Date between '" + fromDt + "' and '" + toDt + "' ";
            if (Stream.Trim() != "")
            {
                Query += " and a.StreamAdmission ='" + Stream + "'";
            }
            if (Category.Trim() != "")
            {
                Query += " and a.quota ='" + Category + "'";
            }
            Query += "  select ST_Rank,ST_RankCriteria,ST_Stream,ST_AppNo from ST_RankTable St,Registration r where st.ST_AppNo =r.App_No  and r.degree_code in ('" + Branch + "') and r.college_code ='" + college + "' and r.Batch_Year ='" + batch + "'";
            if (Stream.Trim() != "")
            {
                Query += " and ST_Stream ='" + Stream + "'";
            }
            if (Category.Trim() != "")
            {
                Query += " and ST_RankCriteria ='" + Category + "'";
            }
            ds.Clear();
            ds = d2.select_method_wo_parameter(Query, "Text");
            if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                int SNo = 0;
                FpSpread1.Sheets[0].ColumnCount           = 0;
                FpSpread1.Sheets[0].RowCount              = 0;
                FpSpread1.Sheets[0].RowHeader.Visible     = false;
                FpSpread1.CommandBar.Visible              = false;
                FpSpread1.Sheets[0].ColumnHeader.RowCount = 1;


                FpSpread1.Sheets[0].ColumnCount++;
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, FpSpread1.Sheets[0].ColumnCount - 1].Text      = "S.No";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, FpSpread1.Sheets[0].ColumnCount - 1].Font.Bold = true;
                FpSpread1.Columns[FpSpread1.Sheets[0].ColumnCount - 1].Width = 25;
                FpSpread1.Sheets[0].ColumnCount++;
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, FpSpread1.Sheets[0].ColumnCount - 1].Text      = "Admission / Application No";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, FpSpread1.Sheets[0].ColumnCount - 1].Font.Bold = true;

                FpSpread1.Sheets[0].ColumnCount++;
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, FpSpread1.Sheets[0].ColumnCount - 1].Text      = "Student Name";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, FpSpread1.Sheets[0].ColumnCount - 1].Font.Bold = true;

                FpSpread1.Sheets[0].ColumnCount++;
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, FpSpread1.Sheets[0].ColumnCount - 1].Text      = "Date of Admit";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, FpSpread1.Sheets[0].ColumnCount - 1].Font.Bold = true;

                FpSpread1.Sheets[0].ColumnCount++;
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, FpSpread1.Sheets[0].ColumnCount - 1].Text      = "Combined Score";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, FpSpread1.Sheets[0].ColumnCount - 1].Font.Bold = true;

                FpSpread1.Sheets[0].ColumnCount++;
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, FpSpread1.Sheets[0].ColumnCount - 1].Text      = "Percentile";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, FpSpread1.Sheets[0].ColumnCount - 1].Font.Bold = true;

                FpSpread1.Sheets[0].ColumnCount++;
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, FpSpread1.Sheets[0].ColumnCount - 1].Text      = "Rank";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, FpSpread1.Sheets[0].ColumnCount - 1].Font.Bold = true;
                FarPoint.Web.Spread.TextCellType db = new FarPoint.Web.Spread.TextCellType();

                data = ds.Tables[0].DefaultView.ToTable(true, "degree_code", "StreamAdmission", "quota");
                DataView Dsort = data.DefaultView;
                Dsort.Sort = "degree_code,StreamAdmission,quota";
                for (int intds = 0; intds < Dsort.Count; intds++)
                {
                    ds.Tables[0].DefaultView.RowFilter = "degree_code='" + Convert.ToString(Dsort[intds]["degree_code"]) + "' and StreamAdmission='" + Convert.ToString(Dsort[intds]["StreamAdmission"]) + "' and quota='" + Convert.ToString(Dsort[intds]["quota"]) + "'";
                    Dsview = ds.Tables[0].DefaultView;
                    string Strm = Convert.ToString(Dsview[0]["Stream"]);
                    if (Strm.Trim() != "Stream II")
                    {
                        Dsview.Sort = " CombinedScore desc";
                    }
                    else
                    {
                        Dsview.Sort = " CombinedScoreSII desc,stud_name asc";
                    }
                    if (Dsview.Count > 0)
                    {
                        FpSpread1.Sheets[0].RowCount++;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Text = (Convert.ToString(Dsview[0]["Departmet"]) + "            " + Convert.ToString(Dsview[0]["Stream"]) + "            " + Convert.ToString(Dsview[0]["Categroy"]));
                        FpSpread1.Sheets[0].SpanModel.Add(FpSpread1.Sheets[0].RowCount - 1, 0, 1, FpSpread1.Sheets[0].ColumnCount);
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].HorizontalAlign = HorizontalAlign.Center;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Font.Bold       = true;
                        for (int intdv = 0; intdv < Dsview.Count; intdv++)
                        {
                            SNo++;
                            string AppNo = Convert.ToString(Dsview[intdv]["app_no"]);
                            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, 1].Text            = Convert.ToString(Dsview[intdv]["Roll_Admit"]);
                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].HorizontalAlign = HorizontalAlign.Center;

                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Text            = Convert.ToString(Dsview[intdv]["stud_name"]);
                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].HorizontalAlign = HorizontalAlign.Left;

                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].Text            = Convert.ToString(Dsview[intdv]["AdmitDate"]);
                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].HorizontalAlign = HorizontalAlign.Center;

                            double comI     = 0;
                            string ComIIval = Convert.ToString(Dsview[intdv]["CombinedScore"]);
                            double.TryParse(ComIIval, out comI);

                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 4].CellType        = db;
                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 4].Text            = Convert.ToString(Math.Round(comI, 4));
                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 4].HorizontalAlign = HorizontalAlign.Center;

                            double comII      = 0;
                            string ComIIvalue = Convert.ToString(Dsview[intdv]["CombinedScoreSII"]);
                            double.TryParse(ComIIvalue, out comII);
                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 5].CellType        = db;
                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 5].Text            = Convert.ToString(Math.Round(comII, 4));
                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 5].HorizontalAlign = HorizontalAlign.Center;


                            ds.Tables[1].DefaultView.RowFilter = "ST_RankCriteria='" + Convert.ToString(Dsort[intds]["quota"]) + "' and ST_Stream ='" + Convert.ToString(Dsort[intds]["StreamAdmission"]) + "' and ST_AppNo ='" + AppNo + "'";
                            DvRank = ds.Tables[1].DefaultView;
                            if (DvRank.Count > 0)
                            {
                                FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 6].Text            = Convert.ToString(DvRank[0]["ST_Rank"]);
                                FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 6].HorizontalAlign = HorizontalAlign.Center;
                            }
                        }
                    }
                }
                if (FpSpread1.Sheets[0].RowCount > 0)
                {
                    FpSpread1.Visible            = true;
                    FpSpread1.Sheets[0].PageSize = FpSpread1.Sheets[0].RowCount;
                    div_report.Visible           = true;
                }
            }
            else
            {
                lblAlertMsg.Text      = "No Record(s) Found";
                lblAlertMsg.Visible   = true;
                divPopupAlert.Visible = true;
                return;
            }
        }
        catch
        {
        }
    }
Пример #21
0
    protected void btn_go_OnClick(object sender, EventArgs e)
    {
        try
        {
            #region Order by

            string orderby_Setting = d2.GetFunction("select value from master_Settings where settings='order_by'");
            string strorder        = ",len(r.roll_no)";
            if (orderby_Setting == "0")
            {
                strorder = ",len(r.roll_no)";
            }
            else if (orderby_Setting == "1")
            {
                strorder = ",len(r.Reg_No)";
            }
            else if (orderby_Setting == "2")
            {
                strorder = ",r.Stud_Name";
            }
            else if (orderby_Setting == "0,1,2")
            {
                strorder = ",len(r.roll_no),len(r.Reg_No),r.stud_name";
            }
            else if (orderby_Setting == "0,1")
            {
                strorder = ",len(r.roll_no),len(r.Reg_No)";
            }
            else if (orderby_Setting == "1,2")
            {
                strorder = ",len(r.Reg_No),r.Stud_Name";
            }
            else if (orderby_Setting == "0,2")
            {
                strorder = ",len(r.roll_no),r.Stud_Name";
            }

            #endregion
            //FarPoint.Web.Spread.TextCellType txt;
            FarPoint.Web.Spread.TextCellType txt = new FarPoint.Web.Spread.TextCellType();
            string degreecode = rs.GetSelectedItemsValueAsString(cbl_degree);
            string deptcode   = rs.GetSelectedItemsValueAsString(cbl_branch);
            string batchyear  = ddl_batch.SelectedItem.Text;
            //string sem = rs.GetSelectedItemsValueAsString(cbl_sem);
            DateTime FromDate = new DateTime();
            DateTime ToDate   = new DateTime();
            string[] fromdate = txtfromdate.Text.Split('/');
            string[] todate   = txttodate.Text.Split('/');
            FromDate = Convert.ToDateTime(fromdate[1] + "/" + fromdate[0] + "/" + fromdate[2]);
            ToDate   = Convert.ToDateTime(todate[1] + "/" + todate[0] + "/" + todate[2]);

            if (ddlCatogery.SelectedValue.ToString() == "1")
            {
                q1 = "select distinct R.Stud_Name ,r.Roll_no,R.Reg_No, Convert(varchar(10),R.batch_year)+' - '+ Convert(varchar(10),c.Course_name)+' - '+de.Acronym+' - '+Convert(varchar(10),R.current_semester)  as Degreedet,Convert(varchar(20),re.readm_date,103) as ReadmittedDate ,Convert(varchar(10), re.newbatch_year) +' - ' + Convert(varchar(10),re.Readm_Semester) +' SEM' as ReadmittedSemester  from Readmission re,REgistration R,Degree de,Department dep,Course c where R.App_No=re.App_No and c.Course_id=de.Course_id and de.college_code=c.college_code and dep.Dept_code=de.Dept_code and dep.college_code=de.college_code and R.college_code=dep.college_code and R.degree_code=de.Degree_code and c.Course_id IN ('" + degreecode + "') and R.batch_year in ('" + batchyear + "') and dep.dept_code in('" + deptcode + "') and re.Dis_Date  between '" + FromDate.ToString("MM/dd/yyyy") + "' and '" + ToDate.ToString("MM/dd/yyyy") + "' and REadmitreason='2' ";   //REadmitreason 1 for Prolong Absent Students
            }
            else if (ddlCatogery.SelectedValue.ToString() == "2")
            {
                q1 = "select distinct R.Stud_Name ,r.Roll_no,R.Reg_No, Convert(varchar(10),R.batch_year)+' - '+ Convert(varchar(10),c.Course_name)+' - '+de.Acronym+' - '+Convert(varchar(10),R.current_semester)  as Degreedet,Convert(varchar(20),re.readm_date,103) as ReadmittedDate ,Convert(varchar(10), re.newbatch_year) +' - ' + Convert(varchar(10),re.Readm_Semester) +' SEM' as ReadmittedSemester  from Readmission re,REgistration R,Degree de,Department dep,Course c where R.App_No=re.App_No and c.Course_id=de.Course_id and de.college_code=c.college_code and dep.Dept_code=de.Dept_code and dep.college_code=de.college_code and R.college_code=dep.college_code and R.degree_code=de.Degree_code and c.Course_id IN ('" + degreecode + "') and R.batch_year in ('" + batchyear + "') and dep.dept_code in('" + deptcode + "') and re.Dis_Date  between '" + FromDate.ToString("MM/dd/yyyy") + "' and '" + ToDate.ToString("MM/dd/yyyy") + "'  and REadmitreason='1' ";  //REadmitreason 1 for Discontinued Students
            }

            //q1 += " order by " + strorder.TrimStart(',') + " ";
            if (deptcode.Trim() != "" && degreecode.Trim() != "")  //&& sem.Trim() != ""
            {
                ds.Clear();
                ds = d2.select_method_wo_parameter(q1, "Text");
                if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                {
                    //rs.Fpreadheaderbindmethod("S.No-50/Student Name-220/Roll No-130/Reg No-150/Degree Details-180/Readmitted Date-120/Semester-140/", FpSpread1, "FALSE");
                    rs.Fpreadheaderbindmethod("S.No/Student Name/Roll No/Reg No/Degree Details/Readmitted Date/Semester/", FpSpread1, "TRUE");

                    FpSpread1.Sheets[0].Rows.Count++;

                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        FpSpread1.Sheets[0].Rows.Count++;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Text = Convert.ToString(FpSpread1.Sheets[0].Rows.Count - 1);
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Text = Convert.ToString(FpSpread1.Sheets[0].Rows.Count - 1);
                        //  FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Tag = Convert.ToString(dr["degree_code"]);

                        if (Convert.ToString(Session["Rollflag"]) == "1")
                        {
                            FpSpread1.Sheets[0].Columns[3].Visible = true;
                        }
                        if (Convert.ToString(Session["Regflag"]) == "1")
                        {
                            FpSpread1.Sheets[0].Columns[4].Visible = true;
                        }

                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].CellType = txt;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 4].CellType = txt;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].CellType = txt;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Text     = Convert.ToString(dr["Stud_Name"]);
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Text     = Convert.ToString(dr["Roll_no"]);
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].Text     = Convert.ToString(dr["Reg_No"]);
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 4].Text     = Convert.ToString(dr["Degreedet"]);
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 5].Text     = Convert.ToString(dr["ReadmittedDate"]);
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 6].Text     = Convert.ToString(dr["ReadmittedSemester"]);

                        FarPoint.Web.Spread.TextCellType txtclType = new FarPoint.Web.Spread.TextCellType();
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 5].CellType = txtclType;

                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Locked          = true;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Locked          = true;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Locked          = true;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].Locked          = true;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 4].Locked          = true;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 5].Locked          = true;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 6].Locked          = true;
                        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].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].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].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].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].HorizontalAlign = HorizontalAlign.Left;
                        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].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.Sheets[0].Columns[7].Visible = false;
                    }
                    FpSpread1.Sheets[0].PageSize = FpSpread1.Sheets[0].RowCount;

                    FpSpread1.Visible = true;
                    FpSpread1.SaveChanges();
                    lbl_error.Visible = false;
                    print.Visible     = true;
                }
                else
                {
                    FpSpread1.Visible = false;
                    lbl_error.Visible = true;
                    lbl_error.Text    = "No Record Founds";
                }
            }
            else
            {
                FpSpread1.Visible = false;
                lbl_error.Visible = true;
                lbl_error.Text    = "Please Select All Fields";
            }
        }
        catch { }
    }
Пример #22
0
    public void BindBatch()
    {
        try
        {
            cbl_batch.Items.Clear();
            cb_batch.Checked = false;
            txt_batch.Text   = "--Select--";
            string college_cd = rs.GetSelectedItemsValueAsString(Cbl_college);
            if (college_cd != "")
            {
                ds = d2.BindBatch();
                if (ds.Tables[0].Rows.Count > 0)
                {
                    cbl_batch.DataSource     = ds;
                    cbl_batch.DataTextField  = "batch_year";
                    cbl_batch.DataValueField = "batch_year";
                    cbl_batch.DataBind();
                }
                if (cbl_batch.Items.Count > 0)
                {
                    cbl_batch.Items[0].Selected = true;

                    txt_batch.Text = "Batch(1)";
                }
                else
                {
                    txt_batch.Text = "--Select--";
                }
            }
            BindDegree();
        }
        catch (Exception ex)
        {
        }
    }