public static DayCarePL.LedgerProperties LoadChildFamilyWiseTranDateAmount(Guid ChildFamilyId) { DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.clLedgerOfFamily, "LoadChildFamilyWiseTranDateAmount", "Execute LoadChildFamilyWiseTranDateAmount Method", DayCarePL.Common.GUID_DEFAULT); clConnection.DoConnection(); DayCareDataContext db = new DayCareDataContext(); try { DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.clLedgerOfFamily, "LoadChildFamilyWiseTranDateAmount", "Debug LoadChildFamilyWiseTranDateAmount Method", DayCarePL.Common.GUID_DEFAULT); DayCarePL.LedgerProperties data = (from l in db.Ledgers where l.LateFee.Equals(1) && l.ChildFamilyId.Equals(ChildFamilyId) orderby l.TransactionDate descending select new DayCarePL.LedgerProperties() { Id = l.Id, Debit = l.Debit, TransactionDate = l.TransactionDate }).FirstOrDefault(); return(data); } catch (Exception ex) { DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.clLedgerOfFamily, "LoadChildFamilyWiseTranDateAmount", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT); return(null); } }
protected void rgTest_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) { if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem) { DayCareBAL.TestService proxyLedgerdelete = new DayCareBAL.TestService(); DayCarePL.LedgerProperties objTest = e.Item.DataItem as DayCarePL.LedgerProperties; //List<DayCarePL.LedgerProperties> lstTest = proxyTest.LoadLedgerDetail(new Guid(Session["CurrentSchoolYearId"].ToString())); if (objTest != null) { lblFamilyTitle.Text = objTest.FamilyName; ViewState["ChildFamilyId"] = objTest.ChildFamilyId; if (objTest.AllowEdit == false) { if (e.Item is GridDataItem) { GridEditableItem dataItem = e.Item as Telerik.Web.UI.GridEditableItem; // ImageButton editButton = (ImageButton)item.FindControl("DeleteColumn"); ImageButton deleteButton = dataItem["DeleteColumn"].Controls[0] as ImageButton; deleteButton.Visible = false; } } if (objTest.AllowEdit == true) { if (e.Item is GridDataItem) { GridEditableItem dataItem = e.Item as Telerik.Web.UI.GridEditableItem; // ImageButton editButton = (ImageButton)item.FindControl("DeleteColumn"); ImageButton deleteButton = dataItem["DeleteColumn"].Controls[0] as ImageButton; deleteButton.Visible = true; } } } } }
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 = ""; bool result = false; DayCareBAL.TestService proxySaveLedger = new DayCareBAL.TestService(); 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")); rgTest.MasterTableView.Rebind(); } else { objLedger.Debit = 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")); result = true; 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")); } }
public static bool Save(DayCarePL.LedgerProperties objLedger) { DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.clLedgerOfFamily, "Save", "Execute Save Method", DayCarePL.Common.GUID_DEFAULT); clConnection.DoConnection(); DayCareDataContext db = new DayCareDataContext(); Ledger DBLedger = null; try { DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.clLedgerOfFamily, "Save", "Debug Save Method", DayCarePL.Common.GUID_DEFAULT); if (objLedger.Id.ToString().Equals(DayCarePL.Common.GUID_DEFAULT)) { DBLedger = new Ledger(); DBLedger.Id = Guid.NewGuid(); DBLedger.CreatedById = objLedger.CreatedById; DBLedger.CreatedDateTime = DateTime.Now; } else { DBLedger = db.Ledgers.FirstOrDefault(i => i.Id.Equals(objLedger.Id)); } DBLedger.SchoolYearId = objLedger.SchoolYearId; DBLedger.ChildFamilyId = objLedger.ChildFamilyId; DBLedger.TransactionDate = objLedger.TransactionDate; DBLedger.Debit = objLedger.Debit; DBLedger.Credit = 0; DBLedger.Balance = objLedger.Debit - objLedger.Credit; DBLedger.AllowEdit = false; DBLedger.Comment = objLedger.Comment; DBLedger.LateFee = objLedger.LateFee; // 1. LateFee 0. No Late Fee DBLedger.LastModifiedById = objLedger.LastModifiedById; DBLedger.LastModifiedDatetime = DateTime.Now; if (objLedger.Id.ToString().Equals(DayCarePL.Common.GUID_DEFAULT)) { db.Ledgers.InsertOnSubmit(DBLedger); } db.SubmitChanges(); try { //update closing balance on 10 May 2013 By Akash Guid SchoolId = clSchool.GetSchoolIdbySchoolYearId(objLedger.SchoolYearId.Value); if (clSchoolYear.IsSelectedYearPrevYearORNot(SchoolId, objLedger.SchoolYearId.Value))//only prev year can only allow to edit closing balance. because in current year or in future year closing balance is not genrated in these year { clSchoolYear.UpdateClosingBalance(SchoolId, objLedger.SchoolYearId.Value, objLedger.ChildFamilyId); } //end } catch { } return(true); } catch (Exception ex) { DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.clLedgerOfFamily, "Save", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT); return(false); } }
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); } }
public void GetChildFamilyDetails(Guid ChildFammilyId) { DayCareBAL.LedgerOfFamilyService ProxyLedger = new DayCareBAL.LedgerOfFamilyService(); DayCarePL.LedgerProperties objLedger = ProxyLedger.LoadChildFamilyWiseTranDateAmount(ChildFammilyId); if (objLedger != null) { lblMessage.Text = "Late fee charged on " + objLedger.TransactionDate.ToShortDateString() + ", $" + objLedger.Debit; } else { lblMessage.Text = "No late fee charge found"; } }
protected void rgLedger_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) { if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem) { DayCarePL.LedgerProperties objLedger = e.Item.DataItem as DayCarePL.LedgerProperties; Label lblBalance = e.Item.FindControl("lblBalance") as Label; if (objLedger != null) { //lblFamilyTitle.Text = objLedger.FamilyName; ViewState["ChildFamilyId"] = objLedger.ChildFamilyId; if (objLedger.AllowEdit == false) { if (e.Item is GridDataItem) { GridEditableItem dataItem = e.Item as Telerik.Web.UI.GridEditableItem; // ImageButton editButton = (ImageButton)item.FindControl("DeleteColumn"); ImageButton deleteButton = dataItem["DeleteColumn"].Controls[0] as ImageButton; deleteButton.Visible = false; } } if (objLedger.AllowEdit == true) { if (e.Item is GridDataItem) { GridEditableItem dataItem = e.Item as Telerik.Web.UI.GridEditableItem; // ImageButton editButton = (ImageButton)item.FindControl("DeleteColumn"); ImageButton deleteButton = dataItem["DeleteColumn"].Controls[0] as ImageButton; deleteButton.Visible = true; } } if (objLedger.Debit > 0) { Balance += objLedger.Debit; } else { Balance -= objLedger.Credit; YTDPay += objLedger.Credit; } lblBalance.Text = Balance.ToString(); txtBalance.Text = Balance.ToString(); txtYTDPay.Text = YTDPay.ToString(); } } }
protected void btnSave_Click(object sender, EventArgs e) { try { DayCareBAL.LedgerOfFamilyService proxyLedger = new DayCareBAL.LedgerOfFamilyService(); DayCarePL.LedgerProperties objLedger = new DayCarePL.LedgerProperties(); if (Session["CurrentSchoolYearId"] == null) { return; } objLedger.SchoolYearId = new Guid(Session["CurrentSchoolYearId"].ToString()); if (ViewState["ChildFamilyId"] != null) { objLedger.ChildFamilyId = new Guid(ViewState["ChildFamilyId"].ToString()); } objLedger.TransactionDate = DateTime.Now; objLedger.Debit = Convert.ToDecimal(txtLateFee.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()); } if (proxyLedger.Save(objLedger)) { lblscript.Text = "<script>CloseOnReload()</" + "script>"; //lblscript.Text = "<script>ParentReload()</" + "script>"; } else { lblscript.Text = "<script>Error()</" + "script>"; return; } } catch (Exception ex) { DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.LateFee, "btnSave_Click", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["CurrentSchoolYearId"] == null) { Response.Redirect("~/Login.aspx"); } if (!Page.IsPostBack) { rdpStartDate.SelectedDate = DateTime.Now; DayCareBAL.LedgerOfFamilyService proxyGetLastUpdatedLedgerDate = new DayCareBAL.LedgerOfFamilyService(); DayCarePL.LedgerProperties objLedgerProperties = new DayCarePL.LedgerProperties(); objLedgerProperties.LastModifiedDatetime = proxyGetLastUpdatedLedgerDate.GetLastUpdateLedgerDate().LastModifiedDatetime; //lblLastUpdatedLedger.Text += "The ledger was last updated on " + Convert.ToString(objLedgerProperties.LastModifiedDatetime.ToString("dd-MMMM-yyyy")) + ". Do you wish to update the ledger now? " ; lblLastUpdatedLedger.Text = String.Format(lblLastUpdatedLedger.Text, Convert.ToString(objLedgerProperties.LastModifiedDatetime.ToString("dd-MMMM-yyyy hh:mm tt"))); } }
public static DayCarePL.LedgerProperties GetLastUpdateLedgerDate() { DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.clLedgerOfFamily, "LoadChildFamilyWiseTranDateAmount", "Execute LoadChildFamilyWiseTranDateAmount Method", DayCarePL.Common.GUID_DEFAULT); clConnection.DoConnection(); DayCareDataContext db = new DayCareDataContext(); try { DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.clLedgerOfFamily, "LoadChildFamilyWiseTranDateAmount", "Debug LoadChildFamilyWiseTranDateAmount Method", DayCarePL.Common.GUID_DEFAULT); DayCarePL.LedgerProperties data = (from l in db.Ledgers orderby l.LastModifiedDatetime descending select new DayCarePL.LedgerProperties() { LastModifiedDatetime = l.LastModifiedDatetime.Value }).FirstOrDefault(); return(data); } catch (Exception ex) { DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.clLedgerOfFamily, "LoadChildFamilyWiseTranDateAmount", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT); return(null); } }
// 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); } }
private void SetLegderProperties(Guid SchoolYearId, List <DayCarePL.LedgerProperties> lstChildEnrollForLedger, DayCarePL.LedgerProperties objChildEnrollForLedger, DayCarePL.ChildProgEnrollmentProperties objChildProgEnrollmentFeeDetail) { objChildEnrollForLedger.ChildFamilyId = objChildProgEnrollmentFeeDetail.ChildFamilyId; objChildEnrollForLedger.SchoolYearId = SchoolYearId; objChildEnrollForLedger.ChildDataId = objChildProgEnrollmentFeeDetail.ChildDataId; objChildEnrollForLedger.Debit = objChildProgEnrollmentFeeDetail.Fees.Value; objChildEnrollForLedger.Credit = 0; objChildEnrollForLedger.AllowEdit = false; objChildEnrollForLedger.PaymentId = null; objChildEnrollForLedger.CreatedById = new Guid(Session["StaffId"].ToString()); objChildEnrollForLedger.CreatedDateTime = DateTime.Now; objChildEnrollForLedger.LastModifiedById = new Guid(Session["StaffId"].ToString()); objChildEnrollForLedger.LastModifiedDatetime = DateTime.Now; objChildEnrollForLedger.SchoolProgramId = objChildProgEnrollmentFeeDetail.SchoolProgramId; lstChildEnrollForLedger.Add(objChildEnrollForLedger); }
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(); }
public bool UpdateLedger(DayCarePL.LedgerProperties objLedger) { return(DayCareDAL.clLedger.UpdateLedger(objLedger)); }
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); } }
private static void SetLegderProperties(Guid SchoolYearId, List <DayCarePL.LedgerProperties> lstChildEnrollForLedger, DayCarePL.LedgerProperties objChildEnrollForLedger, DayCarePL.ChildProgEnrollmentProperties objChildProgEnrollmentFeeDetail) { objChildEnrollForLedger.ChildFamilyId = objChildProgEnrollmentFeeDetail.ChildFamilyId; objChildEnrollForLedger.SchoolYearId = SchoolYearId; objChildEnrollForLedger.ChildDataId = objChildProgEnrollmentFeeDetail.ChildDataId; objChildEnrollForLedger.Debit = objChildProgEnrollmentFeeDetail.Fees.Value; objChildEnrollForLedger.Credit = 0; objChildEnrollForLedger.AllowEdit = false; objChildEnrollForLedger.PaymentId = null; objChildEnrollForLedger.CreatedById = new Guid("9E10D25A-9CA2-488D-BB59-4890D3786961"); objChildEnrollForLedger.CreatedDateTime = DateTime.Now; objChildEnrollForLedger.LastModifiedById = new Guid("9E10D25A-9CA2-488D-BB59-4890D3786961"); objChildEnrollForLedger.LastModifiedDatetime = DateTime.Now; objChildEnrollForLedger.SchoolProgramId = objChildProgEnrollmentFeeDetail.SchoolProgramId; lstChildEnrollForLedger.Add(objChildEnrollForLedger); }
protected void rgLedger_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) { if (e.Item.ItemType == GridItemType.Header) { Balance = 0; } if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem) { DayCarePL.LedgerProperties objLedger = e.Item.DataItem as DayCarePL.LedgerProperties; Label lblBalance = e.Item.FindControl("lblBalance") as Label; TextBox txtDebit = e.Item.FindControl("txtDebit") as TextBox; TextBox txtCredit = e.Item.FindControl("txtCredit") as TextBox; Label lblOperation = e.Item.FindControl("lblOperation") as Label; Label lblPaymentLabel = e.Item.FindControl("lblPaymentLabel") as Label; Label lblChargesLable = e.Item.FindControl("lblChargesLable") as Label; DropDownList ddlPayment = e.Item.FindControl("ddlPayment") as DropDownList; DropDownList ddlCategory = e.Item.FindControl("ddlCategory") as DropDownList; //For Edit RadDatePicker rdpDate = e.Item.FindControl("rdpDate") as RadDatePicker; Common.BindChargeCode(ddlCategory); RadioButton rdbPayment = e.Item.FindControl("rdbPayment") as RadioButton; RadioButton rdbDiscount = e.Item.FindControl("rdbDiscount") as RadioButton; //Label lblTransactionDate1=e.Item.FindControl("lblTransactionDate1") as Label; //GridEditableColumn edSelect1 = e.Item.OwnerTableView.Columns[12] as GridEditableColumn; //end GridEditableColumn edSelect = e.Item.OwnerTableView.Columns[1] as GridEditableColumn; edSelect.Display = true; if (objLedger != null) { lblPaymentLabel.Visible = true; lblChargesLable.Visible = true; ViewState["ChildFamilyId"] = objLedger.ChildFamilyId; if (objLedger.TransactionDate != null) { rdpDate.SelectedDate = objLedger.TransactionDate; } if (objLedger.AllowEdit) { if (objLedger.PaymentId != null) { //edSelect = e.Item.OwnerTableView.Columns[1] as GridEditableColumn; lblPaymentLabel.Visible = false; lblChargesLable.Visible = false; //edSelect.Display = false; rdbPayment.Style.Add("display", "none"); rdbDiscount.Style.Add("display", "none"); ddlPayment.SelectedValue = objLedger.PaymentMethodId.ToString(); } else if (objLedger.PaymentMethodId != null) { rdbPayment.Checked = true; rdbDiscount.Checked = false; ddlPayment.SelectedValue = objLedger.PaymentMethodId.ToString(); } else if (objLedger.ChargeCodeCategoryId != null) { rdbPayment.Checked = false; rdbDiscount.Checked = true; ddlCategory.SelectedValue = objLedger.ChargeCodeCategoryId.ToString(); } else { rdbPayment.Checked = true; rdbDiscount.Checked = false; } if (rdbPayment.Checked) { //edSelect.Display = true; ddlPayment.Style.Add("display", "block"); ddlCategory.Style.Add("display", "none"); txtDebit.Enabled = false; //itm["Select"].Visible = true; //itm["Select"].Controls[1].Visible = true; // itm["operation"].Visible = true; } else { //edSelect.Display = true; ddlCategory.Style.Add("display", "block"); ddlPayment.Style.Add("display", "none"); } } else { //edSelect = e.Item.OwnerTableView.Columns[1] as GridEditableColumn; lblPaymentLabel.Visible = false; lblChargesLable.Visible = false; //edSelect.Display = false; rdpDate.Enabled = false; if (objLedger.TransactionDate != null) { rdpDate.SelectedDate = objLedger.TransactionDate; } ddlCategory.Visible = false; ddlPayment.Visible = false; rdbPayment.Visible = false; rdbDiscount.Visible = false; //itm["Select"].Visible = false; // itm["operation"].Visible = false; } //if (objLedger.PaymentMethodId != null) //{ // switch (objLedger.PaymentMethodId) // { // case 0: // { // ddlPayment.SelectedValue = "Cash"; // break; // } // case 1: // { // ddlPayment.SelectedValue = "Check"; // break; // } // case 2: // { // ddlPayment.SelectedValue = "Credit"; // break; // } // } //} //else if (objLedger.ChargeCodeCategoryId != null) //{ // ddlCategory.SelectedValue = objLedger.ChargeCodeCategoryId.ToString(); //} if (objLedger.Debit > 0) { Balance += objLedger.Debit; } else { Balance -= objLedger.Credit; YTDPay += objLedger.Credit; } lblBalance.Text = Balance.ToString(); //txtBalance.Text = Balance.ToString(); //txtYTDPay.Text = YTDPay.ToString(); } } if (e.Item.ItemType == GridItemType.EditItem) { GridEditableItem itm = e.Item as GridEditableItem; DayCarePL.LedgerProperties objLedger = e.Item.DataItem as DayCarePL.LedgerProperties; RadDatePicker rdpDate = e.Item.FindControl("rdpDate") as RadDatePicker; DropDownList ddlPayment = e.Item.FindControl("ddlPayment") as DropDownList; DropDownList ddlCategory = e.Item.FindControl("ddlCategory") as DropDownList; Common.BindChargeCode(ddlCategory); RadioButton rdbPayment = e.Item.FindControl("rdbPayment") as RadioButton; RadioButton rdbDiscount = e.Item.FindControl("rdbDiscount") as RadioButton; TextBox txtDebit = e.Item.FindControl("txtDebit") as TextBox; //Label lblTransactionDate1=e.Item.FindControl("lblTransactionDate1") as Label; GridEditableColumn edSelect1 = e.Item.OwnerTableView.Columns[12] as GridEditableColumn; //edSelect1.Display = false; if (objLedger != null) { if (objLedger.TransactionDate != null) { rdpDate.SelectedDate = objLedger.TransactionDate; } if (objLedger.AllowEdit) { if (objLedger.PaymentId != null) { GridEditableColumn edSelect = e.Item.OwnerTableView.Columns[3] as GridEditableColumn; edSelect.Display = false; rdbPayment.Style.Add("display", "none"); rdbDiscount.Style.Add("display", "none"); ddlPayment.SelectedValue = objLedger.PaymentMethodId.ToString(); } else if (objLedger.PaymentMethodId != null) { rdbPayment.Checked = true; rdbDiscount.Checked = false; ddlPayment.SelectedValue = objLedger.PaymentMethodId.ToString(); } else if (objLedger.ChargeCodeCategoryId != null) { rdbPayment.Checked = false; rdbDiscount.Checked = true; ddlCategory.SelectedValue = objLedger.ChargeCodeCategoryId.ToString(); } else { rdbPayment.Checked = true; rdbDiscount.Checked = false; } if (rdbPayment.Checked) { ddlPayment.Style.Add("display", "block"); ddlCategory.Style.Add("display", "none"); txtDebit.Enabled = false; //itm["Select"].Visible = true; //itm["Select"].Controls[1].Visible = true; // itm["operation"].Visible = true; } else { ddlCategory.Style.Add("display", "block"); ddlPayment.Style.Add("display", "none"); } } else { GridEditableColumn edSelect = e.Item.OwnerTableView.Columns[3] as GridEditableColumn; edSelect.Display = false; rdpDate.Enabled = false; if (objLedger.TransactionDate != null) { rdpDate.SelectedDate = objLedger.TransactionDate; } ddlCategory.Visible = false; ddlPayment.Visible = false; rdbPayment.Visible = false; rdbDiscount.Visible = false; //itm["Select"].Visible = false; // itm["operation"].Visible = false; } } else { if (rdbPayment.Checked) { ddlCategory.Style.Add("display", "none"); txtDebit.Enabled = false; rdpDate.SelectedDate = DateTime.Now; rdbPayment.TextAlign = TextAlign.Right; } } } }
public bool Save(DayCarePL.LedgerProperties objLedger) { return(DayCareDAL.clLedgerOfFamily.Save(objLedger)); }