private void Print() { LoadDeposits(); var myDataSet = new ReportDataSet(); var serNo = 1; var selectedCompany = new CompanyService(true).GetCompany(); string datecaption = ReportUtility.GetEthCalendar(FilterStartDate, true) + "(" + FilterStartDate.ToShortDateString() + ")"; if (FilterStartDate.Day != FilterEndDate.Day || FilterStartDate.Month != FilterEndDate.Month || FilterStartDate.Year != FilterEndDate.Year) { datecaption = "ከ " + datecaption + " እስከ " + ReportUtility.GetEthCalendar(FilterEndDate, true) + "(" + FilterEndDate.ToShortDateString() + ")"; } var returned = ""; if (SelectedCpoType.Value != 1) { returned = "የተመለሰበት ቀን"; } foreach (var rentalPaymentDTO in RentDeposits) { var rentee = rentalPaymentDTO.Contrat.Rentee.DisplayName; if (rentee.Length > 20) { rentee = rentee.Substring(0, 18) + "..."; } myDataSet.RentalPayment.Rows.Add( serNo, SelectedCpoType.Display, datecaption, rentalPaymentDTO.DepositedDateStringAmharicFormatted, rentalPaymentDTO.Contrat.Room.Number, rentee, "", 0.0, 0.0, 0.0, 0.0, 0.0, rentalPaymentDTO.TotalDepositAmount, rentalPaymentDTO.ReturnedDateStringAmharicFormatted, 0, 0.0, returned, "", "", "", selectedCompany.Header, null, ""); serNo++; } var myReport4 = new DepositList(); myReport4.SetDataSource(myDataSet); var report = new ReportViewerCommon(myReport4); report.Show(); }
public string GetBusinessPartnerNumber(int businessPartnerId) { var pref = businessPartnerId.ToString(); if (businessPartnerId < 1000) { var id = businessPartnerId + 10000; pref = id.ToString(); pref = pref.Substring(1); } var amhCalender = ReportUtility.GetEthCalendar(DateTime.Now, false); return("DFT/" + pref + "/" + amhCalender.Substring(6)); }
public string GetRentalPaymentNumber(int rentalPaymentId) { var pref = rentalPaymentId.ToString(); if (rentalPaymentId < 1000) { var id = rentalPaymentId + 10000; pref = id.ToString(); pref = pref.Substring(1); } var amhCalender = ReportUtility.GetEthCalendar(DateTime.Now, false); return("DRN/" + pref + "/" + amhCalender.Substring(6)); }
public string GetEquipmentNumber(int equipmentId) { var pref = equipmentId.ToString(); if (equipmentId < 1000) { var id = equipmentId + 110000; pref = id.ToString(); //pref = pref.Substring(1); } var amhCalender = ReportUtility.GetEthCalendar(DateTime.Now, false); return(pref + amhCalender.Substring(6)); }
public void SetEthioValues() { try { var gregorDayFrom = new DateTime(SelectedGregorYear.Value, SelectedGregorMonth.Value, SelectedGregorDay.Value); var ethioDayFrom = ReportUtility.GetEthCalendar(gregorDayFrom, false); int dayf = Convert.ToInt32(ethioDayFrom.Substring(0, 2)), monthf = Convert.ToInt32(ethioDayFrom.Substring(2, 2)), yearf = Convert.ToInt32(ethioDayFrom.Substring(4, 4)); SelectedEthioDay = EthioDays[dayf - 1]; SelectedEthioMonth = EthioMonths[monthf - 1]; SelectedEthioYear = EthioYears[yearf - 1900]; } catch { //MessageBox.Show("Can't convert, may be out side of the scope!"); } }
public ExpensesViewModel() { FillPeriodCombo(); CheckRoles(); //SelectedPeriod = FilterPeriods.FirstOrDefault(); var currentMonth = Convert.ToInt32(ReportUtility.GetEthCalendar(DateTime.Now, false).Substring(2, 2)); var currentYear = Convert.ToInt32(ReportUtility.GetEthCalendar(DateTime.Now, false).Substring(4, 4)); FilterStartDate = ReportUtility.GetGregorCalendar(currentYear, currentMonth, 1); FilterEndDate = ReportUtility.GetGregorCalendar(currentYear, currentMonth, 30); if (currentMonth == 13) { FilterEndDate = ReportUtility.GetGregorCalendar(currentYear, currentMonth, 5); } FillPaymentTypesCombo(); SelectedPaymentType = PaymentTypesFilter.FirstOrDefault(); GetWarehouses(); Load(); }
public MainViewModel() { CheckRoles(); TitleText = "PinnaRent V1.0.0.1, Rental Management System - " + Singleton.User.UserName + " - " + DateTime.Now.ToString("dd/MM/yyyy") + " - " + ReportUtility.GetEthCalendar(DateTime.Now, true); //if (UserRoles.RoomEntry == "Visible") //{ HeaderText = "የሚከራዩ ክፍሎች"; CurrentViewModel = RoomsViewModel; //} //else if (UserRoles.DashboardMgmt == "Visible") //{ // HeaderText = "DashBoard"; // RenteeAddressViewModel = DashBoardViewModel; //} DashboardViewCommand = new RelayCommand(ExecuteDashboardViewCommand); RoomsViewCommand = new RelayCommand(ExecuteRoomsViewCommand); }
private const int MonitorTimerDelay = 300000; //60000-1 minute #endregion #region Constructor public DashBoardViewModel() { CheckRoles(); FillCalendar(); FillShiftTypes(); var currentMonth = Convert.ToInt32(ReportUtility.GetEthCalendar(DateTime.Now, false).Substring(2, 2)); SelectedEthioMonth = EthioMonths.FirstOrDefault(e => e.Value == currentMonth); var currentDay = Convert.ToInt32(ReportUtility.GetEthCalendar(DateTime.Now, false).Substring(0, 2)); SelectedEthioDay = EthioDays.FirstOrDefault(e => e.Value == currentDay); var currentYear = Convert.ToInt32(ReportUtility.GetEthCalendar(DateTime.Now, false).Substring(4, 4)); SelectedEthioYear = EthioYears.FirstOrDefault(e => e.Value == currentYear); Palette = ChartPalettes.Windows8;//Summer Load(); _monitorTimer = new System.Timers.Timer(MonitorTimerDelay); _monitorTimer.Elapsed += new System.Timers.ElapsedEventHandler(OnMonitorTimerElapsed); _monitorTimer.Enabled = true; }
public void PrintSummaryList(object obj) { switch (ReportType) { case ReportTypes.PenalityOnly: case ReportTypes.ServiceOnly: case ReportTypes.RentOnly: case ReportTypes.PaymentList: { #region Payment List var selectedCompany = new CompanyService(true).GetCompany(); var datecaption = ReportUtility.GetDateCaption(FilterStartDate, FilterEndDate); var myDataSet = new ReportDataSet(); #region Criteria var criteria = new SearchCriteria <RentalPaymentDTO>(); if (FilterStartDate.Year > 2000 && FilterEndDate.Year > 2000) { criteria.CurrentUserId = Singleton.User.UserId; criteria.BeginingDate = FilterStartDate; criteria.EndingDate = FilterEndDate; } if (ReportType == ReportTypes.PaymentList) { criteria.FiList.Add(p => p.Type != PaymentTypes.ServiceWithRent); } if (ReportType == ReportTypes.RentOnly) { criteria.FiList.Add(p => p.Type == PaymentTypes.Rent); } if (ReportType == ReportTypes.ServiceOnly) { criteria.FiList.Add( p => p.Type == PaymentTypes.Service || p.Type == PaymentTypes.ServiceWithRent); } if (ReportType == ReportTypes.PenalityOnly) { criteria.FiList.Add(p => p.TotalPenalityAmount > 0); } #endregion var payments = new RentalPaymentService(true).GetAll(criteria).OrderBy(p => p.ReceiptDate).ToList(); var serNo = 1; #region For All Payments if (ReportType == ReportTypes.PaymentList) { foreach (var rentalPaymentDTO in payments) { var rentee = rentalPaymentDTO.Contrat.Rentee.DisplayName; if (rentee.Length > 20) { rentee = rentee.Substring(0, 18) + "..."; } myDataSet.RentalPayment.Rows.Add( serNo, "አጠቃላይ ከቤት ኪራይ,ከአገልግሎት,ከቅጣት የተሰበሰበ ገቢ", datecaption, rentalPaymentDTO.ReceiptDateStringAmharicFormatted, rentalPaymentDTO.Contrat.Room.Number, rentee, "", rentalPaymentDTO.TotalAmountRequiredBeforeVat, 0.0, 0.0, rentalPaymentDTO.TotalAmountRequiredVatAmount, 0.0, rentalPaymentDTO.TotalAmountRequired, rentalPaymentDTO.ReceiptNumber, 0 , 0.0, "", "", "", "", selectedCompany.Header, null, ""); serNo++; } } #endregion #region For Rent/Service Only Payments if (ReportType == ReportTypes.RentOnly || ReportType == ReportTypes.ServiceOnly) { foreach (var rentalPaymentDTO in payments) { var rentee = rentalPaymentDTO.Contrat.Rentee.DisplayName; if (rentee.Length > 20) { rentee = rentee.Substring(0, 18) + "..."; } myDataSet.RentalPayment.Rows.Add( serNo, "አጠቃላይ ከ" + EnumUtil.GetEnumDesc(ReportType) + " የተሰበሰበ ገቢ", datecaption, rentalPaymentDTO.ReceiptDateStringAmharicFormatted, rentalPaymentDTO.Contrat.Room.Number, rentee, "", rentalPaymentDTO.AmountRequiredBeforeVat, 0.0, 0.0, rentalPaymentDTO.AmountRequiredVatAmount, 0.0, rentalPaymentDTO.AmountRequired, rentalPaymentDTO.ReceiptNumber, 0 , 0.0, "", "", "", "", selectedCompany.Header, null, ""); serNo++; } } #endregion #region Penality Only if (ReportType == ReportTypes.PenalityOnly) { foreach (var rentalPaymentDTO in payments) { var rentee = rentalPaymentDTO.Contrat.Rentee.DisplayName; if (rentee.Length > 20) { rentee = rentee.Substring(0, 18) + "..."; } myDataSet.RentalPayment.Rows.Add( serNo, "አጠቃላይ ከ" + EnumUtil.GetEnumDesc(ReportType) + " የተሰበሰበ ገቢ", datecaption, rentalPaymentDTO.ReceiptDateStringAmharicFormatted, rentalPaymentDTO.Contrat.Room.Number, rentee, "", rentalPaymentDTO.TotalPenalityAmountBeforeVat, 0.0, 0.0, rentalPaymentDTO.TotalPenalityAmountVatAmount, 0.0, rentalPaymentDTO.TotalPenalityAmount, rentalPaymentDTO.ReceiptNumber, 0 , 0.0, "", "", "", "", selectedCompany.Header, null, ""); serNo++; } } #endregion var myReport4 = new PaymentList(); myReport4.SetDataSource(myDataSet); var report = new ReportViewerCommon(myReport4); report.Show(); #endregion } break; case ReportTypes.Discontinued: { #region Discontinued var criteria = new SearchCriteria <RentalContratDTO>(); if (FilterStartDate.Year > 2000 && FilterEndDate.Year > 2000) { criteria.BeginingDate = FilterStartDate; criteria.EndingDate = FilterEndDate; } var myDataSet = new ReportDataSet(); var serNo = 1; var selectedCompany = new CompanyService(true).GetCompany(); var payments = new RentalContratService(true).GetAll(criteria).ToList(); if (payments.Count == 0) { MessageBox.Show("No data found on the givenn duration"); return; } string datecaption = ReportUtility.GetEthCalendar(FilterStartDate, true) + "(" + FilterStartDate.ToShortDateString() + ")"; if (FilterStartDate.Day != FilterEndDate.Day || FilterStartDate.Month != FilterEndDate.Month || FilterStartDate.Year != FilterEndDate.Year) { datecaption = "ከ " + datecaption + " እስከ " + ReportUtility.GetEthCalendar(FilterEndDate, true) + "(" + FilterEndDate.ToShortDateString() + ")"; } foreach (var contratDTO in payments) { var rentee = contratDTO.Rentee.DisplayName; if (rentee.Length > 20) { rentee = rentee.Substring(0, 18) + "..."; } myDataSet.RentalPayment.Rows.Add( serNo, "የተቋረጡ ውሎች ዝርዝር", datecaption, contratDTO.LastContractDiscontinuedDateStringAmharic, contratDTO.Room.Number, rentee, "", 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, "", 0 , 0.0, "", "", "", "", selectedCompany.Header, null, ""); serNo++; } var myReport4 = new ContractDiscontinued(); myReport4.SetDataSource(myDataSet); var report = new ReportViewerCommon(myReport4); report.Show(); #endregion } break; case ReportTypes.NotPaid: { #region NotPaid var criteria = new SearchCriteria <RoomDTO>(); criteria.FiList.Add(r => r.LastRentalPayment != null); var endDate = FilterEndDate.AddDays(-1); criteria.FiList.Add(p => p.LastRentalPayment.EndDate < endDate || (p.LastServicePayment != null && p.LastServicePayment.EndDate < endDate)); var myDataSet = new ReportDataSet(); var serNo = 1; var selectedCompany = new CompanyService(true).GetCompany(); var rooms = new RoomService(true).GetAll(criteria).ToList(); string datecaption = ReportUtility.GetEthCalendar(FilterStartDate, true) + "(" + FilterStartDate.ToShortDateString() + ")"; if (FilterStartDate.Day != FilterEndDate.Day || FilterStartDate.Month != FilterEndDate.Month || FilterStartDate.Year != FilterEndDate.Year) { datecaption = "ከ " + datecaption + " እስከ " + ReportUtility.GetEthCalendar(FilterEndDate, true) + "(" + FilterEndDate.ToShortDateString() + ")"; } foreach (var roomDTO in rooms) { var rentee = roomDTO.LastRentee.DisplayName; if (rentee.Length > 20) { rentee = rentee.Substring(0, 18) + "..."; } var overdueMonths = CommonUtility.GetMonthsFromDays(roomDTO.LastRentalPayment.EndDate, endDate); var fee = overdueMonths * roomDTO.RentalFee; if (roomDTO.LastServicePayment != null) { overdueMonths = CommonUtility.GetMonthsFromDays(roomDTO.LastServicePayment.EndDate, endDate); fee += overdueMonths * roomDTO.ServiceFee; } myDataSet.RentalPayment.Rows.Add( serNo, "መክፈል ሲገባቸው ያልከፈሉ", datecaption, roomDTO.LastRentalPayment.EndDateStringAmharic, roomDTO.Number, rentee, "", fee / (decimal)1.15, 0.0, 0.0, (fee / (decimal)1.15) * (decimal)0.15, 0.0, fee, roomDTO.LastRentalPayment.ReceiptNumber, 0 , 0.0, "", "", "", "ያበቃበት ቀን", selectedCompany.Header, null, ""); serNo++; } var myReport4 = new PaymentList2(); myReport4.SetDataSource(myDataSet); var report = new ReportViewerCommon(myReport4); report.Show(); #endregion } break; } }
public void LoadMembers() { var sutil = new SummaryUtility(); var membersList = sutil.GetMembers().ToList(); TotalNumberOfMembers = membersList.Count(); MemberSubscriptionListForNumberSummary = membersList; MemberSubscriptionList = sutil.GetSubscriptions().ToList(); #region Group By Sex var maleSex = membersList.Count(s => s.Sex == Sex.Male); var feMaleSex = membersList.Count(s => s.Sex == Sex.Female); var totalSex = maleSex + feMaleSex; maleSex = (maleSex * 100) / totalSex; feMaleSex = (feMaleSex * 100) / totalSex; var pieData2 = new List <Data> { new Data { Category = "ወንድ", Value = maleSex }, new Data { Category = "ሴት", Value = feMaleSex } }; PieData = pieData2; #endregion #region Group By Status var active = membersList.Count(s => !s.IsExpired); TotalNumberOfActiveMembers = "ጊዜ ያላቸው: " + active.ToString(); var expired = membersList.Count(s => s.IsExpired); TotalNumberOfExpiredMembers = "ጊዜ ያለፈባቸው: " + expired.ToString(); var tot = active + expired; active = (active * 100) / tot; expired = (expired * 100) / tot; var pieDataStatus = new List <Data> { new Data { Category = "ጊዜ ያለው", Value = active }, new Data { Category = "ጊዜ ያለፈበት", Value = expired } }; StatusPieData = pieDataStatus; #endregion #region Group By Facility var querFacility = from memberSubscriptionList in membersList group memberSubscriptionList by memberSubscriptionList.FacilityName into newGroup orderby newGroup.Key select newGroup; MemberCategorySubList = querFacility.Select(nameGroup => new SubscriptionSumModel { Category = nameGroup.Key, SubscriptionModels = nameGroup }).ToList(); var facilityPieData = MemberCategorySubList.Select(fac => new Data(TotalNumberOfMembers) { Category = fac.Category, Value = fac.TotalNumber }).ToList(); FacilityPieData = facilityPieData; #endregion #region Group By Subscription var querSubscription = from memberSubscriptionList in membersList group memberSubscriptionList by memberSubscriptionList.SubscriptionName into newGroup orderby newGroup.Key select newGroup; MemberCategorySubList = querSubscription.Select(nameGroup => new SubscriptionSumModel { Category = nameGroup.Key, SubscriptionModels = nameGroup }).ToList(); var subscriptionPieData = MemberCategorySubList.Select(fac => new Data(TotalNumberOfMembers) { Category = fac.Category, Value = fac.TotalNumber }).ToList(); SubscriptionPieData = subscriptionPieData; #endregion MemberSubscriptionList = MemberSubscriptionList.Union(sutil.GetPervisit().ToList()).ToList(); MemberSubscriptionList = MemberSubscriptionList.Union(sutil.GetSales().ToList()).ToList(); var morningSubList = MemberSubscriptionList.Where(m => m.Shift == ShiftTypes.Morning).ToList(); var afternoonSubList = MemberSubscriptionList.Where(m => m.Shift == ShiftTypes.Afternoon).ToList(); #region Group By Registration Date var queryAmount = from memberSubscriptionList in morningSubList group memberSubscriptionList by memberSubscriptionList.StartDate into newGroup orderby newGroup.Key select newGroup; MorningSubList = queryAmount.Select(nameGroup => new SubscriptionSumModel { TransactionDate = nameGroup.Key, StartDate = ReportUtility.GetEthCalendar(nameGroup.Key, false).Substring(0, 2), StartMonth = ReportUtility.GetEthCalendar(nameGroup.Key, false).Substring(2, 2), SubscriptionModels = nameGroup }).ToList(); var mon = SelectedEthioMonth.Value.ToString(); if (SelectedEthioMonth.Value < 10) { mon = "0" + SelectedEthioMonth.Value; } MorningSubList = MorningSubList.Where(m => m.StartMonth == mon).ToList(); #endregion #region Group By Registration Date queryAmount = from memberSubscriptionList in afternoonSubList group memberSubscriptionList by memberSubscriptionList.StartDate into newGroup orderby newGroup.Key select newGroup; AfternoonSubList = queryAmount.Select(nameGroup => new SubscriptionSumModel { TransactionDate = nameGroup.Key, StartDate = ReportUtility.GetEthCalendar(nameGroup.Key, false).Substring(0, 2), StartMonth = ReportUtility.GetEthCalendar(nameGroup.Key, false).Substring(2, 2), SubscriptionModels = nameGroup }).ToList(); mon = SelectedEthioMonth.Value.ToString(); if (SelectedEthioMonth.Value < 10) { mon = "0" + SelectedEthioMonth.Value; } AfternoonSubList = AfternoonSubList.Where(m => m.StartMonth == mon).ToList(); #endregion }