protected void Page_Init(object sender, EventArgs e)
        {
            string SearchStr = string.Empty;

            try
            {
                if (Session["CurrentSchoolYearId"] == null)
                {
                    Response.Redirect("~/Login.aspx");
                }

                crdata.Report = rpt;
                rpt1          = crdata.ReportDocument;
                DataSet dsReport = new xmlClassWiseStudentAttendTime();
                DataSet ds       = new DataSet();
                if (Session["FamilyTitle"] != null)
                {
                    //rpt.FileName = Server.MapPath("rptFamilyChildListReport.rpt");
                    rpt.FileName = Server.MapPath("rptFamilyChildList1Report.rpt");
                    DayCareBAL.LedgerService proxy = new DayCareBAL.LedgerService();

                    SearchStr += Session["FamilyTitle"].ToString();
                    SearchStr  = Session["FamilyTitle"].ToString().Replace("'00000000-0000-0000-0000-000000000000',", "");
                    //string[] str = SearchStr.Remove(SearchStr.Length - 1).Remove(0, 1).Replace("','", "$").Split('$');

                    //string strFinalSearhString = "";

                    //foreach (string s in str)
                    //{
                    //    string s1 = "";
                    //    s1 = s.Replace("'", "");
                    //    s1 = "''" + s1 + "'',";
                    //    strFinalSearhString += s1;
                    //}
                    //strFinalSearhString = strFinalSearhString.Remove(strFinalSearhString.Length - 1);
                    //strFinalSearhString = "'" + strFinalSearhString + "'";

                    CrystalDecisions.CrystalReports.Engine.TextObject titleTextSchool = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text1"];
                    CrystalDecisions.CrystalReports.Engine.TextObject footer          = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["txtfooter"];
                    footer.Text          = Common.GetSchoolWiseAddress(new Guid(Session["SchoolId"].ToString()));
                    titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper();
                    //ds = proxy.GetAccountReceiable(new Guid(Session["CurrentSchoolYearId"].ToString(), new Guid(Request.QueryString["StartDate"].ToString())));
                    ds = proxy.GetFamilyChildListReport(new Guid(Session["SchoolId"].ToString()), new Guid(Session["CurrentSchoolYearId"].ToString()), SearchStr);
                    dsReport.Tables["dtFamilyChildList"].Merge(ds.Tables[0]);
                    rpt1.SetDataSource(dsReport.Tables["dtFamilyChildList"]);
                }
                crp.DisplayGroupTree = false;
                crp.ReportSource     = rpt1;
                crp.RefreshReport();
                crp.DataBind();
            }
            catch (Exception ex)
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.Ledger, "rptFamilyChildListReport Page_Load", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
            }
        }
        protected void Page_Init(object sender, EventArgs e)
        {
            if (Session["CurrentSchoolYearId"] == null)
            {
                Response.Redirect("~/Login.aspx");
            }
            crdata.Report = rpt;
            rpt1          = crdata.ReportDocument;
            DataSet dsReport   = new xmlClassWiseStudentAttendTime();
            DataSet ds         = new DataSet();
            string  SearchText = "";

            rpt.FileName = Server.MapPath("rptDeposit.rpt");
            DayCareBAL.FamilyPaymentService proxyPayment = new DayCareBAL.FamilyPaymentService();

            if (!String.IsNullOrEmpty(Request.QueryString["StartDate"]) && String.IsNullOrEmpty(Request.QueryString["EndDate"]))
            {
                SearchText += " l.transactiondate>='" + Request.QueryString["StartDate"].ToString() + "'";
            }
            if (String.IsNullOrEmpty(Request.QueryString["StartDate"]) && !String.IsNullOrEmpty(Request.QueryString["EndDate"]))
            {
                SearchText += " l.transactiondate<='" + Request.QueryString["EndDate"].ToString().Replace("00:00:00 AM", "11:59:58 PM") + "'";
            }
            else if (!String.IsNullOrEmpty(Request.QueryString["EndDate"]) && !String.IsNullOrEmpty(Request.QueryString["StartDate"]))
            {
                SearchText += "  l.transactiondate>='" + Request.QueryString["StartDate"].ToString() + "' and l.transactiondate<='" + Request.QueryString["EndDate"].ToString().Replace("00:00:00 AM", "11:59:58 PM") + "'";
            }
            string StartDate = string.Empty;
            string EndDate   = string.Empty;

            if (Request.QueryString["StartDate"] != "")
            {
                StartDate = Convert.ToDateTime(Request.QueryString["StartDate"].ToString()).ToString("MM/dd/yyyy");
            }
            if (Request.QueryString["EndDate"] != "")
            {
                EndDate = Convert.ToDateTime(Request.QueryString["EndDate"].ToString()).ToString("MM/dd/yyyy");
            }
            CrystalDecisions.CrystalReports.Engine.TextObject titleText       = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text14"];
            CrystalDecisions.CrystalReports.Engine.TextObject titleTextSchool = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text4"];
            CrystalDecisions.CrystalReports.Engine.TextObject footer          = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["txtfooter"];
            footer.Text          = Common.GetSchoolWiseAddress(new Guid(Session["SchoolId"].ToString()));
            titleText.Text       = "Deposit Report From " + StartDate + " To " + EndDate;
            titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper();
            ds = proxyPayment.LoadPaymentDeposits(SearchText, new Guid(Session["CurrentSchoolYearId"].ToString()));
            dsReport.Tables["dtDiposit"].Merge(ds.Tables[0]);
            rpt1.SetDataSource(dsReport.Tables["dtDiposit"]);

            crp.DisplayGroupTree = false;
            crp.ReportSource     = rpt1;
            crp.RefreshReport();

            crp.DataBind();
        }
        protected void Page_Init(object sender, EventArgs e)
        {
            if (Session["CurrentSchoolYearId"] == null)
            {
                Response.Redirect("~/Login.aspx");
            }

            crdata.Report = rpt;
            rpt1          = crdata.ReportDocument;

            DataSet dsReport = new xmlClassWiseStudentAttendTime();
            DataSet ds       = new DataSet();

            if (!string.IsNullOrEmpty(Request.QueryString["ChildFamilyID"]))
            {
            }
        }
        protected void Page_Init(object sender, EventArgs e)
        {
            try
            {
                if (Session["CurrentSchoolYearId"] == null)
                {
                    Response.Redirect("~/Login.aspx");
                }

                crdata.Report = rpt;
                rpt1          = crdata.ReportDocument;

                DataSet dsReport = new xmlClassWiseStudentAttendTime();
                DataSet ds       = new DataSet();

                if (!string.IsNullOrEmpty(Request.QueryString["StartDate"]))
                {
                    rpt.FileName = Server.MapPath("rptAccountReceivablesReport.rpt");
                    DayCareBAL.LedgerService proxy = new DayCareBAL.LedgerService();

                    CrystalDecisions.CrystalReports.Engine.TextObject titleTextSchool = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text9"];
                    CrystalDecisions.CrystalReports.Engine.TextObject footer          = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["txtfooter"];
                    footer.Text          = Common.GetSchoolWiseAddress(new Guid(Session["SchoolId"].ToString()));
                    titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper();
                    //ds = proxy.GetAccountReceiable(new Guid(Session["CurrentSchoolYearId"].ToString(), new Guid(Request.QueryString["StartDate"].ToString())));
                    ds = proxy.GetAccountReceiable(new Guid(Session["CurrentSchoolYearId"].ToString()), Convert.ToDateTime(Request.QueryString["StartDate"].ToString()), "AccountsReceivable");
                    dsReport.Tables["dtAccountReceiable_Credit"].Merge(ds.Tables[0]);
                    rpt1.SetDataSource(dsReport.Tables["dtAccountReceiable_Credit"]);
                }

                crp.DisplayGroupTree = false;
                crp.ReportSource     = rpt1;
                crp.RefreshReport();

                crp.DataBind();
            }
            catch (Exception ex)
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.Ledger, "rptAccountReciableReport Page_Load", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
            }
        }
        protected void Page_Init(object sender, EventArgs e)
        {
            if (Session["CurrentSchoolYearId"] == null)
            {
                Response.Redirect("~/Login.aspx");
            }

            crdata.Report = rpt;
            rpt1          = crdata.ReportDocument;

            DataSet dsReport = new xmlClassWiseStudentAttendTime();
            DataSet ds       = new DataSet();

            String strLastNameFrom = Convert.ToString(Request.QueryString["lastnamefrom"]);
            String strLastNameTo   = Convert.ToString(Request.QueryString["lastnameto"]);

            // crp.AfterRender += this.crp_AfterRender;


            rpt.FileName = Server.MapPath("rptStudentSchedule.rpt");
            DayCareBAL.ClassRoomService proxy = new DayCareBAL.ClassRoomService();
            CrystalDecisions.CrystalReports.Engine.TextObject titleText       = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text3"];
            CrystalDecisions.CrystalReports.Engine.TextObject titleTextSchool = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text1"];
            CrystalDecisions.CrystalReports.Engine.TextObject footer          = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["txtfooter"];
            footer.Text = Common.GetSchoolWiseAddress(new Guid(Session["SchoolId"].ToString()));
            //CrystalDecisions.CrystalReports.Engine.TextObject titleText4 = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text4"];
            //titleText4.Text = ViewState["title"].ToString();

            titleText.Text       = "Student Schedule";
            titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper();
            ds = proxy.GetStudentSchedule(new Guid(DayCarePL.Common.GUID_DEFAULT), new Guid(Session["CurrentSchoolYearId"].ToString()), strLastNameFrom, strLastNameTo);
            dsReport.Tables["dtClassWiseStudent"].Merge(ds.Tables[0]);
            rpt1.SetDataSource(dsReport.Tables["dtClassWiseStudent"]);

            crp.DisplayGroupTree = false;
            crp.ReportSource     = rpt1;
            crp.RefreshReport();

            crp.DataBind();
        }
        protected void Page_Init(object sender, EventArgs e)
        {
            if (Session["CurrentSchoolYearId"] == null)
            {
                Response.Redirect("~/Login.aspx");
            }

            crdata.Report = rpt;
            rpt1          = crdata.ReportDocument;
            DataSet   dsReport    = new xmlClassWiseStudentAttendTime();
            DataSet   ds          = new DataSet();
            DataSet   dsForReport = new DataSet();
            DataTable dt          = new DataTable();

            //strConnection = ConfigurationSettings.AppSettings["8CA767A0-5E36-4343-8B1D-5ECC40EB9E1B"];
            strConnection = ConfigurationSettings.AppSettings[Session["SchoolId"].ToString()];
            if (!String.IsNullOrEmpty(Request.QueryString["StartDate"]))
            {
                StartDate = Request.QueryString["StartDate"].ToString();
            }
            if (!String.IsNullOrEmpty(Request.QueryString["EndDate"]))
            {
                EndDate = Request.QueryString["EndDate"].ToString();
            }
            if (!String.IsNullOrEmpty(Request.QueryString["ChildFamilyId"]))
            {
                ViewState["ChildFamilyId"] = new Guid(Request.QueryString["ChildFamilyId"].ToString());
            }

            if (!String.IsNullOrEmpty(ViewState["ChildFamilyId"].ToString()))
            {
                if (string.IsNullOrEmpty(StartDate) && string.IsNullOrEmpty(EndDate))
                {
                    rpt.FileName = Server.MapPath("rptLedgerOfFamily.rpt");
                    DayCarePL.LedgerProperties objLedger   = new DayCarePL.LedgerProperties();
                    DayCareBAL.LedgerService   proxyLedger = new DayCareBAL.LedgerService();
                    CrystalDecisions.CrystalReports.Engine.TextObject titleText       = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text9"];
                    CrystalDecisions.CrystalReports.Engine.TextObject titleTextSchool = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text5"];
                    CrystalDecisions.CrystalReports.Engine.TextObject LedgerEIN       = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text15"];
                    CrystalDecisions.CrystalReports.Engine.TextObject footer          = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["txtfooter"];
                    footer.Text = Common.GetSchoolWiseAddress(new Guid(Session["SchoolId"].ToString()));
                    if (!string.IsNullOrEmpty(strConnection))
                    {
                        LedgerEIN.Text = "EIN#: " + strConnection;
                    }
                    //titleText.Text = "Ledger Of Family report as on " + Convert.ToDateTime(StartDate).ToShortDateString() + " to " + Convert.ToDateTime(EndDate).ToShortDateString();
                    titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper();
                    ds = proxyLedger.LoadLedgerOfFamily(new Guid(Session["CurrentSchoolYearId"].ToString()), new Guid(ViewState["ChildFamilyId"].ToString()));
                    List <DayCarePL.ClosingBalance> lstOpeningBalance = proxyLedger.GetPreviousYearClosingBalance(new Guid(ViewState["ChildFamilyId"].ToString()), new Guid(Session["CurrentSchoolYearId"].ToString()));
                    if (ds != null && ds.Tables.Count > 0)
                    {
                        try
                        {
                            titleText.Text = "Ledger of Family Report for period:" + Convert.ToDateTime(ds.Tables[0].Rows[0]["TransactionDate"].ToString()).ToShortDateString() + " to " + Convert.ToDateTime(ds.Tables[0].Rows[ds.Tables[0].Rows.Count - 1]["TransactionDate"].ToString()).ToShortDateString();
                        }
                        catch { }
                    }
                    if (ds != null && ds.Tables.Count > 0 && lstOpeningBalance != null)// && lstOpeningBalance.Count > 0)
                    {
                        DataRow dr = ds.Tables[0].NewRow();
                        //dr["Id"] = DBNull.Value;
                        //dr["SchoolYearId"] = Session["CurrentSchoolYearId"].ToString();
                        //dr["ChildFamilyId"] = ViewState["ChildFamilyId"].ToString();
                        //dr["PaymentId"] = "";
                        //dr["TransactionDate"] = "";
                        //dr["Detail"] = "";
                        //dr["ChildDataId"] = "";
                        dr["Comment"] = "OPENING BALANCE :";
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            dr["FamilyTitle"] = ds.Tables[0].Rows[0]["FamilyTitle"].ToString();
                        }
                        else
                        {
                            dr["FamilyTitle"] = Common.GetFamilyName(new Guid(ViewState["ChildFamilyId"].ToString()));
                        }
                        //dr["Debit"] = "";
                        //dr["Credit"] = "";
                        dr["Balance"] = lstOpeningBalance.Sum(i => i.ClosingBalanceAmount);
                        ds.Tables[0].Rows.InsertAt(dr, 0);
                    }
                    decimal debit   = 0;
                    decimal credit  = 0;
                    decimal balance = 0;
                    int     i1      = 0;
                    if (lstOpeningBalance != null)// && lstOpeningBalance.Count > 0)
                    {
                        i1      = 1;
                        balance = lstOpeningBalance.Sum(i => i.ClosingBalanceAmount);
                    }
                    for (int i = i1; i < ds.Tables[0].Rows.Count; i++)
                    {
                        debit = Convert.ToDecimal(ds.Tables[0].Rows[i]["Debit"].ToString());
                        if (debit > 0)
                        {
                            balance += debit;
                        }
                        else
                        {
                            credit   = Convert.ToDecimal(ds.Tables[0].Rows[i]["Credit"].ToString());
                            balance -= credit;
                        }
                        ds.Tables[0].Rows[i]["Balance"] = balance;
                    }
                    dsReport.Tables["dtLedgerOfFamily"].Merge(ds.Tables[0]);
                    rpt1.SetDataSource(dsReport.Tables["dtLedgerOfFamily"]);
                }
                else
                {
                    rpt.FileName = Server.MapPath("rptLedgerOfFamily.rpt");
                    DayCarePL.LedgerProperties objLedger   = new DayCarePL.LedgerProperties();
                    DayCareBAL.LedgerService   proxyLedger = new DayCareBAL.LedgerService();
                    CrystalDecisions.CrystalReports.Engine.TextObject titleText       = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text9"];
                    CrystalDecisions.CrystalReports.Engine.TextObject titleTextSchool = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text5"];
                    CrystalDecisions.CrystalReports.Engine.TextObject LedgerEIN       = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text15"];
                    if (!string.IsNullOrEmpty(strConnection))
                    {
                        LedgerEIN.Text = "EIN#: " + strConnection;
                    }
                    titleText.Text       = "Ledger of Family Report for period: " + Convert.ToDateTime(StartDate).ToShortDateString() + " to " + Convert.ToDateTime(EndDate).ToShortDateString();
                    titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper();
                    ds = proxyLedger.LoadLedgerOfFamily(new Guid(Session["CurrentSchoolYearId"].ToString()), new Guid(ViewState["ChildFamilyId"].ToString()));
                    if (ds != null && ds.Tables.Count > 0)
                    {
                        DataView dv = ds.Tables[0].DefaultView;
                        dv.Sort = "TransactionDate ASC";
                    }
                    List <DayCarePL.ClosingBalance> lstOpeningBalance = proxyLedger.GetPreviousYearClosingBalance(new Guid(ViewState["ChildFamilyId"].ToString()), new Guid(Session["CurrentSchoolYearId"].ToString()));
                    if (ds != null && lstOpeningBalance != null)
                    {
                        //DataRow dr = ds.Tables[0].NewRow();
                        DataColumn Id = new DataColumn("Id", typeof(System.Guid));
                        dt.Columns.Add(Id);

                        DataColumn SchoolYearId = new DataColumn("SchoolYearId", typeof(System.Guid));
                        dt.Columns.Add(SchoolYearId);

                        DataColumn ChildFamilyId = new DataColumn("ChildFamilyId", typeof(System.Guid));
                        dt.Columns.Add(ChildFamilyId);

                        DataColumn PaymentId = new DataColumn("PaymentId", typeof(System.Guid));
                        dt.Columns.Add(PaymentId);

                        DataColumn TransactionDate = new DataColumn("TransactionDate", typeof(System.DateTime));
                        dt.Columns.Add(TransactionDate);


                        DataColumn Detail = new DataColumn("Detail", typeof(System.String));
                        dt.Columns.Add(Detail);

                        DataColumn ChildDataId = new DataColumn("ChildDataId", typeof(System.Guid));
                        dt.Columns.Add(ChildDataId);


                        DataColumn Comment = new DataColumn("Comment", typeof(System.String));
                        dt.Columns.Add(Comment);

                        DataColumn FamilyTitle = new DataColumn("FamilyTitle", typeof(System.String));
                        dt.Columns.Add(FamilyTitle);

                        DataColumn Debit = new DataColumn("Debit", typeof(System.Decimal));
                        dt.Columns.Add(Debit);

                        DataColumn Credit = new DataColumn("Credit", typeof(System.Decimal));
                        dt.Columns.Add(Credit);

                        DataColumn Balance = new DataColumn("Balance", typeof(System.Decimal));
                        dt.Columns.Add(Balance);

                        DataColumn PaymentMethodOrCharges = new DataColumn("PaymentMethodOrCharges", typeof(System.String));
                        dt.Columns.Add(PaymentMethodOrCharges);

                        DataRow dr = dt.NewRow();
                        //dr["Id"] = DBNull.Value;
                        //dr["SchoolYearId"] = Session["CurrentSchoolYearId"].ToString();
                        //dr["ChildFamilyId"] = ViewState["ChildFamilyId"].ToString();
                        //dr["PaymentId"] = "";
                        //dr["TransactionDate"] = "";
                        //dr["Detail"] = "";
                        //dr["ChildDataId"] = "";
                        dr["Comment"] = "OPENING BALANCE :";
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            dr["FamilyTitle"] = ds.Tables[0].Rows[0]["FamilyTitle"].ToString();
                        }
                        else
                        {
                            dr["FamilyTitle"] = Common.GetFamilyName(new Guid(ViewState["ChildFamilyId"].ToString()));
                        }
                        //dr["Debit"] = "";
                        //dr["Credit"] = "";
                        dr["Balance"] = lstOpeningBalance.Sum(i => i.ClosingBalanceAmount);
                        //ds.Tables[0].Rows.InsertAt(dr, 0);
                        dt.Rows.Add(dr);
                        dsForReport.Tables.Add(dt);
                        //dsForReport.Tables[0].Rows.InsertAt(dr, 0);
                    }
                    //else
                    //{
                    //    //DataRow dr = ds.Tables[0].NewRow();
                    //    DataColumn Id = new DataColumn("Id", typeof(System.Guid));
                    //    dt.Columns.Add(Id);

                    //    DataColumn SchoolYearId = new DataColumn("SchoolYearId", typeof(System.Guid));
                    //    dt.Columns.Add(SchoolYearId);

                    //    DataColumn ChildFamilyId = new DataColumn("ChildFamilyId", typeof(System.Guid));
                    //    dt.Columns.Add(ChildFamilyId);

                    //    DataColumn PaymentId = new DataColumn("PaymentId", typeof(System.Guid));
                    //    dt.Columns.Add(PaymentId);

                    //    DataColumn TransactionDate = new DataColumn("TransactionDate", typeof(System.DateTime));
                    //    dt.Columns.Add(TransactionDate);


                    //    DataColumn Detail = new DataColumn("Detail", typeof(System.String));
                    //    dt.Columns.Add(Detail);

                    //    DataColumn ChildDataId = new DataColumn("ChildDataId", typeof(System.Guid));
                    //    dt.Columns.Add(ChildDataId);


                    //    DataColumn Comment = new DataColumn("Comment", typeof(System.String));
                    //    dt.Columns.Add(Comment);

                    //    DataColumn FamilyTitle = new DataColumn("FamilyTitle", typeof(System.String));
                    //    dt.Columns.Add(FamilyTitle);

                    //    DataColumn Debit = new DataColumn("Debit", typeof(System.Decimal));
                    //    dt.Columns.Add(Debit);

                    //    DataColumn Credit = new DataColumn("Credit", typeof(System.Decimal));
                    //    dt.Columns.Add(Credit);

                    //    DataColumn Balance = new DataColumn("Balance", typeof(System.Decimal));
                    //    dt.Columns.Add(Balance);

                    //    DataColumn PaymentMethodOrCharges = new DataColumn("PaymentMethodOrCharges", typeof(System.String));
                    //    dt.Columns.Add(PaymentMethodOrCharges);

                    //    //DataRow dr = dt.NewRow();

                    //    //dr["Comment"] = "OPENING BALANCE :";
                    //    //if (ds.Tables[0].Rows.Count > 0)
                    //    //{
                    //    //    dr["FamilyTitle"] = ds.Tables[0].Rows[0]["FamilyTitle"].ToString();
                    //    //}
                    //    //else
                    //    //{
                    //    //    dr["FamilyTitle"] = Common.GetFamilyName(new Guid(ViewState["ChildFamilyId"].ToString()));
                    //    //}
                    //    //dr["Balance"] = lstOpeningBalance.Sum(i => i.ClosingBalanceAmount);
                    //    //dt.Rows.Add(dr);
                    //    dsForReport.Tables.Add(dt);
                    //}
                    decimal debit   = 0;
                    decimal credit  = 0;
                    decimal balance = 0;
                    int     i1      = 0;
                    if (lstOpeningBalance != null)
                    {
                        //i1 = 1;
                        balance = lstOpeningBalance.Sum(i => i.ClosingBalanceAmount);
                    }
                    for (int i = i1; i < ds.Tables[0].Rows.Count; i++)
                    {
                        if (Convert.ToDateTime(ds.Tables[0].Rows[i]["TransactionDate"].ToString()).Date <= Convert.ToDateTime(EndDate).Date)
                        {
                            debit = Convert.ToDecimal(ds.Tables[0].Rows[i]["Debit"].ToString());
                            if (debit > 0)
                            {
                                balance += debit;
                            }
                            else
                            {
                                credit   = Convert.ToDecimal(ds.Tables[0].Rows[i]["Credit"].ToString());
                                balance -= credit;
                            }
                        }
                        if (Convert.ToDateTime(ds.Tables[0].Rows[i]["TransactionDate"].ToString()).Date >= Convert.ToDateTime(StartDate).Date&& Convert.ToDateTime(ds.Tables[0].Rows[i]["TransactionDate"].ToString()).Date <= Convert.ToDateTime(EndDate).Date)
                        {
                            DataRow dr = dt.NewRow();
                            if (OpeningBalance == false)
                            {
                                if (debit > 0)
                                {
                                    balance -= debit;
                                }
                                else
                                {
                                    credit   = Convert.ToDecimal(ds.Tables[0].Rows[i]["Credit"].ToString());
                                    balance += credit;
                                }
                                if (dsForReport.Tables.Count > 0)
                                {
                                    dsForReport.Tables[0].Rows[0]["Balance"] = balance;
                                }
                                OpeningBalance = true;
                                if (debit > 0)
                                {
                                    balance += debit;
                                }
                                else
                                {
                                    credit   = Convert.ToDecimal(ds.Tables[0].Rows[i]["Credit"].ToString());
                                    balance -= credit;
                                }
                            }
                            dr["Id"]            = ds.Tables[0].Rows[i]["Id"].ToString();
                            dr["SchoolYearId"]  = new Guid(Session["CurrentSchoolYearId"].ToString());
                            dr["ChildFamilyId"] = new Guid(ViewState["ChildFamilyId"].ToString());
                            // dr["PaymentId"] =new Guid( ds.Tables[0].Rows[i]["PaymentId"].ToString());
                            dr["TransactionDate"] = Convert.ToDateTime(ds.Tables[0].Rows[i]["TransactionDate"].ToString());
                            dr["Detail"]          = ds.Tables[0].Rows[i]["Detail"].ToString();
                            //dr["ChildDataId"] =new Guid( ds.Tables[0].Rows[i]["ChildDataId"].ToString());
                            dr["Comment"]     = ds.Tables[0].Rows[i]["Comment"].ToString();
                            dr["FamilyTitle"] = ds.Tables[0].Rows[0]["FamilyTitle"].ToString();
                            dr["Debit"]       = Convert.ToDecimal(ds.Tables[0].Rows[i]["Debit"].ToString());
                            dr["Credit"]      = Convert.ToDecimal(ds.Tables[0].Rows[i]["Credit"].ToString());
                            dr["Balance"]     = balance;
                            if (!string.IsNullOrEmpty(ds.Tables[0].Rows[i]["PaymentMethodOrCharges"].ToString()))
                            {
                                dr["PaymentMethodOrCharges"] = ds.Tables[0].Rows[i]["PaymentMethodOrCharges"].ToString();
                            }
                            if (dsForReport.Tables.Count > 0)
                            {
                                dsForReport.Tables[0].Rows.Add(dr);
                            }
                        }
                        //if (Convert.ToDateTime(ds.Tables[0].Rows[i]["TransactionDate"].ToString()).Date >= Convert.ToDateTime(StartDate).Date && Convert.ToDateTime(ds.Tables[0].Rows[i]["TransactionDate"].ToString()).Date <= Convert.ToDateTime(EndDate).Date)
                        //{
                        //    break;
                        //}
                        //ds.Tables[0].Rows[i]["Balance"] = balance;
                    }
                    if (dsForReport.Tables.Count == 0)
                    {
                        dsForReport.Tables.Add(dt);
                    }
                    if (OpeningBalance == false)
                    {
                        dsForReport.Tables[0].Rows[0]["Balance"] = balance;
                    }
                    dsReport.Tables["dtLedgerOfFamily"].Merge(dsForReport.Tables[0]);
                    rpt1.SetDataSource(dsReport.Tables["dtLedgerOfFamily"]);
                }
            }
            crp.DisplayGroupTree = false;
            crp.ReportSource     = rpt1;
            crp.RefreshReport();

            crp.DataBind();
        }
