diff --git a/BeWo/Core/BeWoUtils.cs b/BeWo/Core/BeWoUtils.cs index 7705b3849..a20ed2db1 100644 --- a/BeWo/Core/BeWoUtils.cs +++ b/BeWo/Core/BeWoUtils.cs @@ -1688,7 +1688,10 @@ namespace BeWo.Core { dc.CostBearer2SupportConceptOid = relDc.CostBearer2SupportConceptOid; } - + else + { + dc.CostBearer2SupportConceptOid = null; + } var validationResults = new List(); var maxdays = BeWoApp.AppSettings.MaxDaysEditServiceRecordsAllowed; diff --git a/Data/Security/UserRightHelper.cs b/Data/Security/UserRightHelper.cs index e47d1aa11..5608df57f 100644 --- a/Data/Security/UserRightHelper.cs +++ b/Data/Security/UserRightHelper.cs @@ -130,7 +130,7 @@ namespace BeWo.Data.Security { var rightVersion = GetRightVersion(r); - if (version.CompareTo(rightVersion) < 0) + if (!String.IsNullOrEmpty(version) && version.CompareTo(rightVersion) < 0) { return false; } diff --git a/Host/ReportView.aspx.cs b/Host/ReportView.aspx.cs index 2c00acc90..f6db53f7b 100644 --- a/Host/ReportView.aspx.cs +++ b/Host/ReportView.aspx.cs @@ -939,6 +939,7 @@ namespace Host return reportCreator.CreateVertretungsPlanungReport(start, ansicht); } + private XtraReport CreateValidationMessageListReport() { DateTime start = DateTime.Now.Date; diff --git a/Report/DefaultReportCreator.cs b/Report/DefaultReportCreator.cs index bc04b3bc5..679339a35 100644 --- a/Report/DefaultReportCreator.cs +++ b/Report/DefaultReportCreator.cs @@ -1206,8 +1206,7 @@ namespace BeWo.Report public override XtraReport CreateInvoiceListReport(List oids) { - XtraReport master = new XtraReport(); - master.CreateDocument(); + XtraReport master = null; var ibList = DAOFactory.GenericDAO.LoadByIDs(oids); @@ -1228,28 +1227,41 @@ namespace BeWo.Report } if (report != null) { + report.Watermark.PageRange = "1"; if (report.Pages.Count == 0) { report.CreateDocument(); } - var wm = report.Watermark; - bool firstpage = true; - foreach (var item in report.Pages) - { - var page2add = item as DevExpress.XtraPrinting.Page; - if (page2add != null) - { + - master.Pages.Add(page2add); - if (wm != null && firstpage) - { - var newpage = master.Pages[master.Pages.Count - 1]; - newpage.AssignWatermark(wm); - } - } - firstpage = false; + if (master == null) + { + master = report; + } + else + { + //master.Pages.AddRange(report.Pages); + XRWatermark wm = new XRWatermark(); + + wm.CopyFrom(report.Watermark); + bool firstpage = true; + foreach (var item in report.Pages) + { + var page2add = item as DevExpress.XtraPrinting.Page; + if (page2add != null) + { + + master.Pages.Add(page2add); + if (wm != null && firstpage) + { + var newpage = master.Pages[master.Pages.Count - 1]; + newpage.AssignWatermark(wm); + //newpage.AssignWatermark(page2add.Watermark); + } + } + firstpage = false; + } } - //master.Pages.AddRange(report.Pages); } } diff --git a/Report/ReportObjects/MitarbeiterstundenkontoBerechnung.cs b/Report/ReportObjects/MitarbeiterstundenkontoBerechnung.cs index c58f3bdd1..6b9a606a5 100644 --- a/Report/ReportObjects/MitarbeiterstundenkontoBerechnung.cs +++ b/Report/ReportObjects/MitarbeiterstundenkontoBerechnung.cs @@ -1789,22 +1789,30 @@ namespace BeWo.Report.ReportObjects } else { - var c = ed.Employee.GetValidContractForDate(dd.Date); - if (c != null) + var ssa = GetSollStundenForAbsenceTime(ed, absenceTime, dd.Date); + if (ssa.HasValue) + { + sollDiesenTag = ssa.Value; + } + else { - decimal wth = 0; - int apw = ANZ_WOCHENTAGE; - - if (c.WeeklyTotalHours.HasValue) + var c = ed.Employee.GetValidContractForDate(dd.Date); + if (c != null) { - wth = c.WeeklyTotalHours.Value; - } - if (c.WeeklyDays.HasValue && c.WeeklyDays.Value > 0) - { - apw = c.WeeklyDays.Value; - } + decimal wth = 0; + int apw = ANZ_WOCHENTAGE; - sollDiesenTag = wth / apw; + if (c.WeeklyTotalHours.HasValue) + { + wth = c.WeeklyTotalHours.Value; + } + if (c.WeeklyDays.HasValue && c.WeeklyDays.Value > 0) + { + apw = c.WeeklyDays.Value; + } + + sollDiesenTag = wth / apw; + } } } @@ -1832,7 +1840,7 @@ namespace BeWo.Report.ReportObjects if (faktor != 0) { - sollDiesenTag *= faktor; //halbe Feiertage etc. berücksichtigen + abwesenheitsDauer *= faktor; //halbe Feiertage etc. berücksichtigen } if (ed.AbsenceTimeDays != null && ed.AbsenceTimeDays.TageProWocheDict != null) @@ -1916,6 +1924,18 @@ namespace BeWo.Report.ReportObjects absenceTime.AbsenceReason.Description.ToLower().IndexOf("urlaub") >= 0; } + public virtual decimal? GetSollStundenForAbsenceTime(MitarbeiterstundenkontoRO.EmployeeDetail ed, AbsenceTime at, DateTime datum) + { + return null; + + } + + public virtual bool AddAbsenceTimeToIst() + { + return false; + } + + public virtual bool AddServiceRecordToDuration(ServiceRecord item) { return true; @@ -2202,7 +2222,7 @@ namespace BeWo.Report.ReportObjects decimal stundenProTag = GetSollArbeitszeitProArbeitstag(c, ed); - return (stundenProTag * 5); + return stundenProTag * ed.ArbeitstageProWoche; //sollStundenProWoche = stundenProTag * ed.ArbeitstageProWoche; //return (ath.TageGesamt.Value * stundenProTag); @@ -2221,10 +2241,15 @@ namespace BeWo.Report.ReportObjects { if (BerechneAlteAbwesenheitsStunden(start)) { - return BerechneStundenDurchAbwesenheitenAlt(ath, start, ende, c, ed); - + return BerechneStundenDurchAbwesenheitenAlt(ath, start, ende, c, ed); } - decimal stunden = 0; + + if (ath.StundenGesamt.HasValue) + { + return ath.StundenGesamt.Value; + } + + decimal stunden = 0; if (c != null) { @@ -2797,7 +2822,7 @@ namespace BeWo.Report.ReportObjects { atd.TageProWocheDict.Add(week, 0); } - decimal? tage = null; + decimal? stunden = null; if (absenceTimes != null) { foreach (var item in absenceTimes) @@ -2841,13 +2866,19 @@ namespace BeWo.Report.ReportObjects if (faktor < 1 && !istWochenende) { - if (!tage.HasValue) - tage = 0; + if (!stunden.HasValue) + stunden = 0; var tag = 1m; var std = 24m; - if (item.Start.HasValue && item.End.HasValue && item.Start.Value.Date == item.End.Value.Date && + var sollAmTag = GetSollStundenForAbsenceTime(AktuellBearbeitetesEmployeeDetail, item, day); + if (!sollAmTag.HasValue) + { + sollAmTag = AktuellBearbeitetesEmployeeDetail.SollProTag; + } + + if (item.Start.HasValue && item.End.HasValue && item.Start.Value.Date == item.End.Value.Date && item.Start.Value.Hour > 0) { if (AktuellBearbeitetesEmployeeDetail != null) @@ -2855,16 +2886,14 @@ namespace BeWo.Report.ReportObjects faktor = 1; decimal hours = (decimal)item.End.Value.Subtract(item.Start.Value).TotalHours; - var sollAmTag = AktuellBearbeitetesEmployeeDetail.SollProTag; - if (SchneideZuvieleAbwesenheitsstundenAb() && hours > sollAmTag) { - hours = sollAmTag; + hours = sollAmTag.Value; } if (sollAmTag > 0) { - tag = hours / sollAmTag; + tag = hours / sollAmTag.Value; std = tag * 24; } } @@ -2879,25 +2908,32 @@ namespace BeWo.Report.ReportObjects } - tage += std; + stunden += std; if (IsKrankheitAbsenceTime(item)) { if (!atd.TageKrankheit.HasValue) atd.TageKrankheit = 0; + if (!atd.StundenKrankheit.HasValue) + atd.StundenKrankheit = 0; + atd.TageKrankheit += tag; - atd.TageKrankheit += tag; + atd.StundenKrankheit += sollAmTag; } - if (IsUrlaubAbsenceTime(item)) { if (!atd.TageUrlaub.HasValue) atd.TageUrlaub = 0; - - atd.TageUrlaub += tag; + if (!atd.StundenUrlaub.HasValue) + atd.StundenUrlaub = 0; + atd.TageUrlaub += tag; + atd.StundenUrlaub += sollAmTag; } + if (!atd.StundenGesamt.HasValue) + atd.StundenGesamt = 0; + atd.StundenGesamt += sollAmTag; - foreach (var week in weeks) + foreach (var week in weeks) { if (day >= week.StartDate && day <= week.EndDate) { @@ -2916,9 +2952,11 @@ namespace BeWo.Report.ReportObjects } } } - if (tage.HasValue) - tage /= 24; - atd.TageGesamt = tage; + if (stunden.HasValue) + stunden /= 24; + atd.TageGesamt = stunden; + + return atd; } @@ -3109,8 +3147,11 @@ namespace BeWo.Report.ReportObjects public decimal? TageUrlaub; public decimal? TageKrankheit; public decimal? TageGesamt; + public decimal? StundenUrlaub; + public decimal? StundenKrankheit; + public decimal? StundenGesamt; - public Dictionary TageProWocheDict; + public Dictionary TageProWocheDict; public Dictionary RestStundenProWocheDict; } diff --git a/ReportImp/AkggMid/CustomMitarbeiterstundenkontoBerechnung.cs b/ReportImp/AkggMid/CustomMitarbeiterstundenkontoBerechnung.cs index 6f87590da..7e108d129 100644 --- a/ReportImp/AkggMid/CustomMitarbeiterstundenkontoBerechnung.cs +++ b/ReportImp/AkggMid/CustomMitarbeiterstundenkontoBerechnung.cs @@ -105,7 +105,34 @@ namespace AkggMid return !IsUrlaubAbsenceTime(absenceTime); } - public override decimal GetFeiertagsFaktor(DateTime start) + public override decimal? GetSollStundenForAbsenceTime(MitarbeiterstundenkontoRO.EmployeeDetail ed, AbsenceTime at, DateTime datum) + { + if (at.AbsenceReason.Description.StartsWith("MA_K") || at.AbsenceReason.Description.StartsWith("MA_KAU") || at.AbsenceReason.Description.StartsWith("MA_KK")) + { + foreach (var vv in ed.Employee.VarFieldValueList) + { + if (vv.VarFieldDefOid == 2) + { + var varFieldValue = BS.Shared.Core.Utils.XMLDeserializeFromString(vv.SerializedValue, Type.GetType(vv.TypeName)); + + decimal dec = 0; + if (varFieldValue != null && Decimal.TryParse(varFieldValue.ToString(), out dec)) + { + return dec / 5; + } + } + } + } + + return base.GetSollStundenForAbsenceTime(ed, at, datum); + } + + public override bool AddAbsenceTimeToIst() + { + return true; + } + + public override decimal GetFeiertagsFaktor(DateTime start) { if (BerechneFerienTage && start < new DateTime(2023, 9, 4)) { diff --git a/ReportImp/Fortis/CustomReportCreator.cs b/ReportImp/Fortis/CustomReportCreator.cs new file mode 100644 index 000000000..7c4af1921 --- /dev/null +++ b/ReportImp/Fortis/CustomReportCreator.cs @@ -0,0 +1,101 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using BeWo.Data.Access; +using BeWo.Data.Entities; +using BeWo.Report; +using BeWo.Report.ReportObjects; +using BeWo.Service.DCEntityMapper; +using BeWo.Service.Plugins; +using BS.Shared.Core; +using BS.Shared.DataContracts; +using DevExpress.XtraReports.Design; +using DevExpress.XtraReports.UI; + +namespace Fortis +{ + public class CustomReportCreator : DefaultReportCreator + { + + public override XtraReport CreateServiceOverviewAllCustomersReport(int month, int year, long orgaOid, long empOid, long? serviceCategoryOid, int startDay, int endDay) + { + List lROs = ServicesOverviewRO.Create(month, year, orgaOid, empOid, startDay, endDay).OrderBy(ro => ro.CustomerLastName).ToList(); + + if (lROs.Count > 0) + { + + var rootReport = CreateServicesOverviewReportForRo(lROs[0], serviceCategoryOid); + rootReport.CreateDocument(); + + for (int i = 1; i < lROs.Count; i++) + { + var lNext = CreateServicesOverviewReportForRo(lROs[i], serviceCategoryOid); + lNext.CreateDocument(); + rootReport.Pages.AddRange(lNext.Pages); + } + + return rootReport; + } + return new XtraReport(); + } + + public override XtraReport CreateServiceOverviewReportForCustomers(IList customerOids, int month, int year, long? orgaOid, long? empOid, long? serviceCategoryOid, int startDay, int endDay, bool nurFehlende) + { + var roList = new List(); + + foreach (var coid in customerOids) + { + var ro = ServicesOverviewRO.Create(coid, month, year, true, orgaOid ?? 0, empOid ?? 0, startDay, endDay, serviceCategoryOid); + + if (ro != null) + { + roList.Add(ro); + } + } + + roList = roList.OrderBy(ro => ro.CustomerLastName).ToList(); + + if (roList.Count > 0) + { + var rootReport = CreateServicesOverviewReportForRo(roList[0], serviceCategoryOid); + rootReport.CreateDocument(); + + for (int i = 1; i < roList.Count; i++) + { + var lNext = CreateServicesOverviewReportForRo(roList[i], serviceCategoryOid); + lNext.CreateDocument(); + rootReport.Pages.AddRange(lNext.Pages); + } + + return rootReport; + } + return new XtraReport(); + + } + + public override XtraReport CreateServiceOverviewSingleCustomerReport(long customerOid, int month, int year, long orgaOid, long empOid, long? serviceCategoryOid, int startDay, int endDay) + { + var ro = ServicesOverviewRO.Create(customerOid, month, year, false, orgaOid, empOid, startDay, endDay, serviceCategoryOid); + + return CreateServicesOverviewReportForRo(ro, serviceCategoryOid); + + } + + private XtraReport CreateServicesOverviewReportForRo(ServicesOverviewRO ro, long? serviceCategoryOid) + { + IBeWoReport report = null; + + if (ro.CustomerFirstName.Contains("TEST") || ro.CustomerLastName.Contains("TEST")) + { + report = new Fortis.Quittierungsbeleg(); + } + + if (report == null) + report = new BeWo.Report.DefaultReports.Quittierungsbeleg(); + report.SetReportDataSource(ro); + + return report as XtraReport; + } + } +} diff --git a/ReportImp/Fortis/Fortis.csproj b/ReportImp/Fortis/Fortis.csproj index 64670c7ef..fbcab458e 100644 --- a/ReportImp/Fortis/Fortis.csproj +++ b/ReportImp/Fortis/Fortis.csproj @@ -62,6 +62,7 @@ + Component diff --git a/ReportImp/Fortis/Quittierungsbeleg.Designer.cs b/ReportImp/Fortis/Quittierungsbeleg.Designer.cs index bcf6a02e4..c913d05a8 100644 --- a/ReportImp/Fortis/Quittierungsbeleg.Designer.cs +++ b/ReportImp/Fortis/Quittierungsbeleg.Designer.cs @@ -41,8 +41,6 @@ namespace Fortis DevExpress.XtraReports.UI.XRSummary xrSummary9 = new DevExpress.XtraReports.UI.XRSummary(); DevExpress.XtraReports.UI.XRSummary xrSummary10 = new DevExpress.XtraReports.UI.XRSummary(); DevExpress.XtraReports.UI.XRSummary xrSummary11 = new DevExpress.XtraReports.UI.XRSummary(); - DevExpress.XtraReports.UI.XRSummary xrSummary12 = new DevExpress.XtraReports.UI.XRSummary(); - DevExpress.XtraReports.UI.XRSummary xrSummary13 = new DevExpress.XtraReports.UI.XRSummary(); this.Detail = new DevExpress.XtraReports.UI.DetailBand(); this.DetailReport = new DevExpress.XtraReports.UI.DetailReportBand(); this.Detail1 = new DevExpress.XtraReports.UI.DetailBand(); @@ -93,7 +91,6 @@ namespace Fortis this.xrTableCell21 = new DevExpress.XtraReports.UI.XRTableCell(); this.xrTableCell22 = new DevExpress.XtraReports.UI.XRTableCell(); this.xrTableCell49 = new DevExpress.XtraReports.UI.XRTableCell(); - this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components); this.formattingRuleStartDate = new DevExpress.XtraReports.UI.FormattingRule(); this.ReportHeader = new DevExpress.XtraReports.UI.ReportHeaderBand(); this.xrLabel3 = new DevExpress.XtraReports.UI.XRLabel(); @@ -126,10 +123,11 @@ namespace Fortis this.fieldKontaktArt = new DevExpress.XtraReports.UI.CalculatedField(); this.Dauer = new DevExpress.XtraReports.UI.CalculatedField(); this.True = new DevExpress.XtraReports.UI.FormattingRule(); + this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components); ((System.ComponentModel.ISupportInitialize)(this.xrTable3)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.xrTableServiceRecords1)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.xrTable1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this)).BeginInit(); // // Detail @@ -325,7 +323,7 @@ namespace Fortis // this.xrTableCell42.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(226)))), ((int)(((byte)(240)))), ((int)(((byte)(217))))); this.xrTableCell42.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { - new DevExpress.XtraReports.UI.XRBinding("Text", null, "Services.ServiceCategoryAbbr")}); + new DevExpress.XtraReports.UI.XRBinding("Text", null, "Services.EmployeeCount", "{0:0}")}); this.xrTableCell42.Name = "xrTableCell42"; this.xrTableCell42.StylePriority.UseBackColor = false; this.xrTableCell42.StylePriority.UseTextAlignment = false; @@ -347,7 +345,7 @@ namespace Fortis // this.xrTableCell45.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(169)))), ((int)(((byte)(209)))), ((int)(((byte)(142))))); this.xrTableCell45.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { - new DevExpress.XtraReports.UI.XRBinding("Text", null, "Services.StartDateString")}); + new DevExpress.XtraReports.UI.XRBinding("Text", null, "Services.CustomerCount")}); this.xrTableCell45.Name = "xrTableCell45"; this.xrTableCell45.StylePriority.UseBackColor = false; this.xrTableCell45.StylePriority.UseTextAlignment = false; @@ -379,7 +377,7 @@ namespace Fortis this.xrTableCell18.StylePriority.UseFont = false; this.xrTableCell18.StylePriority.UseTextAlignment = false; this.xrTableCell18.Text = "xrTableCell18"; - this.xrTableCell18.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft; + this.xrTableCell18.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; this.xrTableCell18.Weight = 0.063131315799868082D; // // xrTableCell17 @@ -393,7 +391,7 @@ namespace Fortis this.xrTableCell17.StylePriority.UseFont = false; this.xrTableCell17.StylePriority.UseTextAlignment = false; this.xrTableCell17.Text = "xrTableCell17"; - this.xrTableCell17.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft; + this.xrTableCell17.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; this.xrTableCell17.Weight = 0.063131313391599567D; // // xrTableCell50 @@ -408,7 +406,7 @@ namespace Fortis this.xrTableCell50.StylePriority.UseFont = false; this.xrTableCell50.StylePriority.UsePadding = false; this.xrTableCell50.StylePriority.UseTextAlignment = false; - this.xrTableCell50.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft; + this.xrTableCell50.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; this.xrTableCell50.Weight = 0.063131320138792066D; // // GroupHeader1 @@ -845,10 +843,6 @@ namespace Fortis this.xrTableCell49.TextAlignment = DevExpress.XtraPrinting.TextAlignment.TopCenter; this.xrTableCell49.Weight = 0.13966474814693633D; // - // bindingSource1 - // - this.bindingSource1.DataSource = typeof(BeWo.Report.ReportObjects.ServicesOverviewRO); - // // formattingRuleStartDate // this.formattingRuleStartDate.Condition = "[StartDate2] < [StartDate]"; @@ -1145,14 +1139,9 @@ namespace Fortis // // xrTableCell46 // - this.xrTableCell46.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { - new DevExpress.XtraReports.UI.XRBinding("Text", null, "Services.ServiceCategoryAbbr")}); this.xrTableCell46.Name = "xrTableCell46"; this.xrTableCell46.StylePriority.UseBackColor = false; this.xrTableCell46.StylePriority.UseTextAlignment = false; - xrSummary9.FormatString = "{0:0}"; - xrSummary9.Running = DevExpress.XtraReports.UI.SummaryRunning.Group; - this.xrTableCell46.Summary = xrSummary9; this.xrTableCell46.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; this.xrTableCell46.Weight = 0.055555632806937594D; // @@ -1163,22 +1152,17 @@ namespace Fortis this.xrTableCell47.Name = "xrTableCell47"; this.xrTableCell47.StylePriority.UseBackColor = false; this.xrTableCell47.StylePriority.UseTextAlignment = false; - xrSummary10.FormatString = "{0:0}"; - xrSummary10.Running = DevExpress.XtraReports.UI.SummaryRunning.Group; - this.xrTableCell47.Summary = xrSummary10; + xrSummary9.FormatString = "{0:0}"; + xrSummary9.Running = DevExpress.XtraReports.UI.SummaryRunning.Group; + this.xrTableCell47.Summary = xrSummary9; this.xrTableCell47.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; this.xrTableCell47.Weight = 0.055555325752703361D; // // xrTableCell51 // - this.xrTableCell51.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { - new DevExpress.XtraReports.UI.XRBinding("Text", null, "Services.StartDateString")}); this.xrTableCell51.Name = "xrTableCell51"; this.xrTableCell51.StylePriority.UseBackColor = false; this.xrTableCell51.StylePriority.UseTextAlignment = false; - xrSummary11.FormatString = "{0:0}"; - xrSummary11.Running = DevExpress.XtraReports.UI.SummaryRunning.Group; - this.xrTableCell51.Summary = xrSummary11; this.xrTableCell51.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; this.xrTableCell51.Weight = 0.055555593812079931D; // @@ -1192,9 +1176,9 @@ namespace Fortis this.xrTableCell52.StylePriority.UseFont = false; this.xrTableCell52.StylePriority.UsePadding = false; this.xrTableCell52.StylePriority.UseTextAlignment = false; - xrSummary12.FormatString = "{0:0}"; - xrSummary12.Running = DevExpress.XtraReports.UI.SummaryRunning.Group; - this.xrTableCell52.Summary = xrSummary12; + xrSummary10.FormatString = "{0:0}"; + xrSummary10.Running = DevExpress.XtraReports.UI.SummaryRunning.Group; + this.xrTableCell52.Summary = xrSummary10; this.xrTableCell52.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; this.xrTableCell52.Weight = 0.055555634752644537D; // @@ -1229,10 +1213,10 @@ namespace Fortis this.xrTableCell55.StylePriority.UseFont = false; this.xrTableCell55.StylePriority.UsePadding = false; this.xrTableCell55.StylePriority.UseTextAlignment = false; - xrSummary13.FormatString = "{0:0}"; - xrSummary13.Running = DevExpress.XtraReports.UI.SummaryRunning.Group; - this.xrTableCell55.Summary = xrSummary13; - this.xrTableCell55.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft; + xrSummary11.FormatString = "{0:0}"; + xrSummary11.Running = DevExpress.XtraReports.UI.SummaryRunning.Group; + this.xrTableCell55.Summary = xrSummary11; + this.xrTableCell55.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; this.xrTableCell55.Weight = 0.063131320138792066D; // // fieldKontaktArt @@ -1253,6 +1237,10 @@ namespace Fortis // this.True.Name = "True"; // + // bindingSource1 + // + this.bindingSource1.DataSource = typeof(BeWo.Report.ReportObjects.ServicesOverviewRO); + // // Quittierungsbeleg // this.Bands.AddRange(new DevExpress.XtraReports.UI.Band[] { @@ -1280,8 +1268,8 @@ namespace Fortis this.Version = "17.1"; ((System.ComponentModel.ISupportInitialize)(this.xrTable3)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.xrTableServiceRecords1)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.xrTable1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this)).EndInit(); } diff --git a/ReportImp/Fortis/Quittierungsbeleg.cs b/ReportImp/Fortis/Quittierungsbeleg.cs index c46987acb..0b23af794 100644 --- a/ReportImp/Fortis/Quittierungsbeleg.cs +++ b/ReportImp/Fortis/Quittierungsbeleg.cs @@ -22,49 +22,157 @@ namespace Fortis { if (pRO.Services != null) { - //H Hausbesuch = Notice - //B Begleitung im Sozialraum = Notice2 - //T Kontakt per Telefon etc. = Notice3 - //GD Kontakt mit Leistungsberechtigten in der Dienststelle = Notice4 - //KL Kompensatorische Leistung ohne LB = Notice5 - //AK Assistenz im Krankenhaus = ServiceCategory - //MA Anzahl Mitarbeitende = ServiceCategoryAbbr - //GI Gemeinsame Inanspruchnahme = GefahreneKilometer - - //Größe = StartDateString - //Summe1 = TimeRangeString - //Beginn = EmployeeFirstName - //Ende = EmployeeFullname - //Summe2 = EmployeeLastname + Dictionary tag2Details = new Dictionary(); foreach (var sr in pRO.Services) { - sr.Notice = String.Format("{0:0}", sr.Minutes); - sr.Notice2 = ""; - sr.Notice3 = ""; - sr.Notice4 = ""; - sr.Notice5 = ""; - sr.ServiceCategory = ""; - sr.ServiceCategoryAbbr = ""; - sr.GefahreneKilometer = ""; - sr.StartDateString = ""; - sr.TimeRangeString = ""; - sr.EmployeeFirstName = ""; - sr.EmployeeFullname = ""; - sr.EmployeeLastName = ""; - - if (sr.ServiceDescription == "Hausbesuch") - + FortisServiceRecord fsr = null; + if (!tag2Details.ContainsKey(sr.StartDate.Day)) { - sr.Notice = String.Format("{0:0}", sr.Minutes); + fsr = new FortisServiceRecord(); + tag2Details.Add(sr.StartDate.Day, fsr); + } + else + { + fsr = tag2Details[sr.StartDate.Day]; } - sr.ServiceDescription = ""; + if (sr.ServiceDescription.Contains("Wohnraum")) + + { + fsr.MinutenH += sr.Minutes; + } + else if (sr.ServiceDescription.Contains("Sozialraum")) + + { + fsr.MinutenB += sr.Minutes; + } + else if (sr.ServiceDescription.Contains("Telefon")) + + { + fsr.MinutenT += sr.Minutes; + } + else if (sr.ServiceDescription.Contains("Dienststelle")) + + { + fsr.MinutenGD += sr.Minutes; + } + else if (sr.ServiceDescription.Contains("pool")) + + { + fsr.MinutenGI += sr.Minutes; + } + else if (sr.ServiceDescription.Contains("Kompensatorisch")) + + { + fsr.MinutenKL += sr.Minutes; + } + else if (sr.ServiceDescription.Contains("Krankenhaus")) + + { + fsr.MinutenAK += sr.Minutes; + } + else if (sr.ServiceDescription.Contains("abgesagt")) + { + fsr.FehlkontaktBeginn = sr.StartDate; + fsr.FehlkontaktEnde = sr.EndDate; + } + fsr.AnzahlMA += sr.EmployeeCount; + fsr.Groesse += sr.CustomerCount; } + + List newServices = new List(); + + + for (int i = pRO.StartDate.Day; i <= pRO.EndDate.Day; i++) + { + if (tag2Details.ContainsKey(i)) + { + var fsr = tag2Details[i]; + + var sr = new ServicesOverviewRO.ServiceDetail(); + sr.StartDate = new DateTime(pRO.StartDate.Year, pRO.StartDate.Month, i); + + //H Hausbesuch = Notice + //B Begleitung im Sozialraum = Notice2 + //T Kontakt per Telefon etc. = Notice3 + //GD Kontakt mit Leistungsberechtigten in der Dienststelle = Notice4 + //KL Kompensatorische Leistung ohne LB = Notice5 + //AK Assistenz im Krankenhaus = ServiceCategory + //MA Anzahl Mitarbeitende = ServiceCategoryAbbr (EmployeeCount) + //GI Gemeinsame Inanspruchnahme = GefahreneKilometer + + //Größe = StartDateString (CustomerCount) + //Summe1 = TimeRangeString + //Beginn = EmployeeFirstName + //Ende = EmployeeFullname + //Summe2 = EmployeeLastname + if (fsr.MinutenH > 0) + { + sr.Notice = String.Format("{0:0}", fsr.MinutenH); + } + if (fsr.MinutenB > 0) + { + sr.Notice2 = String.Format("{0:0}", fsr.MinutenB); + } + if (fsr.MinutenT > 0) + { + sr.Notice3 = String.Format("{0:0}", fsr.MinutenT); + } + if (fsr.MinutenGD > 0) + { + sr.Notice4 = String.Format("{0:0}", fsr.MinutenGD); + } + if (fsr.MinutenKL > 0) + { + sr.Notice5 = String.Format("{0:0}", fsr.MinutenKL); + } + if (fsr.MinutenAK > 0) + { + sr.ServiceCategory = String.Format("{0:0}", fsr.MinutenAK); + } + if (fsr.MinutenGI > 0) + { + sr.GefahreneKilometer = String.Format("{0:0}", fsr.MinutenGI); + } + + sr.EmployeeCount = fsr.AnzahlMA; + sr.CustomerCount = fsr.Groesse; + + sr.TimeRangeString = String.Format("{0:0}", fsr.MinutenH + fsr.MinutenB + fsr.MinutenT + fsr.MinutenGD + fsr.MinutenKL + fsr.MinutenAK + fsr.MinutenGI); + + if (fsr.FehlkontaktBeginn.HasValue && fsr.FehlkontaktEnde.HasValue) + { + sr.EmployeeFirstName = String.Format("{0:HH:mm}", fsr.FehlkontaktBeginn); + sr.EmployeeFullname = String.Format("{0:HH:mm}", fsr.FehlkontaktEnde); + sr.EmployeeLastName = String.Format("{0:0}", fsr.FehlkontaktEnde.Value.Subtract(fsr.FehlkontaktBeginn.Value).TotalMinutes); + } + + newServices.Add(sr); + } + } + pRO.Services = newServices; + + } bindingSource1.DataSource = pRO; } } + + public class FortisServiceRecord + { + public double MinutenH { get; set; } + public double MinutenB { get; set; } + public double MinutenT { get; set; } + public double MinutenGD { get; set; } + public double MinutenKL { get; set; } + public double MinutenAK { get; set; } + public int AnzahlMA { get; set; } + public double MinutenGI { get; set; } + public int Groesse { get; set; } + public DateTime? FehlkontaktBeginn { get; set; } + public DateTime? FehlkontaktEnde { get; set; } + } } diff --git a/ReportImp/HphBersenbrueckFreizeitUndReisen/Abrechnung/CustomInvoiceCreation.cs b/ReportImp/HphBersenbrueckFreizeitUndReisen/Abrechnung/CustomInvoiceCreation.cs index 277dd446d..8934a0dc6 100644 --- a/ReportImp/HphBersenbrueckFreizeitUndReisen/Abrechnung/CustomInvoiceCreation.cs +++ b/ReportImp/HphBersenbrueckFreizeitUndReisen/Abrechnung/CustomInvoiceCreation.cs @@ -33,7 +33,8 @@ namespace HphBersenbrueckFreizeitUndReisen.Abrechnung //Reisen sollen getrennt abgerechnet werden. List serviceRecordsReise = new List(); - List serviceRecordsNichtReise = new List(); + List serviceRecordsKurzurlaub = new List(); + List serviceRecordsNichtUrlaubUndReise = new List(); foreach (var item in alleServiceRecords) { @@ -41,9 +42,13 @@ namespace HphBersenbrueckFreizeitUndReisen.Abrechnung { serviceRecordsReise.Add(item); } + else if (item.ServiceDescription.Name.ToLower().Contains("kurzurlaub")) + { + serviceRecordsReise.Add(item); + } else { - serviceRecordsNichtReise.Add(item); + serviceRecordsNichtUrlaubUndReise.Add(item); } } @@ -97,7 +102,7 @@ namespace HphBersenbrueckFreizeitUndReisen.Abrechnung IList pflegekassenRechnungen = null; if (pflegekasse != null) { - pflegekassenRechnungen = CreatePflegekassenRechnungen(invoiceCounter, pflegekasse, customer, invoicePeriod, sc, serviceRecordsNichtReise); + pflegekassenRechnungen = CreatePflegekassenRechnungen(invoiceCounter, pflegekasse, customer, invoicePeriod, sc, serviceRecordsNichtUrlaubUndReise); if (pflegekassenRechnungen != null && pflegekassenRechnungen.Count > 0) { @@ -109,6 +114,17 @@ namespace HphBersenbrueckFreizeitUndReisen.Abrechnung { var invoices = CreatePflegekassenRechnungen(invoiceCounter, pflegekasse, customer, invoicePeriod, sc, serviceRecordsReise); + if (invoices != null && invoices.Count > 0) + { + invoiceList.AddRange(invoices); + invoiceCounter++; + + } + } + if (serviceRecordsKurzurlaub.Count > 0) + { + var invoices = CreatePflegekassenRechnungen(invoiceCounter, pflegekasse, customer, invoicePeriod, sc, serviceRecordsKurzurlaub); + if (invoices != null && invoices.Count > 0) { invoiceList.AddRange(invoices); @@ -120,7 +136,7 @@ namespace HphBersenbrueckFreizeitUndReisen.Abrechnung if (selbszahler != null) { - var selbstzahlerRechnungen = CreateSelbstzahlerRechnungen(invoiceCounter, customer, invoicePeriod, sc, serviceRecordsNichtReise); + var selbstzahlerRechnungen = CreateSelbstzahlerRechnungen(invoiceCounter, customer, invoicePeriod, sc, serviceRecordsNichtUrlaubUndReise); foreach (var rg in selbstzahlerRechnungen) { @@ -150,6 +166,20 @@ namespace HphBersenbrueckFreizeitUndReisen.Abrechnung } } + if (serviceRecordsKurzurlaub.Count > 0) + { + var rglist = CreateSelbstzahlerRechnungen(invoiceCounter, customer, invoicePeriod, sc, serviceRecordsKurzurlaub); + + foreach (var rg in rglist) + { + if (rg.GetTotalClaim() > 0) + { + invoiceList.Add(rg); + invoiceCounter++; + } + } + + } } if (invoiceList.Count == 0) diff --git a/ReportImp/PerspektivenEV/CustomReportCreator.cs b/ReportImp/PerspektivenEV/CustomReportCreator.cs index 71cbab36b..374cf495e 100644 --- a/ReportImp/PerspektivenEV/CustomReportCreator.cs +++ b/ReportImp/PerspektivenEV/CustomReportCreator.cs @@ -54,8 +54,8 @@ namespace PerspektivenEV if (iDC.InvoiceBase.RecipientOrganisation != "Landeswohlfahrtsverband Hessen" && iDC.InvoiceBase.Type.ToString() == "Service" && iDC.ServiceInvoicePeriods.Count > 0 && iDC.ServiceInvoicePeriods[0].SupportConceptApprovalPeriod != null && iDC.ServiceInvoicePeriods[0].SupportConceptApprovalPeriod.ServiceCategory != null && iDC.ServiceInvoicePeriods[0].SupportConceptApprovalPeriod.ServiceCategory.Name.Contains("BW")) { - XtraReport masterReport = new XtraReport(); - masterReport.CreateDocument(); + //XtraReport masterReport = new XtraReport(); + //masterReport.CreateDocument(); var seite1 = new ServiceInvoiceReport(); var ro = ServiceInvoiceRO.Create(iDC); @@ -63,11 +63,11 @@ namespace PerspektivenEV seite1.SetReportDataSource(ro); seite1.CreateDocument(); - masterReport.Pages.AddRange(seite1.Pages); - foreach (DevExpress.XtraPrinting.Page item in masterReport.Pages) - { - item.AssignWatermark(seite1.Watermark); - } + //masterReport.Pages.AddRange(seite1.Pages); + //foreach (DevExpress.XtraPrinting.Page item in masterReport.Pages) + //{ + // item.AssignWatermark(seite1.Watermark); + //} // Anhang je nach Team erstellen var customerDC = MapperFactory.CustomerDC_Customer.MapToNewDC(DAOFactory.GenericDAO.GetByID(iDC.InvoiceBase.SupportConceptCostBearerRelDc.SupportConcept.Customer.CustomerOid)); @@ -75,7 +75,7 @@ namespace PerspektivenEV { var pfkAnhang = CreatePfkAnhang(iDC.InvoiceBase); pfkAnhang.CreateDocument(); - masterReport.Pages.AddRange(pfkAnhang.Pages); + seite1.Pages.AddRange(pfkAnhang.Pages); } else { @@ -86,10 +86,10 @@ namespace PerspektivenEV var qb = CreateServiceOverviewSingleCustomerReport(cOid, month, year, oOid, 0, null, 1, DateTime.DaysInMonth(year, month)); qb.CreateDocument(); - masterReport.Pages.AddRange(qb.Pages); + seite1.Pages.AddRange(qb.Pages); } - invoiceReport = masterReport; + invoiceReport = seite1; } else diff --git a/ReportImp/PerspektivenEV/InvoiceCustomerReport.Designer.cs b/ReportImp/PerspektivenEV/InvoiceCustomerReport.Designer.cs index 8001792f0..1d6c11ca9 100644 --- a/ReportImp/PerspektivenEV/InvoiceCustomerReport.Designer.cs +++ b/ReportImp/PerspektivenEV/InvoiceCustomerReport.Designer.cs @@ -582,6 +582,7 @@ namespace PerspektivenEV this.PaperKind = System.Drawing.Printing.PaperKind.A4; this.Version = "17.1"; this.Watermark.Image = ((System.Drawing.Image)(resources.GetObject("InvoiceCustomerReport.Watermark.Image"))); + this.Watermark.PageRange = "1"; ((System.ComponentModel.ISupportInitialize)(this.xrTable1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.xrTable3)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.xrTable4)).EndInit(); diff --git a/ReportImp/PerspektivenEV/SelbstzahlerInvoiceReport.Designer.cs b/ReportImp/PerspektivenEV/SelbstzahlerInvoiceReport.Designer.cs index e2ec5f825..a571f5453 100644 --- a/ReportImp/PerspektivenEV/SelbstzahlerInvoiceReport.Designer.cs +++ b/ReportImp/PerspektivenEV/SelbstzahlerInvoiceReport.Designer.cs @@ -598,6 +598,7 @@ namespace PerspektivenEV this.Version = "17.1"; this.Watermark.Image = ((System.Drawing.Image)(resources.GetObject("SelbstzahlerInvoiceReport.Watermark.Image"))); this.Watermark.ImageViewMode = DevExpress.XtraPrinting.Drawing.ImageViewMode.Zoom; + this.Watermark.PageRange = "1"; ((System.ComponentModel.ISupportInitialize)(this.xrTable1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.xrTable6)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.xrTable2)).EndInit(); diff --git a/ReportImp/PerspektivenEV/ServiceInvoiceReport.Designer.cs b/ReportImp/PerspektivenEV/ServiceInvoiceReport.Designer.cs index 6a49b5a3c..f36953880 100644 --- a/ReportImp/PerspektivenEV/ServiceInvoiceReport.Designer.cs +++ b/ReportImp/PerspektivenEV/ServiceInvoiceReport.Designer.cs @@ -73,8 +73,8 @@ namespace PerspektivenEV this.lblUeberweisung = new DevExpress.XtraReports.UI.XRLabel(); this.lblAnlage = new DevExpress.XtraReports.UI.XRLabel(); this.lblUeberweisungPfk = new DevExpress.XtraReports.UI.XRLabel(); - this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components); this.PageHeader = new DevExpress.XtraReports.UI.PageHeaderBand(); + this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components); ((System.ComponentModel.ISupportInitialize)(this.xrTable1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.xrTable6)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.xrTable2)).BeginInit(); @@ -660,15 +660,15 @@ namespace PerspektivenEV this.lblUeberweisungPfk.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft; this.lblUeberweisungPfk.Visible = false; // - // bindingSource1 - // - this.bindingSource1.DataSource = typeof(BeWo.Report.ReportObjects.ServiceInvoiceRO); - // // PageHeader // this.PageHeader.HeightF = 168.75F; this.PageHeader.Name = "PageHeader"; // + // bindingSource1 + // + this.bindingSource1.DataSource = typeof(BeWo.Report.ReportObjects.ServiceInvoiceRO); + // // ServiceInvoiceReport // this.Bands.AddRange(new DevExpress.XtraReports.UI.Band[] { diff --git a/ReportImp/PerspektivenEV/SettlementReport.Designer.cs b/ReportImp/PerspektivenEV/SettlementReport.Designer.cs index 148e79d76..1b02bdb0f 100644 --- a/ReportImp/PerspektivenEV/SettlementReport.Designer.cs +++ b/ReportImp/PerspektivenEV/SettlementReport.Designer.cs @@ -916,6 +916,7 @@ namespace BeWo.Report.DefaultReports.Alt this.Version = "17.1"; this.Watermark.Image = ((System.Drawing.Image)(resources.GetObject("Spitzabrechnung.Watermark.Image"))); this.Watermark.ImageViewMode = DevExpress.XtraPrinting.Drawing.ImageViewMode.Zoom; + this.Watermark.PageRange = "1"; ((System.ComponentModel.ISupportInitialize)(this.xrTable1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.xrTable3)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.xrTable5)).EndInit(); diff --git a/ReportImp/PerspektivenEV/SettlementReport2.Designer.cs b/ReportImp/PerspektivenEV/SettlementReport2.Designer.cs index ffa5c17ea..dc355229c 100644 --- a/ReportImp/PerspektivenEV/SettlementReport2.Designer.cs +++ b/ReportImp/PerspektivenEV/SettlementReport2.Designer.cs @@ -911,6 +911,7 @@ namespace BeWo.Report.DefaultReports this.Version = "17.1"; this.Watermark.Image = ((System.Drawing.Image)(resources.GetObject("Spitzabrechnung.Watermark.Image"))); this.Watermark.ImageViewMode = DevExpress.XtraPrinting.Drawing.ImageViewMode.Zoom; + this.Watermark.PageRange = "1"; ((System.ComponentModel.ISupportInitialize)(this.xrTable1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.xrTable3)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.xrTable4)).EndInit(); diff --git a/ReportImp/SPZLeverkusen/Service/CustomSupportConceptAnalysisCreator.cs b/ReportImp/SPZLeverkusen/Service/CustomSupportConceptAnalysisCreator.cs index e3158a991..3552c9122 100644 --- a/ReportImp/SPZLeverkusen/Service/CustomSupportConceptAnalysisCreator.cs +++ b/ReportImp/SPZLeverkusen/Service/CustomSupportConceptAnalysisCreator.cs @@ -23,28 +23,8 @@ namespace SPZLeverkusen.Service { public override List GetSupportConceptAnalysis2(IList c2sOids, long? employeeOid, long? teamOid, long? catOid, DateTime? startDate, DateTime? endDate, int? expiredMonths, bool showArchivedScs) { - ApplicationUser loggedInUser = null; + ApplicationUser loggedInUser = UserRightHelper.GetLoggedInUser(); - if (LoggedInUserOperationContextExt.Current != null && LoggedInUserOperationContextExt.Current.User != null) - { - loggedInUser = LoggedInUserOperationContextExt.Current.User; - } - else - { - loggedInUser = SessionFacade.LoggedInUser; - } - - bool isLeitung = false; - if (loggedInUser != null && loggedInUser.Employee != null) - { - foreach (var ug in loggedInUser.UserGroups) - { - if (ug.Name.ToLower().Contains("leitung")) - { - isLeitung = true; - } - } - } if ((employeeOid.HasValue && !teamOid.HasValue) || (!employeeOid.HasValue && !teamOid.HasValue)) { diff --git a/ReportImp/SPZLeverkusen/Service/SpzCustomerService.cs b/ReportImp/SPZLeverkusen/Service/SpzCustomerService.cs index 7670c1d52..d8aaad61d 100644 --- a/ReportImp/SPZLeverkusen/Service/SpzCustomerService.cs +++ b/ReportImp/SPZLeverkusen/Service/SpzCustomerService.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using BeWo.Data; using BeWo.Data.Entities; +using BeWo.Data.Security; using BeWo.Service.Plugins; using BS.Shared; using BS.Shared.DataContracts.Compact; @@ -17,53 +18,22 @@ namespace SPZLeverkusen.Service public override List GetAllActiveCustomersCompact(bool fetchReferenceNumbers, long? currentEmployeeOid) { var customer = base.GetAllActiveCustomersCompact(fetchReferenceNumbers, currentEmployeeOid); - - ApplicationUser loggedInUser = null; - if (LoggedInUserOperationContextExt.Current != null && LoggedInUserOperationContextExt.Current.User != null) - { - loggedInUser = LoggedInUserOperationContextExt.Current.User; - } - else - { - loggedInUser = SessionFacade.LoggedInUser; - } - - if (loggedInUser != null && loggedInUser.Employee != null) + + if (UserRightHelper.LoggedInUserHasRight(UserRightType.Customer_ViewMyTeams)) { - if (HasRight(loggedInUser, UserRightType.Customer_ViewMyTeams)) + foreach (var c in customer) { - - foreach (var c in customer) + if (c.IsRelatedToTeam) { - if (c.IsRelatedToTeam) - { - c.IsRelatedToEmployee = true; - } + c.IsRelatedToEmployee = true; } } } + return customer; } - private static bool HasRight(ApplicationUser user, UserRightType right) - { - return GetGrantedRights(user).Contains(right); - } - - public static List GetGrantedRights(ApplicationUser user) - { - var rights = new List(); - foreach (var ug in user.UserGroups) - { - foreach (var rr in ug.Rights) - { - rights.Add(rr.RightType); - } - } - - return rights; - } } } \ No newline at end of file diff --git a/ReportImp/SPZLeverkusen/Service/SpzEmployeeService.cs b/ReportImp/SPZLeverkusen/Service/SpzEmployeeService.cs index 715b2a2b5..85705a524 100644 --- a/ReportImp/SPZLeverkusen/Service/SpzEmployeeService.cs +++ b/ReportImp/SPZLeverkusen/Service/SpzEmployeeService.cs @@ -24,103 +24,5 @@ namespace SPZLeverkusen.Service return MapperFactory.CompactEmployeeDC_Employee.MapToNewDCs(FilterList(employees)); } - public static IList FilterList(IList employees) - { - List newList = new List(); - ApplicationUser loggedInUser = null; - if (LoggedInUserOperationContextExt.Current != null && LoggedInUserOperationContextExt.Current.User != null) - { - loggedInUser = LoggedInUserOperationContextExt.Current.User; - } - else - { - loggedInUser = SessionFacade.LoggedInUser; - } - - if (loggedInUser != null && loggedInUser.Employee != null) - { - if (HasRight(loggedInUser, UserRightType.EmployeeView_View)) - { - return employees; - } - if (HasRight(loggedInUser, UserRightType.Employee_AllowViewOwnTeam)) - { - var teams = DAOFactory.SearchDAO.FindAllActiveTeamsOfEmployee(loggedInUser.Employee.Oid.Value); - - foreach (var e in employees) - { - if (BelongsToTeam(teams, loggedInUser, e)) - { - newList.Add(e); - } - } - } - else if (HasRight(loggedInUser, UserRightType.Employee_AllowViewOwnEmployees)) - { - foreach (var e in employees) - { - if (e.Oid == loggedInUser.Employee.Oid) - { - newList.Add(e); - } - } - } - } - - return newList; - } - - public static bool BelongsToTeam(IList teams, ApplicationUser loggedInUser, Employee emp) - { - //var teams = loggedInUser.Employee.LeadingTeams; - - //foreach (var team in teams) - //{ - // foreach (var member in team.MemberList) - // { - // if (member.Oid == compactEmployeeDc.EmployeeOid) - // { - // return true; - // } - // } - //} - - - foreach (var team in teams) - { - if (team.Leader != null && team.Leader.Oid == emp.Oid) - { - return true; - } - foreach (var member in team.MemberList) - { - if (member.Oid == emp.Oid) - { - return true; - } - } - } - return false; - } - - private static bool HasRight(ApplicationUser user, UserRightType right) - { - return GetGrantedRights(user).Contains(right); - - } - - public static List GetGrantedRights(ApplicationUser user) - { - var rights = new List(); - foreach (var ug in user.UserGroups) - { - foreach (var rr in ug.Rights) - { - rights.Add(rr.RightType); - } - } - - return rights; - } } } \ No newline at end of file diff --git a/ReportImp/SeWo/Validation/ServiceRecordValidator.cs b/ReportImp/SeWo/Validation/ServiceRecordValidator.cs index cd41396a6..df9e579fa 100644 --- a/ReportImp/SeWo/Validation/ServiceRecordValidator.cs +++ b/ReportImp/SeWo/Validation/ServiceRecordValidator.cs @@ -16,6 +16,10 @@ namespace SeWo.Validation public override List ValidateServiceRecord(ServiceRecordDC newServiceRecord, SupportConceptStatisticsDC statistics, int maxDaysEditServiceRecordsAllowed, IList employeeOids, IList cb2scOids) { + if (newServiceRecord.SupportConcept == null && newServiceRecord.CostBearer == null) + { + newServiceRecord.CostBearer2SupportConceptOid = null; + } var result = base.ValidateServiceRecord(newServiceRecord, statistics, maxDaysEditServiceRecordsAllowed, employeeOids, cb2scOids); bool hasOutOfEditLimit = false; diff --git a/Service/Plugins/EmployeeService.cs b/Service/Plugins/EmployeeService.cs index ca4eb74ea..83b7857ac 100644 --- a/Service/Plugins/EmployeeService.cs +++ b/Service/Plugins/EmployeeService.cs @@ -5,6 +5,7 @@ using System.Linq; using BeWo.Data; using BeWo.Data.Access; using BeWo.Data.Entities; +using BeWo.Data.Security; using BeWo.Service.Core; using BeWo.Service.DCEntityMapper; using BeWo.Service.MessageContracts; @@ -52,7 +53,7 @@ namespace BeWo.Service.Plugins public virtual List GetAllTeamsCompact() { - var loggedInUser = GetLoggedInUser(); + var loggedInUser = UserRightHelper.GetLoggedInUser(); if (Utils.UserHasRight(loggedInUser, UserRightType.TeamView_ViewAll)) { @@ -120,7 +121,7 @@ namespace BeWo.Service.Plugins public virtual List GetAllAuthorizedCompactEmployees() { - var user = GetLoggedInUser(); + var user = UserRightHelper.GetLoggedInUser(); var employees = DAOFactory.GenericDAO.GetAllActive(); @@ -186,15 +187,74 @@ namespace BeWo.Service.Plugins return result.OrderBy(e => e.LastName).ToList(); } - private ApplicationUser GetLoggedInUser() + public static IList FilterList(IList employees) { + List newList = new List(); - if(LoggedInUserOperationContextExt.Current != null && LoggedInUserOperationContextExt.Current.User != null) + var loggedInUser = UserRightHelper.GetLoggedInUser(); + + if (UserRightHelper.UserHasRight(loggedInUser, UserRightType.EmployeeView_View)) { - return LoggedInUserOperationContextExt.Current.User; + return employees; } + if (UserRightHelper.UserHasRight(loggedInUser, UserRightType.Employee_AllowViewOwnTeam)) + { + var teams = DAOFactory.SearchDAO.FindAllActiveTeamsOfEmployee(loggedInUser.Employee.Oid.Value); - return SessionFacade.LoggedInUser; + foreach (var e in employees) + { + if (BelongsToTeam(teams, loggedInUser, e)) + { + newList.Add(e); + } + } + } + else if (UserRightHelper.UserHasRight(loggedInUser, UserRightType.Employee_AllowViewOwnEmployees)) + { + foreach (var e in employees) + { + if (e.Oid == loggedInUser.Employee.Oid) + { + newList.Add(e); + } + } + } + + + return newList; + } + + public static bool BelongsToTeam(IList teams, ApplicationUser loggedInUser, Employee emp) + { + //var teams = loggedInUser.Employee.LeadingTeams; + + //foreach (var team in teams) + //{ + // foreach (var member in team.MemberList) + // { + // if (member.Oid == compactEmployeeDc.EmployeeOid) + // { + // return true; + // } + // } + //} + + + foreach (var team in teams) + { + if (team.Leader != null && team.Leader.Oid == emp.Oid) + { + return true; + } + foreach (var member in team.MemberList) + { + if (member.Oid == emp.Oid) + { + return true; + } + } + } + return false; } } } diff --git a/Service/Plugins/PluginLoader.cs b/Service/Plugins/PluginLoader.cs index 967f72bf3..1b090deff 100644 --- a/Service/Plugins/PluginLoader.cs +++ b/Service/Plugins/PluginLoader.cs @@ -70,7 +70,7 @@ namespace BeWo.Service.Plugins //t = "5351926758"; // Viva a Vida //t = "2215396183"; // Diakonie Remscheid Lennep //t = "5157599087"; // SHG Schwerte - //t = "4526293996"; // Fortis + t = "4526293996"; // Fortis //t = "3647969417"; // Caritas Bottrop //t = "3057313346"; // SSB Mainz //t = "6246287823"; // BeWo Alsdorf @@ -85,7 +85,7 @@ namespace BeWo.Service.Plugins //t = "4867997795"; // ADiK Kleve //t = "3184859776"; // Sergej Becker //t = "7752610643"; // BWK Gbr - t = "3785623125"; // Betreuwo + //t = "3785623125"; // Betreuwo //t = "7130228334"; // LH Borken //t = "4209820830"; // VKM Hamm //t = "5700328131"; // Betreutes Wohnen St. Ludgerus Essen-Werden @@ -357,7 +357,7 @@ namespace BeWo.Service.Plugins //t = "4434019324"; // FENIX Soziale Dienste //t = "6219220038"; // SKM Kreis Viersen e.V. //t = "1372050368"; // Petra Wagner Matthes - t = "1253359817"; // Lebenshilfe Bad Kreuznach e.V. + //t = "1253359817"; // Lebenshilfe Bad Kreuznach e.V. //t = "6038574522"; // I-Wohl //t = "2438529184"; // Alloheim Seniorenresidenzen SE //t = "7564067748"; // SKM Aachen diff --git a/Service/Plugins/ServiceRecordValidator.cs b/Service/Plugins/ServiceRecordValidator.cs index c1a8b57aa..e934311aa 100644 --- a/Service/Plugins/ServiceRecordValidator.cs +++ b/Service/Plugins/ServiceRecordValidator.cs @@ -315,7 +315,7 @@ namespace BeWo.Service.Plugins long? cb2ScOid = null; - if (newServiceRecord.CostBearer2SupportConceptOid.HasValue) + if (newServiceRecord.SupportConcept != null && newServiceRecord.CostBearer != null && newServiceRecord.CostBearer2SupportConceptOid.HasValue) { cb2ScOid = newServiceRecord.CostBearer2SupportConceptOid.Value; } diff --git a/Service/Plugins/SupportConceptAnalysisCreator.cs b/Service/Plugins/SupportConceptAnalysisCreator.cs index f16f946ab..c30f822b6 100644 --- a/Service/Plugins/SupportConceptAnalysisCreator.cs +++ b/Service/Plugins/SupportConceptAnalysisCreator.cs @@ -638,6 +638,7 @@ namespace BeWo.Service.Plugins iDC.CustomerFirstName = sc.Customer.Person.FirstName; iDC.CustomerLastName = sc.Customer.Person.LastName; + var costRates = c2s.CostBearer.CostRatePeriods.MapToNewDCs(); iDC.ServiceUnit = costRates.GetCurrentlyValidRate(CostRatePeriodType.MinutesPerServiceUnit); @@ -667,7 +668,7 @@ namespace BeWo.Service.Plugins decimal lDurationInWeeksTillNow = 0; decimal lDurationInWeeks = 0; - if (iDC.CustomerLastName == "Abba") + if (iDC.CustomerLastName == "Yavuz") { int test = 0; } @@ -706,6 +707,24 @@ namespace BeWo.Service.Plugins var records = GetServiceRecordDCs(c2s, minDt, maxDt); iDC.ServiceRecords = records; + + //decimal tempDuration = 0; + //foreach (var temp in records) + //{ + // if (temp.ServiceDescription.Category.IsBillable) + // { + // var dur = temp.RoundedDuration; + + + // if (temp.GroupEmployeeCount.HasValue && temp.GroupEmployeeCount > 1) + // { + // dur /= temp.GroupEmployeeCount.Value; + // } + // tempDuration += dur; + // } + //} + //tempDuration /= 60; + iDC.FLSRecordedTillNow = BerechneGeleisteteStunden(records, calc); iDC.FLSBilledTillNow = iDC.FLSRecordedTillNow; diff --git a/Service/ServiceImplementations/QueryServiceImp.cs b/Service/ServiceImplementations/QueryServiceImp.cs index a32d1faae..cf24a3ab6 100644 --- a/Service/ServiceImplementations/QueryServiceImp.cs +++ b/Service/ServiceImplementations/QueryServiceImp.cs @@ -37,6 +37,8 @@ namespace BeWo.Service.ServiceImplementations sql = this.ReplaceQueryParameter(sql, parameter); } + sql = CheckAndModifySqlByUserRights(lQuery, sql); + table = DAOFactory.AdoDAO.ExecuteQuery(sql).Tables[0]; } if (table == null) @@ -53,6 +55,11 @@ namespace BeWo.Service.ServiceImplementations } } + private string CheckAndModifySqlByUserRights(Query lQuery, string sql) + { + return sql; + } + public List GetAllQueriesOfType(QueryType pType) { try