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 btnTopSave_Click(object sender, EventArgs e) { try { DayCareBAL.LedgerService proxyLedger = new DayCareBAL.LedgerService(); DayCarePL.LedgerProperties objLedger = new DayCarePL.LedgerProperties(); List <DayCarePL.LedgerProperties> lstLedger = new List <DayCarePL.LedgerProperties>(); if (Session["CurrentSchoolYearId"] == null) { return; } foreach (GridDataItem e1 in rgLateFee.MasterTableView.Items) { if (!string.IsNullOrEmpty((e1.FindControl("txtFamilyLateFee") as TextBox).Text.Trim())) { objLedger = new DayCarePL.LedgerProperties(); objLedger.SchoolYearId = new Guid(Session["CurrentSchoolYearId"].ToString()); objLedger.ChildFamilyId = new Guid(e1.GetDataKeyValue("Id").ToString()); objLedger.TransactionDate = DateTime.Now; objLedger.Debit = Convert.ToDecimal((e1.FindControl("txtFamilyLateFee") as TextBox).Text.Trim()); objLedger.Credit = 0; objLedger.Comment = "Late Fee Charged"; objLedger.LateFee = 1; objLedger.CreatedDateTime = DateTime.Now; objLedger.LastModifiedDatetime = DateTime.Now; if (Session["StaffId"] != null) { objLedger.CreatedById = new Guid(Session["StaffId"].ToString()); objLedger.LastModifiedById = new Guid(Session["StaffId"].ToString()); } lstLedger.Add(objLedger); } } if (lstLedger != null && lstLedger.Count > 0) { if (proxyLedger.SaveLateFeeOfFamily(lstLedger)) { MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Saved Successfully", "false")); txtLateCharge.Text = ""; BindGrid(); } else { MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Internal Error", "false")); } } } catch (Exception ex) { DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.LateFee, "btnSave_Click", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT); } }
protected void rgLedger_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e) { DayCareBAL.LedgerService proxyLedger = new DayCareBAL.LedgerService(); List <DayCarePL.LedgerProperties> lstLeger = proxyLedger.LoadLedgerDetail(new Guid(Session["CurrentSchoolYearId"].ToString()), new Guid(ViewState["ChildFamilyId"].ToString())); if (lstLeger != null) { rgLedger.DataSource = lstLeger; txtBalance.Text = (lstLeger.Sum(i => i.Debit) - lstLeger.Sum(i => i.Credit)).ToString(); txtYTDPay.Text = lstLeger.Sum(i => i.Credit).ToString(); } }
protected void rgLedger_DeleteCommand(object source, GridCommandEventArgs e) { DayCareBAL.LedgerService proxyLedgerdelete = new DayCareBAL.LedgerService(); //DayCarePL.LedgerProperties objTest = e.Item.DataItem as DayCarePL.LedgerProperties; Guid Id = new Guid(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"].ToString()); if (proxyLedgerdelete.DeleteLedger(Id)) { MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Deleted Successfully", "false")); rgLedger.MasterTableView.Rebind(); } }
public static void BindChargeCode(DropDownList ddlChargeCode) { try { DayCareBAL.LedgerService objLedger = new DayCareBAL.LedgerService(); ddlChargeCode.DataSource = objLedger.LoadChargeCode(); ddlChargeCode.DataTextField = "CategoryName"; ddlChargeCode.DataValueField = "Id"; ddlChargeCode.DataBind(); ddlChargeCode.Items.Insert(0, new ListItem("--Select--", "00000000-0000-0000-0000-000000000000")); } catch (Exception ex) { } }
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); } }
public void BindGrid() { if (Session["SchoolId"] == null || Session["CurrentSchoolYearId"] == null) { Response.Redirect("~/Login.aspx"); } if (!string.IsNullOrEmpty(txtBlance.Text)) { DayCareBAL.LedgerService proxyLedger = new DayCareBAL.LedgerService(); List <DayCarePL.ChildFamilyProperties> lstLedger = proxyLedger.GetLateFeeofFamilies(new Guid(Session["SchoolId"].ToString()), new Guid(Session["CurrentSchoolYearId"].ToString()), Convert.ToDecimal(txtBlance.Text)); if (lstLedger != null) { rgLateFee.DataSource = lstLedger; if (lstLedger.Count > 0) { btnTopSave.Visible = true; btnBottomSave.Visible = true; } //txtLateCharge.Text = ""; } rgLateFee.DataBind(); } }
// Same function is place on Common.cs which is call in LateFee, Payment, Ledger, AddEditchild public void GetChildProgEnrollmentFeeDetail(Guid SchoolYearId) { DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.Ledger, "GetChildProgEnrollmentFeeDetail", "GetChildProgEnrollmentFeeDetail method called", DayCarePL.Common.GUID_DEFAULT); try { DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.Ledger, "GetChildProgEnrollmentFeeDetail", "Debug GetChildProgEnrollmentFeeDetail called", DayCarePL.Common.GUID_DEFAULT); DayCareBAL.LedgerService proxyLedger = new DayCareBAL.LedgerService(); List <DayCarePL.ChildProgEnrollmentProperties> lstChildProgEnrollmentFeeDetail = proxyLedger.GetChildProgEnrollmentFeeDetail(SchoolYearId, new Guid(DayCarePL.Common.GUID_DEFAULT)); if (lstChildProgEnrollmentFeeDetail != null) { bool result = false; List <DayCarePL.LedgerProperties> lstChildEnrollForLedger = new List <DayCarePL.LedgerProperties>(); DayCarePL.LedgerProperties objChildEnrollForLedger = null; foreach (DayCarePL.ChildProgEnrollmentProperties objChildProgEnrollmentFeeDetail in lstChildProgEnrollmentFeeDetail) { string strDay = ""; DateTime StartDate = DateTime.Now, EndDate = DateTime.Now; if (objChildProgEnrollmentFeeDetail.StartDate != null) { StartDate = objChildProgEnrollmentFeeDetail.StartDate.Value; } if (objChildProgEnrollmentFeeDetail.EndDate != null) { EndDate = objChildProgEnrollmentFeeDetail.EndDate.Value; } objChildEnrollForLedger = new DayCarePL.LedgerProperties(); #region Weekly switch (objChildProgEnrollmentFeeDetail.EffectiveWeekDay) { case 1: { strDay = "Monday"; break; } case 2: { strDay = "Tuesday"; break; } case 3: { strDay = "Wednesday"; break; } case 4: { strDay = "Thursday"; break; } case 5: { strDay = "Friday"; break; } } if (objChildProgEnrollmentFeeDetail.EffectiveWeekDay != null && objChildProgEnrollmentFeeDetail.EffectiveWeekDay != 0) { DateTime?OldDate = proxyLedger.GetLastTransactionDate(SchoolYearId, objChildProgEnrollmentFeeDetail.ChildFamilyId, objChildProgEnrollmentFeeDetail.ChildDataId, objChildProgEnrollmentFeeDetail.SchoolProgramId); if (OldDate != null) { DateTime LastDate = OldDate.Value; if (LastDate.Equals(new DateTime())) { LastDate = StartDate; } //else //{ // LastDate = LastDate.AddDays(7); //} while (LastDate.Date <= DateTime.Now.Date && LastDate.Date <= EndDate.Date) { if (LastDate.DayOfWeek.ToString().ToLower().Equals(strDay.ToLower())) { break; } LastDate = LastDate.AddDays(1); } DateTime TranDate; if (!LastDate.Equals(new DateTime())) { while (LastDate.Date <= DateTime.Now.Date && LastDate.Date <= EndDate.Date) { DateTime.TryParse(LastDate.Month + "/" + LastDate.Day + "/" + LastDate.Year, out TranDate); if (TranDate.Equals(new DateTime())) { TranDate = new DateTime(LastDate.Year, LastDate.Month, System.DateTime.DaysInMonth(LastDate.Year, LastDate.Month)); } if (!TranDate.Equals(new DateTime()) && TranDate.Date <= System.DateTime.Now.Date && TranDate.Date <= EndDate.Date && !OldDate.Value.Date.Equals(LastDate.Date) && TranDate.Date >= StartDate.Date) { objChildEnrollForLedger = new DayCarePL.LedgerProperties(); objChildEnrollForLedger.TransactionDate = TranDate + DateTime.Now.TimeOfDay; objChildEnrollForLedger.Comment = objChildProgEnrollmentFeeDetail.ProgramTitle + " " + objChildProgEnrollmentFeeDetail.FeesPeriodName;// +" " + strDay; //objChildEnrollForLedger.Detail = objChildProgEnrollmentFeeDetail.ProgramTitle + " " + objChildProgEnrollmentFeeDetail.FeesPeriodName + " " + strDay; SetLegderProperties(SchoolYearId, lstChildEnrollForLedger, objChildEnrollForLedger, objChildProgEnrollmentFeeDetail); } LastDate = TranDate.AddDays(7); } } } } #endregion #region Monthly if (objChildProgEnrollmentFeeDetail.EffectiveMonthDay != null)// && objChildProgEnrollmentFeeDetail.EffectiveMonthDay.Equals(DateTime.Now.Month)) { DateTime?OldDate = proxyLedger.GetLastTransactionDate(SchoolYearId, objChildProgEnrollmentFeeDetail.ChildFamilyId, objChildProgEnrollmentFeeDetail.ChildDataId, objChildProgEnrollmentFeeDetail.SchoolProgramId); if (OldDate != null) { DateTime LastDate = OldDate.Value; if (LastDate.Equals(new DateTime())) { LastDate = StartDate; } //else //{ // LastDate = LastDate.AddMonths(1); //} DateTime TranDate; if (!LastDate.Equals(new DateTime())) { while (LastDate.Date <= DateTime.Now.Date && LastDate.Date <= EndDate.Date) { DateTime.TryParse(LastDate.Month + "/" + objChildProgEnrollmentFeeDetail.EffectiveMonthDay.Value + "/" + LastDate.Year, out TranDate); if (TranDate.Equals(new DateTime())) { TranDate = new DateTime(LastDate.Year, LastDate.Month, System.DateTime.DaysInMonth(LastDate.Year, LastDate.Month)); } if (!TranDate.Equals(new DateTime()) && TranDate.Date <= System.DateTime.Now.Date && TranDate.Date <= EndDate.Date && !OldDate.Value.Date.Equals(LastDate.Date) && TranDate.Date >= StartDate.Date) { objChildEnrollForLedger = new DayCarePL.LedgerProperties(); objChildEnrollForLedger.TransactionDate = TranDate + DateTime.Now.TimeOfDay; objChildEnrollForLedger.Comment = objChildProgEnrollmentFeeDetail.ProgramTitle + " " + objChildProgEnrollmentFeeDetail.FeesPeriodName;// + " " + objChildEnrollForLedger.TransactionDate.ToShortDateString(); //objChildEnrollForLedger.Detail = objChildProgEnrollmentFeeDetail.ProgramTitle + " " + objChildProgEnrollmentFeeDetail.FeesPeriodName + " " + objChildEnrollForLedger.TransactionDate.ToShortDateString(); SetLegderProperties(SchoolYearId, lstChildEnrollForLedger, objChildEnrollForLedger, objChildProgEnrollmentFeeDetail); } LastDate = TranDate.AddMonths(1); } } } } #endregion #region Yearly if (objChildProgEnrollmentFeeDetail.EffectiveYearDate != null)// && objChildProgEnrollmentFeeDetail.EffectiveYearDate.Value. { DateTime?OldDate = proxyLedger.GetLastTransactionDate(SchoolYearId, objChildProgEnrollmentFeeDetail.ChildFamilyId, objChildProgEnrollmentFeeDetail.ChildDataId, objChildProgEnrollmentFeeDetail.SchoolProgramId); if (OldDate != null) { DateTime LastDate = OldDate.Value; if (LastDate.Equals(new DateTime())) { LastDate = StartDate; } //else //{ // LastDate = LastDate.AddYears(1); //} DateTime TranDate; if (!LastDate.Equals(new DateTime())) { while (LastDate.Date <= System.DateTime.Now.Date && LastDate.Date <= EndDate.Date) { DateTime.TryParse(objChildProgEnrollmentFeeDetail.EffectiveYearDate.Value.Month + "/" + objChildProgEnrollmentFeeDetail.EffectiveYearDate.Value.Day + "/" + LastDate.Year, out TranDate); if (!TranDate.Equals(new DateTime()) && TranDate.Date <= System.DateTime.Now.Date && TranDate.Date <= EndDate.Date && !OldDate.Value.Date.Equals(LastDate.Date) && TranDate.Date >= StartDate.Date) { objChildEnrollForLedger = new DayCarePL.LedgerProperties(); objChildEnrollForLedger.TransactionDate = TranDate + DateTime.Now.TimeOfDay; objChildEnrollForLedger.Comment = objChildProgEnrollmentFeeDetail.ProgramTitle + " " + objChildProgEnrollmentFeeDetail.FeesPeriodName;// + " " + objChildEnrollForLedger.TransactionDate.ToShortDateString(); //objChildEnrollForLedger.Detail = objChildProgEnrollmentFeeDetail.ProgramTitle + " " + objChildProgEnrollmentFeeDetail.FeesPeriodName + " " + objChildEnrollForLedger.TransactionDate.ToShortDateString(); SetLegderProperties(SchoolYearId, lstChildEnrollForLedger, objChildEnrollForLedger, objChildProgEnrollmentFeeDetail); } LastDate = TranDate.AddYears(1); } } } } #endregion #region One Time if (objChildProgEnrollmentFeeDetail.EffectiveMonthDay == null && (objChildProgEnrollmentFeeDetail.EffectiveWeekDay == null || objChildProgEnrollmentFeeDetail.EffectiveWeekDay == 0) && objChildProgEnrollmentFeeDetail.EffectiveYearDate == null) { DateTime?OldDate = proxyLedger.GetLastTransactionDate(SchoolYearId, objChildProgEnrollmentFeeDetail.ChildFamilyId, objChildProgEnrollmentFeeDetail.ChildDataId, objChildProgEnrollmentFeeDetail.SchoolProgramId); if (OldDate != null) { DateTime LastDate = OldDate.Value; if (LastDate.Equals(new DateTime())) { LastDate = StartDate; } //else //{ // LastDate = LastDate.AddMonths(1); //} if (!LastDate.Equals(new DateTime())) { if (LastDate.Date <= DateTime.Now.Date) { if (OldDate.Value.Equals(new DateTime())) { objChildEnrollForLedger = new DayCarePL.LedgerProperties(); objChildEnrollForLedger.TransactionDate = LastDate.Date + DateTime.Now.TimeOfDay; objChildEnrollForLedger.Comment = objChildProgEnrollmentFeeDetail.ProgramTitle + " " + objChildProgEnrollmentFeeDetail.FeesPeriodName;// + " " + objChildEnrollForLedger.TransactionDate.ToShortDateString(); //objChildEnrollForLedger.Detail = objChildProgEnrollmentFeeDetail.ProgramTitle + " " + objChildProgEnrollmentFeeDetail.FeesPeriodName + " " + objChildEnrollForLedger.TransactionDate.ToShortDateString(); SetLegderProperties(SchoolYearId, lstChildEnrollForLedger, objChildEnrollForLedger, objChildProgEnrollmentFeeDetail); } } } } } #endregion } if (lstChildEnrollForLedger != null && lstChildEnrollForLedger.Count > 0) { result = proxyLedger.Save(lstChildEnrollForLedger); } } } catch (Exception ex) { DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.LedgerOfFamily, "GetChildProgEnrollmentFeeDetail", 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(); 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(); }
protected void btnEditAll_Click(object sender, EventArgs e) { DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.Ledger, "btnDeleteAll_Click", "btnDeleteAll_Click called", DayCarePL.Common.GUID_DEFAULT); try { DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.Ledger, "btnDeleteAll_Click", "Debug btnDeleteAll_Click called", DayCarePL.Common.GUID_DEFAULT); DayCareBAL.LedgerService proxySave = new DayCareBAL.LedgerService(); DayCarePL.LedgerProperties objLedger = new DayCarePL.LedgerProperties(); List <DayCarePL.LedgerProperties> lstLeger = new List <DayCarePL.LedgerProperties>(); foreach (GridDataItem e1 in rgLedger.MasterTableView.Items) { CheckBox chkDelete = e1.FindControl("chkDelete") as CheckBox; if (chkDelete != null) { if (chkDelete.Checked) { objLedger = new DayCarePL.LedgerProperties(); objLedger.Id = new Guid(e1.GetDataKeyValue("Id").ToString()); objLedger.TransactionDate = Convert.ToDateTime((e1.FindControl("rdpDate") as RadDatePicker).SelectedDate); objLedger.AllowEdit = (e1.FindControl("rdpDate") as RadDatePicker).Enabled; objLedger.FamilyName = (e1.FindControl("txtFamilyName") as TextBox).Text; if (!string.IsNullOrEmpty((e1.FindControl("txtDebit") as TextBox).Text)) { objLedger.Debit = Convert.ToDecimal((e1.FindControl("txtDebit") as TextBox).Text); } else { objLedger.Debit = 0; } if (!string.IsNullOrEmpty((e1.FindControl("txtCredit") as TextBox).Text)) { objLedger.Credit = Convert.ToDecimal((e1.FindControl("txtCredit") as TextBox).Text); } else { objLedger.Credit = 0; } objLedger.Comment = (e1.FindControl("txtComment") as TextBox).Text; if ((e1.FindControl("rdbPayment") as RadioButton).Visible) { if ((e1.FindControl("rdbPayment") as RadioButton).Checked) { objLedger.PaymentMethodId = Convert.ToInt16((e1.FindControl("ddlPayment") as DropDownList).SelectedValue); } else { objLedger.ChargeCodeCategoryId = new Guid((e1.FindControl("ddlCategory") as DropDownList).SelectedValue); } } if (ViewState["ChildFamilyId"] != null) { objLedger.ChildFamilyId = new Guid(ViewState["ChildFamilyId"].ToString()); } if (Session["CurrentSchoolYearId"] != null) { objLedger.SchoolYearId = new Guid(Session["CurrentSchoolYearId"].ToString()); } if (Session["StaffId"] != null) { objLedger.LastModifiedById = new Guid(Session["StaffId"].ToString()); } lstLeger.Add(objLedger); } } } if (lstLeger != null && lstLeger.Count > 0) { DayCareBAL.LedgerService proxyLedger = new DayCareBAL.LedgerService(); if (proxyLedger.EditAllLedger(lstLeger)) { MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Saved Successfully", "false")); } rgLedger.MasterTableView.Rebind(); rgLedger.MasterTableView.CurrentPageIndex = 0; } } catch (Exception ex) { DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.Ledger, "btnDeleteAll_Click", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT); } }
protected void btnSave_Click(object sender, EventArgs e) { DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.ChildData, "btnSave_Click", "Submit btnSave_Click called", DayCarePL.Common.GUID_DEFAULT); try { string Amount = ""; DayCareBAL.LedgerService proxySaveLedger = new DayCareBAL.LedgerService(); DayCarePL.LedgerProperties objLedger = new DayCarePL.LedgerProperties(); if (Session["StaffId"] != null) { objLedger.CreatedById = new Guid(Session["StaffId"].ToString()); } objLedger.TransactionDate = Convert.ToDateTime(rdpDate.SelectedDate); Amount = txtAmount.Text.Trim(); if (!string.IsNullOrEmpty(Amount)) { decimal amountresult = 0; decimal.TryParse(Amount, out amountresult); if (amountresult == 0) { objLedger.Debit = amountresult; MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Pease enter valid Fees.", "false")); } else { if (ddlCategory.SelectedItem.Text.Contains("-Debit")) { objLedger.Debit = amountresult; } else { objLedger.Credit = amountresult; } } } objLedger.Detail = ddlCategory.SelectedItem.ToString(); if (ViewState["ChildFamilyId"] != null) { objLedger.ChildFamilyId = new Guid(ViewState["ChildFamilyId"].ToString()); } if (Session["CurrentSchoolYearId"] != null) { objLedger.SchoolYearId = new Guid(Session["CurrentSchoolYearId"].ToString()); } objLedger.AllowEdit = true; if (proxySaveLedger.SaveLedger(objLedger)) { MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Saved Successfully", "false")); rgLedger.MasterTableView.Rebind(); rdpDate.SelectedDate = null; ddlCategory.SelectedValue = null; txtAmount.Text = ""; } } catch (Exception ex) { DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.ChildData, "btnSave_Click", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT); MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Internal Error,Please try again.", "false")); } }
protected void rgLedger_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e) { DayCareBAL.LedgerService proxyLedger = new DayCareBAL.LedgerService(); rgLedger.DataSource = proxyLedger.LoadLedgerDetail(new Guid(Session["CurrentSchoolYearId"].ToString())); }
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); } }