Ejemplo n.º 7
0
        protected void Page_Init(object sender, EventArgs e)
        {
            #region
            if (Session["CurrentSchoolYearId"] == null)
            {
                Response.Redirect("~/Login.aspx");
            }
            crdata.Report = rpt;
            rpt1          = crdata.ReportDocument;
            DataSet dsReport = new xmlClassWiseStudentAttendTime();
            DataSet ds       = new DataSet();

            if (Request.QueryString["RepId"] == "Staff")
            {
                if (!String.IsNullOrEmpty(Session["StaffResult"].ToString()))
                {
                    rpt.FileName = Server.MapPath("rptStaffAttendanceReport.rpt");
                    DayCareBAL.StaffService proxyAttendance = new DayCareBAL.StaffService();

                    string ReportFor = "";
                    ReportFor = "Staff";
                    string SearchText = "";
                    string SearchStr  = "";
                    string SchoolYear = "";

                    if (!String.IsNullOrEmpty(Request.QueryString["StartDate"]) && String.IsNullOrEmpty(Request.QueryString["EndDate"]))
                    {
                        SearchText += " sah.checkincheckoutdatetime>='" + Request.QueryString["StartDate"].ToString() + "'";
                        // SchoolYear += "and ssy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'";
                        if (Session["StaffResult"] != null)
                        {
                            SearchStr += "Name in(" + Session["StaffResult"].ToString() + ")";
                        }
                    }

                    else if (String.IsNullOrEmpty(Request.QueryString["StartDate"]) && !String.IsNullOrEmpty(Request.QueryString["EndDate"]))
                    {
                        SearchText += " sah.checkincheckoutdatetime<='" + Request.QueryString["EndDate"].ToString().Replace("00:00:00 PM", "11:59:58") + "'";
                        // SchoolYear += "and ssy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'";
                        if (Session["StaffResult"] != null)
                        {
                            SearchStr += "Name in(" + Session["StaffResult"].ToString() + ")";
                        }
                    }
                    else if (!String.IsNullOrEmpty(Request.QueryString["EndDate"]) && !String.IsNullOrEmpty(Request.QueryString["StartDate"]))
                    {
                        SearchText += " sah.checkincheckoutdatetime>='" + Request.QueryString["StartDate"].ToString() + "' and sah.checkincheckoutdatetime<='" + Request.QueryString["EndDate"].ToString().Replace("00:00:00", "11:59:58") + "'";
                        //SchoolYear += "and ssy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'";
                        if (!String.IsNullOrEmpty(Session["StaffResult"].ToString()))
                        {
                            SearchStr += "Name in(" + Session["StaffResult"].ToString() + ")";
                        }
                    }
                    if (String.IsNullOrEmpty(Request.QueryString["EndDate"]) && String.IsNullOrEmpty(Request.QueryString["StartDate"]) && !String.IsNullOrEmpty(Session["StaffResult"].ToString()))
                    {
                        SearchStr += "Name in(" + Session["StaffResult"].ToString() + ")";
                    }

                    SearchStr = Session["StaffResult"].ToString().Replace("'--Select All--',", "");

                    string[] str = SearchStr.Remove(SearchStr.Length - 1).Remove(0, 1).Replace("','", "$").Split('$');

                    string strFinalSearhString = "";

                    foreach (string s in str)
                    {
                        string s1 = "";
                        s1 = s.Replace("'", "''");
                        s1 = "'" + s1 + "',";
                        strFinalSearhString += s1;
                    }
                    strFinalSearhString = "Name in(" + strFinalSearhString.Remove(strFinalSearhString.Length - 1) + ")";

                    ds = proxyAttendance.LoadAttendanceHistory1(SearchText, strFinalSearhString, new Guid(Session["CurrentSchoolYearId"].ToString()));
                    dsReport.Tables["dtAttendance"].Merge(ds.Tables[0]);
                }
                else
                {
                    rpt.FileName = Server.MapPath("rptStaffAttendanceReport.rpt");
                    DayCareBAL.StaffService proxyAttendance = new DayCareBAL.StaffService();

                    string ReportFor = "";
                    ReportFor = "Staff";
                    string SearchText = "";
                    string SearchStr  = "";
                    string SchoolYear = "";

                    if (!String.IsNullOrEmpty(Request.QueryString["StartDate"]) && String.IsNullOrEmpty(Request.QueryString["EndDate"]))
                    {
                        SearchText += " sah.checkincheckoutdatetime>='" + Request.QueryString["StartDate"].ToString() + "'";
                        // SchoolYear += "and ssy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'";
                    }

                    else if (String.IsNullOrEmpty(Request.QueryString["StartDate"]) && !String.IsNullOrEmpty(Request.QueryString["EndDate"]))
                    {
                        SearchText += " sah.checkincheckoutdatetime<='" + Request.QueryString["EndDate"].ToString().Replace("00:00:00 PM", "11:59:58") + "'";
                        // SchoolYear += "and ssy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'";
                    }
                    else if (!String.IsNullOrEmpty(Request.QueryString["EndDate"]) && !String.IsNullOrEmpty(Request.QueryString["StartDate"]))
                    {
                        SearchText += " sah.checkincheckoutdatetime>='" + Request.QueryString["StartDate"].ToString() + "' and sah.checkincheckoutdatetime<='" + Request.QueryString["EndDate"].ToString().Replace("00:00:00", "11:59:58") + "'";
                        //SchoolYear += "and ssy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'";
                    }


                    ds = proxyAttendance.LoadAttendanceHistory1(SearchText, SearchStr, new Guid(Session["CurrentSchoolYearId"].ToString()));
                    dsReport.Tables["dtAttendance"].Merge(ds.Tables[0]);
                }
                CrystalDecisions.CrystalReports.Engine.TextObject titleText       = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text7"];
                CrystalDecisions.CrystalReports.Engine.TextObject titleTextSchool = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text8"];
                CrystalDecisions.CrystalReports.Engine.TextObject footer          = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["txtfooter"];
                footer.Text = Common.GetSchoolWiseAddress(new Guid(Session["SchoolId"].ToString()));
                if (!String.IsNullOrEmpty(Request.QueryString["StartDate"]) && !String.IsNullOrEmpty(Request.QueryString["EndDate"]))
                {
                    titleText.Text = "Staff Attendance Report From " + Convert.ToDateTime(Request.QueryString["StartDate"].ToString()).ToString("MM/dd/yyyy") + " To " + Convert.ToDateTime(Request.QueryString["EndDate"].ToString()).ToString("MM/dd/yyyy");
                }
                titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper();

                if (String.IsNullOrEmpty(Request.QueryString["EndDate"]) && !String.IsNullOrEmpty(Request.QueryString["StartDate"]))
                {
                    titleText.Text = "Staff Attendance Report From " + Convert.ToDateTime(Request.QueryString["StartDate"].ToString()).ToString("MM/dd/yyyy");
                }
                titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper();
                if (!String.IsNullOrEmpty(Request.QueryString["EndDate"]) && String.IsNullOrEmpty(Request.QueryString["StartDate"]))
                {
                    titleText.Text = "Staff Attendance Report To " + Convert.ToDateTime(Request.QueryString["EndDate"].ToString()).ToString("MM/dd/yyyy");
                }
                titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper();
                rpt1.SetDataSource(dsReport.Tables["dtAttendance"]);
            }

            if (Request.QueryString["RepId"] == "Student")
            {
                if (!String.IsNullOrEmpty(Session["Result"].ToString()))
                {
                    rpt.FileName = Server.MapPath("rptStudentAttendanceReport.rpt");
                    DayCareBAL.StaffService proxyAttendance = new DayCareBAL.StaffService();
                    string ReportFor = "";
                    ReportFor = "Student";
                    string SearchText = "";
                    string SearchStr  = "";
                    string SchoolYear = "";
                    if (!String.IsNullOrEmpty(Request.QueryString["StartDate"]) && String.IsNullOrEmpty(Request.QueryString["EndDate"]))
                    {
                        SearchText += " cah.checkincheckoutdatetime>='" + Request.QueryString["StartDate"].ToString() + "'";
                        // SchoolYear += "and csy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'";
                        if (Session["Result"] != null)
                        {
                            SearchStr += "Name in(" + Session["Result"].ToString() + ")";
                        }
                    }

                    else if (String.IsNullOrEmpty(Request.QueryString["StartDate"]) && !String.IsNullOrEmpty(Request.QueryString["EndDate"]))
                    {
                        SearchText += " cah.checkincheckoutdatetime<='" + Request.QueryString["EndDate"].ToString().Replace("00:00:00 PM", "11:59:58") + "'";
                        // SchoolYear += "and csy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'";
                        if (Session["Result"] != null)
                        {
                            SearchStr += "Name in(" + Session["Result"].ToString() + ")";
                        }
                    }
                    else if (!String.IsNullOrEmpty(Request.QueryString["EndDate"]) && !String.IsNullOrEmpty(Request.QueryString["StartDate"]))
                    {
                        SearchText += " cah.checkincheckoutdatetime>='" + Request.QueryString["StartDate"].ToString() + "' and cah.checkincheckoutdatetime<='" + Request.QueryString["EndDate"].ToString().Replace("00:00:00", "11:59:58") + "'";
                        //SchoolYear += "and csy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'";
                        if (Session["Result"] != null)
                        {
                            SearchStr += "Name in(" + Session["Result"].ToString() + ")";
                        }
                    }
                    if (String.IsNullOrEmpty(Request.QueryString["EndDate"]) && String.IsNullOrEmpty(Request.QueryString["StartDate"]) && !String.IsNullOrEmpty(Session["Result"].ToString()))
                    {
                        SearchStr += "Name in(" + Session["Result"].ToString() + ")";
                    }

                    SearchStr = Session["Result"].ToString().Replace("'--Select All--',", "");

                    string[] str = SearchStr.Remove(SearchStr.Length - 1).Remove(0, 1).Replace("','", "$").Split('$');

                    string strFinalSearhString = "";

                    foreach (string s in str)
                    {
                        string s1 = "";
                        s1 = s.Replace("'", "''");
                        s1 = "'" + s1 + "',";
                        strFinalSearhString += s1;
                    }
                    strFinalSearhString = "Name in(" + strFinalSearhString.Remove(strFinalSearhString.Length - 1) + ")";
                    ds = proxyAttendance.LoadChildAttendanceHistory(SearchText, strFinalSearhString, new Guid(Session["CurrentSchoolYearId"].ToString()));
                    if (ds.Tables.Count > 0)
                    {
                        dsReport.Tables["dtAttendance"].Merge(ds.Tables[0]);
                    }
                }
                else
                {
                    rpt.FileName = Server.MapPath("rptStudentAttendanceReport.rpt");
                    DayCareBAL.StaffService proxyAttendance = new DayCareBAL.StaffService();
                    string ReportFor = "";
                    ReportFor = "Student";
                    string SearchText = "";
                    string SearchStr  = "";
                    string SchoolYear = "";
                    if (!String.IsNullOrEmpty(Request.QueryString["StartDate"]) && String.IsNullOrEmpty(Request.QueryString["EndDate"]))
                    {
                        SearchText += " cah.checkincheckoutdatetime>='" + Request.QueryString["StartDate"].ToString() + "'";
                        // SchoolYear += "and csy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'";
                    }

                    else if (String.IsNullOrEmpty(Request.QueryString["StartDate"]) && !String.IsNullOrEmpty(Request.QueryString["EndDate"]))
                    {
                        SearchText += " cah.checkincheckoutdatetime<='" + Request.QueryString["EndDate"].ToString().Replace("00:00:00 PM", "11:59:58") + "'";
                        // SchoolYear += "and csy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'";
                    }
                    else if (!String.IsNullOrEmpty(Request.QueryString["EndDate"]) && !String.IsNullOrEmpty(Request.QueryString["StartDate"]))
                    {
                        SearchText += " cah.checkincheckoutdatetime>='" + Request.QueryString["StartDate"].ToString() + "' and cah.checkincheckoutdatetime<='" + Request.QueryString["EndDate"].ToString().Replace("00:00:00", "11:59:58") + "'";
                        //SchoolYear += "and csy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'";
                    }

                    ds = proxyAttendance.LoadChildAttendanceHistory(SearchText, SearchStr, new Guid(Session["CurrentSchoolYearId"].ToString()));
                    dsReport.Tables["dtAttendance"].Merge(ds.Tables[0]);
                }
                CrystalDecisions.CrystalReports.Engine.TextObject titleText       = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text7"];
                CrystalDecisions.CrystalReports.Engine.TextObject titleTextSchool = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text4"];
                CrystalDecisions.CrystalReports.Engine.TextObject footer          = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["txtfooter"];
                footer.Text = Common.GetSchoolWiseAddress(new Guid(Session["SchoolId"].ToString()));
                if (!String.IsNullOrEmpty(Request.QueryString["StartDate"]) && !String.IsNullOrEmpty(Request.QueryString["EndDate"]))
                {
                    titleText.Text = "Student Attendance Report From " + Convert.ToDateTime(Request.QueryString["StartDate"].ToString()).ToString("MM/dd/yyyy") + " To " + Convert.ToDateTime(Request.QueryString["EndDate"].ToString()).ToString("MM/dd/yyyy");
                }
                titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper();
                if (String.IsNullOrEmpty(Request.QueryString["EndDate"]) && !String.IsNullOrEmpty(Request.QueryString["StartDate"]))
                {
                    titleText.Text = "Student Attendance Report From " + Convert.ToDateTime(Request.QueryString["StartDate"].ToString()).ToString("MM/dd/yyyy");
                }
                titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper();
                if (!String.IsNullOrEmpty(Request.QueryString["EndDate"]) && String.IsNullOrEmpty(Request.QueryString["StartDate"]))
                {
                    titleText.Text = "Student Attendance Report To " + Convert.ToDateTime(Request.QueryString["EndDate"].ToString()).ToString("MM/dd/yyyy");
                }
                titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper();

                rpt1.SetDataSource(dsReport.Tables["dtAttendance"]);
            }

            if (Request.QueryString["RepId"] == "StudentDate")
            {
                rpt.FileName = Server.MapPath("rptStudentAttendanceByDate.rpt");
                DayCareBAL.StaffService proxyAttendance = new DayCareBAL.StaffService();
                string ReportFor = "";
                ReportFor = "Student";
                string SearchText = "";
                string SearchStr  = "";
                string SchoolYear = "";
                if (!String.IsNullOrEmpty(Request.QueryString["StartDate"]) && String.IsNullOrEmpty(Request.QueryString["EndDate"]))
                {
                    SearchText += " cah.checkincheckoutdatetime>='" + Request.QueryString["StartDate"].ToString() + "'";
                    // SchoolYear += "and csy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'";
                }

                else if (String.IsNullOrEmpty(Request.QueryString["StartDate"]) && !String.IsNullOrEmpty(Request.QueryString["EndDate"]))
                {
                    SearchText += " cah.checkincheckoutdatetime<='" + Request.QueryString["EndDate"].ToString().Replace("00:00:00 PM", "11:59:58") + "'";
                    // SchoolYear += "and csy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'";
                }
                else if (!String.IsNullOrEmpty(Request.QueryString["EndDate"]) && !String.IsNullOrEmpty(Request.QueryString["StartDate"]))
                {
                    SearchText += " cah.checkincheckoutdatetime>='" + Request.QueryString["StartDate"].ToString() + "' and cah.checkincheckoutdatetime<='" + Request.QueryString["EndDate"].ToString().Replace("00:00:00", "11:59:58") + "'";
                    //SchoolYear += "and csy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'";
                }

                ds = proxyAttendance.LoadChildAttendanceHistory(SearchText, SearchStr, new Guid(Session["CurrentSchoolYearId"].ToString()));
                dsReport.Tables["dtAttendance"].Merge(ds.Tables[0]);

                CrystalDecisions.CrystalReports.Engine.TextObject titleText       = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text2"];
                CrystalDecisions.CrystalReports.Engine.TextObject titleTextSchool = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text8"];
                CrystalDecisions.CrystalReports.Engine.TextObject footer          = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["txtfooter"];
                footer.Text = Common.GetSchoolWiseAddress(new Guid(Session["SchoolId"].ToString()));
                if (!String.IsNullOrEmpty(Request.QueryString["StartDate"]) && !String.IsNullOrEmpty(Request.QueryString["EndDate"]))
                {
                    titleText.Text = "Student Attendance Report From " + Convert.ToDateTime(Request.QueryString["StartDate"].ToString()).ToString("MM/dd/yyyy") + " To " + Convert.ToDateTime(Request.QueryString["EndDate"].ToString()).ToString("MM/dd/yyyy");
                }
                titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper();
                if (String.IsNullOrEmpty(Request.QueryString["EndDate"]) && !String.IsNullOrEmpty(Request.QueryString["StartDate"]))
                {
                    titleText.Text = "Student Attendance Report From " + Convert.ToDateTime(Request.QueryString["StartDate"].ToString()).ToString("MM/dd/yyyy");
                }
                titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper();
                if (!String.IsNullOrEmpty(Request.QueryString["EndDate"]) && String.IsNullOrEmpty(Request.QueryString["StartDate"]))
                {
                    titleText.Text = "Student Attendance Report To " + Convert.ToDateTime(Request.QueryString["EndDate"].ToString()).ToString("MM/dd/yyyy");
                }
                titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper();
                rpt1.SetDataSource(dsReport.Tables["dtAttendance"]);
            }


            if (Request.QueryString["RepId"] == "StudentClass")
            {
                rpt.FileName = Server.MapPath("rptStudentAttendanceByClassName.rpt");
                DayCareBAL.StaffService proxyAttendance = new DayCareBAL.StaffService();
                string ReportFor = "";
                ReportFor = "Student";
                string SearchText = "";
                string SearchStr  = "";
                string SchoolYear = "";
                if (!String.IsNullOrEmpty(Request.QueryString["StartDate"]) && String.IsNullOrEmpty(Request.QueryString["EndDate"]))
                {
                    SearchText += " cah.checkincheckoutdatetime>='" + Request.QueryString["StartDate"].ToString() + "'";
                    // SchoolYear += "and csy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'";
                }

                else if (String.IsNullOrEmpty(Request.QueryString["StartDate"]) && !String.IsNullOrEmpty(Request.QueryString["EndDate"]))
                {
                    SearchText += " cah.checkincheckoutdatetime<='" + Request.QueryString["EndDate"].ToString().Replace("00:00:00 PM", "11:59:58") + "'";
                    // SchoolYear += "and csy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'";
                }
                else if (!String.IsNullOrEmpty(Request.QueryString["EndDate"]) && !String.IsNullOrEmpty(Request.QueryString["StartDate"]))
                {
                    SearchText += " cah.checkincheckoutdatetime>='" + Request.QueryString["StartDate"].ToString() + "' and cah.checkincheckoutdatetime<='" + Request.QueryString["EndDate"].ToString().Replace("00:00:00", "11:59:58") + "'";
                    //SchoolYear += "and csy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'";
                }

                ds = proxyAttendance.LoadChildAttendanceHistory(SearchText, SearchStr, new Guid(Session["CurrentSchoolYearId"].ToString()));
                dsReport.Tables["dtAttendance"].Merge(ds.Tables[0]);

                CrystalDecisions.CrystalReports.Engine.TextObject titleText       = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text2"];
                CrystalDecisions.CrystalReports.Engine.TextObject titleTextSchool = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text9"];
                CrystalDecisions.CrystalReports.Engine.TextObject footer          = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["txtfooter"];
                footer.Text = Common.GetSchoolWiseAddress(new Guid(Session["SchoolId"].ToString()));
                if (!String.IsNullOrEmpty(Request.QueryString["StartDate"]) && !String.IsNullOrEmpty(Request.QueryString["EndDate"]))
                {
                    titleText.Text = "Student Attendance Report From " + Convert.ToDateTime(Request.QueryString["StartDate"].ToString()).ToString("MM/dd/yyyy") + " To " + Convert.ToDateTime(Request.QueryString["EndDate"].ToString()).ToString("MM/dd/yyyy");
                }
                titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper();
                if (String.IsNullOrEmpty(Request.QueryString["EndDate"]) && !String.IsNullOrEmpty(Request.QueryString["StartDate"]))
                {
                    titleText.Text = "Student Attendance Report From " + Convert.ToDateTime(Request.QueryString["StartDate"].ToString()).ToString("MM/dd/yyyy");
                }
                titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper();
                if (!String.IsNullOrEmpty(Request.QueryString["EndDate"]) && String.IsNullOrEmpty(Request.QueryString["StartDate"]))
                {
                    titleText.Text = "Student Attendance Report To " + Convert.ToDateTime(Request.QueryString["EndDate"].ToString()).ToString("MM/dd/yyyy");
                }
                titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper();

                rpt1.SetDataSource(dsReport.Tables["dtAttendance"]);
            }


            if (Request.QueryString["RepId"] == "StaffDate")
            {
                rpt.FileName = Server.MapPath("rptStaffAttendanceByDate.rpt");
                DayCareBAL.StaffService proxyAttendance = new DayCareBAL.StaffService();

                string ReportFor = "";
                ReportFor = "Staff";
                string SearchText = "";
                string SearchStr  = "";
                string SchoolYear = "";
                if (!String.IsNullOrEmpty(Request.QueryString["StartDate"]) && String.IsNullOrEmpty(Request.QueryString["EndDate"]))
                {
                    SearchText += " sah.checkincheckoutdatetime>='" + Request.QueryString["StartDate"].ToString() + "'";
                    // SchoolYear += "and ssy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'";
                    //
                }

                else if (String.IsNullOrEmpty(Request.QueryString["StartDate"]) && !String.IsNullOrEmpty(Request.QueryString["EndDate"]))
                {
                    SearchText += " sah.checkincheckoutdatetime<='" + Request.QueryString["EndDate"].ToString().Replace("00:00:00 PM", "11:59:58") + "'";
                    // SchoolYear += "and ssy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'";
                }
                else if (!String.IsNullOrEmpty(Request.QueryString["EndDate"]) && !String.IsNullOrEmpty(Request.QueryString["StartDate"]))
                {
                    SearchText += " sah.checkincheckoutdatetime>='" + Request.QueryString["StartDate"].ToString() + "' and sah.checkincheckoutdatetime<='" + Request.QueryString["EndDate"].ToString().Replace("00:00:00", "11:59:58") + "'";
                    //SchoolYear += "and ssy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'";
                }

                ds = proxyAttendance.LoadAttendanceHistory1(SearchText, SearchStr, new Guid(Session["CurrentSchoolYearId"].ToString()));
                dsReport.Tables["dtAttendance"].Merge(ds.Tables[0]);

                CrystalDecisions.CrystalReports.Engine.TextObject titleText       = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text7"];
                CrystalDecisions.CrystalReports.Engine.TextObject titleTextSchool = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text2"];
                CrystalDecisions.CrystalReports.Engine.TextObject footer          = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["txtfooter"];
                footer.Text = Common.GetSchoolWiseAddress(new Guid(Session["SchoolId"].ToString()));
                if (!String.IsNullOrEmpty(Request.QueryString["StartDate"]) && !String.IsNullOrEmpty(Request.QueryString["EndDate"]))
                {
                    titleText.Text = "Staff Attendance Report From " + Convert.ToDateTime(Request.QueryString["StartDate"].ToString()).ToString("MM/dd/yyyy") + " To " + Convert.ToDateTime(Request.QueryString["EndDate"].ToString()).ToString("MM/dd/yyyy");
                }
                titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper();
                if (String.IsNullOrEmpty(Request.QueryString["EndDate"]) && !String.IsNullOrEmpty(Request.QueryString["StartDate"]))
                {
                    titleText.Text = "Staff Attendance Report From " + Convert.ToDateTime(Request.QueryString["StartDate"].ToString()).ToString("MM/dd/yyyy");
                }
                titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper();
                if (!String.IsNullOrEmpty(Request.QueryString["EndDate"]) && String.IsNullOrEmpty(Request.QueryString["StartDate"]))
                {
                    titleText.Text = "Staff Attendance Report To " + Convert.ToDateTime(Request.QueryString["EndDate"].ToString()).ToString("MM/dd/yyyy");
                }
                titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper();

                rpt1.SetDataSource(dsReport.Tables["dtAttendance"]);
            }
            crp.DisplayGroupTree = false;
            crp.ReportSource     = rpt1;
            crp.RefreshReport();

            crp.DataBind();
            #endregion
        }
Ejemplo n.º 8
0
        protected void Page_Init(object sender, EventArgs e)
        {
            if (Session["CurrentSchoolYearId"] == null)
            {
                Response.Redirect("~/Login.aspx");
            }

            crdata.Report = rpt;
            rpt1          = crdata.ReportDocument;

            DataSet dsReport = new xmlClassWiseStudentAttendTime();
            DataSet ds       = new DataSet();

            // crp.AfterRender += this.crp_AfterRender;

            if (!String.IsNullOrEmpty(Request.QueryString["ClassRoomId"]) && !String.IsNullOrEmpty(Request.QueryString["RepId"]))
            {
                if (Convert.ToString(Request.QueryString["RepId"]).Equals("ClassWiseStudent"))
                {
                    rpt.FileName = Server.MapPath("rptClassroomWiseStudent.rpt");
                }
                if (Convert.ToString(Request.QueryString["RepId"]).Equals("ClassWiseStudentWithFee"))
                {
                    rpt.FileName = Server.MapPath("rptClassroomWiseStudentWithFee.rpt");
                }
                DayCareBAL.ClassRoomService proxy = new DayCareBAL.ClassRoomService();
                CrystalDecisions.CrystalReports.Engine.TextObject titleText       = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text3"];
                CrystalDecisions.CrystalReports.Engine.TextObject titleTextSchool = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text1"];
                CrystalDecisions.CrystalReports.Engine.TextObject footer          = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["txtfooter"];
                footer.Text = Common.GetSchoolWiseAddress(new Guid(Session["SchoolId"].ToString()));
                //CrystalDecisions.CrystalReports.Engine.TextObject titleText4 = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text4"];
                //titleText4.Text = ViewState["title"].ToString();
                //titleText.Text = "Class room wise student list report";

                if (Convert.ToString(Request.QueryString["RepId"]).Equals("ClassWiseStudent"))
                {
                    titleText.Text = "Student list by class report";
                }
                if (Convert.ToString(Request.QueryString["RepId"]).Equals("ClassWiseStudentWithFee"))
                {
                    titleText.Text = "Student fees by class report";
                }
                titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper();
                ds = proxy.GetClassroomWiseStudentWeeklySchedule(new Guid(Request.QueryString["ClassRoomId"].ToString()), new Guid(Session["CurrentSchoolYearId"].ToString()));
                dsReport.Tables["dtClassWiseStudent"].Merge(ds.Tables[0]);
                rpt1.SetDataSource(dsReport.Tables["dtClassWiseStudent"]);
            }
            if (!String.IsNullOrEmpty(Request.QueryString["ProgramId"]) && !String.IsNullOrEmpty(Request.QueryString["RepId"]))
            {
                if (Convert.ToString(Request.QueryString["RepId"]).Equals("ProgramWiseStudent"))
                {
                    rpt.FileName = Server.MapPath("rptProgramWiseStudentWeeklySchedule.rpt");
                }
                if (Convert.ToString(Request.QueryString["RepId"]).Equals("ProgramWiseStudentWithFee"))
                {
                    rpt.FileName = Server.MapPath("rptProgramWiseStudentWeeklyScheduleWithFee.rpt");
                }
                DayCareBAL.SchoolProgramService proxy = new DayCareBAL.SchoolProgramService();
                CrystalDecisions.CrystalReports.Engine.TextObject titleText       = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text13"];
                CrystalDecisions.CrystalReports.Engine.TextObject titleTextSchool = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text10"];
                CrystalDecisions.CrystalReports.Engine.TextObject footer          = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["txtfooter"];
                footer.Text = Common.GetSchoolWiseAddress(new Guid(Session["SchoolId"].ToString()));
                // titleText.Text = "Program wise student list report";

                if (Convert.ToString(Request.QueryString["RepId"]).Equals("ProgramWiseStudent"))
                {
                    titleText.Text = "Student list by Program report";
                }
                if (Convert.ToString(Request.QueryString["RepId"]).Equals("ProgramWiseStudentWithFee"))
                {
                    titleText.Text = "Student fees by Program report";
                }

                titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper();
                ds = proxy.GetSchoolProgramWiseStudentWeeklySchedule(new Guid(Session["CurrentSchoolYearId"].ToString()), new Guid(Request.QueryString["ProgramId"].ToString()));
                dsReport.Tables["dtProgramWiseStudent"].Merge(ds.Tables[0]);
                rpt1.SetDataSource(dsReport.Tables["dtProgramWiseStudent"]);
            }



            crp.DisplayGroupTree = false;
            crp.ReportSource     = rpt1;
            crp.RefreshReport();

            crp.DataBind();
        }
        protected void Page_Init(object sender, EventArgs e)
        {
            try
            {
                if (Session["SchoolId"] == null || Session["CurrentSchoolYearId"] == null)
                {
                    Response.Redirect("~/Login.aspx");
                }
                crdata.Report = rpt;
                rpt1          = crdata.ReportDocument;
                string  SearchText    = "";
                Guid    ChildFamilyId = new Guid();
                DataSet dsReport      = new xmlClassWiseStudentAttendTime();
                DataSet ds            = new DataSet();

                if (!String.IsNullOrEmpty(Request.QueryString["ChildFamilyId"]))
                {
                    ChildFamilyId = new Guid(Request.QueryString["ChildFamilyId"].ToString());
                }
                if (!String.IsNullOrEmpty(Request.QueryString["StartDate"]) && String.IsNullOrEmpty(Request.QueryString["EndDate"]))
                {
                    SearchText += " transactiondate>='" + Request.QueryString["StartDate"].ToString() + "'";
                }
                if (String.IsNullOrEmpty(Request.QueryString["StartDate"]) && !String.IsNullOrEmpty(Request.QueryString["EndDate"]))
                {
                    SearchText += " transactiondate<='" + Request.QueryString["EndDate"].ToString().Replace("00:00:00 AM", "11:59:58 PM") + " '";
                }
                else if (!String.IsNullOrEmpty(Request.QueryString["EndDate"]) && !String.IsNullOrEmpty(Request.QueryString["StartDate"]))
                {
                    SearchText += "  transactiondate>='" + Request.QueryString["StartDate"].ToString() + "' and transactiondate<='" + Request.QueryString["EndDate"].ToString().Replace("00:00:00 AM", "11:59:58 PM") + "'";
                }

                rpt.FileName = Server.MapPath("rptLateFeesReport.rpt");
                DayCareBAL.LedgerService proxy = new DayCareBAL.LedgerService();
                string StartDate = string.Empty;
                string EndDate   = string.Empty;
                if (Request.QueryString["StartDate"] != "")
                {
                    StartDate = Convert.ToDateTime(Request.QueryString["StartDate"].ToString()).ToString("MM/dd/yyyy");
                }
                if (Request.QueryString["EndDate"] != "")
                {
                    EndDate = Convert.ToDateTime(Request.QueryString["EndDate"].ToString()).ToString("MM/dd/yyyy");
                }
                CrystalDecisions.CrystalReports.Engine.TextObject titleText       = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text4"];
                CrystalDecisions.CrystalReports.Engine.TextObject titleTextSchool = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text3"];
                CrystalDecisions.CrystalReports.Engine.TextObject footer          = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["txtfooter"];
                footer.Text          = Common.GetSchoolWiseAddress(new Guid(Session["SchoolId"].ToString()));
                titleText.Text       = "Late Fee Report From " + StartDate + " To " + EndDate;
                titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper();
                ds = proxy.GetFamilyWiseLateFeesReport(new Guid(Session["SchoolId"].ToString()), new Guid(Session["CurrentSchoolYearId"].ToString()), ChildFamilyId, SearchText);
                dsReport.Tables["dtLateFees"].Merge(ds.Tables[0]);
                rpt1.SetDataSource(dsReport.Tables["dtLateFees"]);

                crp.DisplayGroupTree = false;
                crp.ReportSource     = rpt1;
                crp.RefreshReport();

                crp.DataBind();
            }
            catch (Exception ex)
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.rptFamilyWiseLateFeesReport, "Page_Init", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
            }
        }