diff --git a/Report/ReportObjects/MitarbeiterstundenkontoRO.cs b/Report/ReportObjects/MitarbeiterstundenkontoRO.cs index fa37a0b19..f3708e8a0 100644 --- a/Report/ReportObjects/MitarbeiterstundenkontoRO.cs +++ b/Report/ReportObjects/MitarbeiterstundenkontoRO.cs @@ -354,7 +354,13 @@ namespace BeWo.Report.ReportObjects public int? BreakMinutes { get; set; } - public decimal SpecialHours { get; set; } - } + public int? MaxHoursUntilBreak2 { get; set; } + + public int? BreakMinutes2 { get; set; } + + public decimal SpecialHours { get; set; } + + public IList ZusammenhaengendeZeitraeume { get; set; } + } } } \ No newline at end of file diff --git a/Report/ReportObjects/ServiceInvoiceRO.cs b/Report/ReportObjects/ServiceInvoiceRO.cs index 2f57c219a..55380de6e 100644 --- a/Report/ReportObjects/ServiceInvoiceRO.cs +++ b/Report/ReportObjects/ServiceInvoiceRO.cs @@ -210,15 +210,15 @@ namespace BeWo.Report.ReportObjects } lResult.ApprovedBESum = pDC.ServiceInvoicePeriods.Sum(i => i.ApprovedBE).Value.ToString("0.00"); - lResult.ApprovedAmountSum = pDC.ServiceInvoicePeriods.Sum(i => i.ApprovedAmountDefaultHourlyRate ?? i.ApprovedFixedAmount).Value.ToString("0.00 €"); + lResult.ApprovedAmountSum = pDC.ServiceInvoicePeriods.Sum(i => i.ApprovedAmountDefaultHourlyRate ?? i.ApprovedFixedAmount).Value.ToString("c"); - lResult.AmountAdvancedPayments = pDC.AmountAdvancePayments.HasValue ? pDC.AmountAdvancePayments.Value.ToString("0.00 €") : "-"; + lResult.AmountAdvancedPayments = pDC.AmountAdvancePayments.HasValue ? pDC.AmountAdvancePayments.Value.ToString("c") : "-"; - lResult.AmountEquityContribution = pDC.AmountEquityContribution.HasValue ? pDC.AmountEquityContribution.Value.ToString("0.00 €") : "-"; + lResult.AmountEquityContribution = pDC.AmountEquityContribution.HasValue ? pDC.AmountEquityContribution.Value.ToString("c") : "-"; - lResult.GrossClaim = (pDC.ClaimSum ?? 0m).ToString("0.00 €"); - lResult.NetClaim = (pDC.EndClaim ?? 0m).ToString("0.00 €"); + lResult.GrossClaim = (pDC.ClaimSum ?? 0m).ToString("c"); + lResult.NetClaim = (pDC.EndClaim ?? 0m).ToString("c"); lResult.CreatorName = pDC.InvoiceBase.CreatorFirstName.ToStringNullCheck() + " " + pDC.InvoiceBase.CreatorLastName.ToStringNullCheck(); @@ -299,7 +299,7 @@ namespace BeWo.Report.ReportObjects }; decimal amount = pDC.ApprovedAmountDefaultHourlyRate ?? (pDC.ApprovedFixedAmount ?? 0); - result.ApprovedAmount = amount.ToString("0.00 €"); + result.ApprovedAmount = amount.ToString("c"); result.ApprovedBE = string.Empty; if (pDC.ApprovedBE.HasValue) @@ -312,7 +312,7 @@ namespace BeWo.Report.ReportObjects result.ApprovedHours = pDC.ApprovedHours; - result.Claim = (pDC.Claim ?? 0m).ToString("0.00 €"); + result.Claim = (pDC.Claim ?? 0m).ToString("c"); result.NotBillableString = pDC.NotBillableString; result.ServiceInvoiceItems = pDC.InvoiceItems.Select(ServiceInvoiceItemRO.Create).ToList(); @@ -378,9 +378,9 @@ namespace BeWo.Report.ReportObjects Duration = String.Format("{0:dd.MM.yy} - {1:dd.MM.yy}", pDC.ItemPeriodStart, pDC.ItemPeriodEnd), - GrossAmount = pDC.GrossAmountTotal.HasValue ? pDC.GrossAmountTotal.Value.ToString("0.00 €") : string.Empty, + GrossAmount = pDC.GrossAmountTotal.HasValue ? pDC.GrossAmountTotal.Value.ToString("c") : string.Empty, HourlyRate = pDC.AmountPerUnit, - HourlyRateString = pDC.AmountPerUnit.HasValue ? pDC.AmountPerUnit.Value.ToString("0.00 €") : string.Empty, + HourlyRateString = pDC.AmountPerUnit.HasValue ? pDC.AmountPerUnit.Value.ToString("c") : string.Empty, Hours = pDC.UnitCount, NetAmount = pDC.AmountTotal, RateFactor = pDC.RateFactor.HasValue ? pDC.RateFactor.Value.ToString("0.00") + " %" : string.Empty, diff --git a/Report/ReportObjects/ServiceRecordListRO.cs b/Report/ReportObjects/ServiceRecordListRO.cs index 295dcd528..b3bc22992 100644 --- a/Report/ReportObjects/ServiceRecordListRO.cs +++ b/Report/ReportObjects/ServiceRecordListRO.cs @@ -8,6 +8,7 @@ using BeWo.Service.Plugins; using BS.Shared; using BeWo.Data.Access; using BeWo.Data.Entities; +using BeWo.Service.DCEntityMapper; using BeWo.Service.ServiceImplementations; using BS.Shared.Core; using BS.Shared.DataContracts; @@ -251,6 +252,7 @@ namespace BeWo.Report.ReportObjects //} } + detail.ServiceRecord = dc; ro.ServiceRecordDetailList.Add(detail); } @@ -341,6 +343,8 @@ namespace BeWo.Report.ReportObjects public bool IsBillable { get; set; } public String Signature { get; set; } + + public ServiceRecordDC ServiceRecord { get; set; } } public class ServiceRecordStatistics diff --git a/Service/Core/Utils.cs b/Service/Core/Utils.cs index 23281df8f..cb540a7ab 100644 --- a/Service/Core/Utils.cs +++ b/Service/Core/Utils.cs @@ -1,9 +1,6 @@ using System; using System.Collections.Generic; using System.Configuration; -using System.Drawing; -using System.Drawing.Drawing2D; -using System.Drawing.Imaging; using System.Globalization; using System.IO; using System.Net; @@ -13,14 +10,11 @@ using System.ServiceModel; using System.ServiceModel.Channels; using System.Text; using System.Text.RegularExpressions; -using System.Windows.Media; -using System.Windows.Media.Imaging; using System.Xml; using BeWo.Data.Entities; using BeWo.Service.ServiceContracts; using BeWo.Data; using BS.Shared; -using DevExpress.XtraPrinting.Native; namespace BeWo.Service.Core { @@ -89,8 +83,8 @@ namespace BeWo.Service.Core to = ConfigurationManager.AppSettings.Get("SupportEMail"); if (String.IsNullOrEmpty(to)) to = "support@bewoplaner.de"; - - if (senderEMail == null) + + if (senderEMail == null) senderEMail = "bewoapp@bewoplaner.de"; if (to.Equals("support@bewoplaner.de")) @@ -113,20 +107,38 @@ namespace BeWo.Service.Core return false; } - MailMessage message = null; + String from = fromEMail; + + if (to.Equals("support@bewoplaner.de")) + { + var supportSenderMail = ConfigurationManager.AppSettings.Get("SupportSenderEMail"); + if (String.IsNullOrEmpty(supportSenderMail)) + supportSenderMail = "noreply@bewoplaner.de"; + + from = supportSenderMail; + + } + + + MailMessage message = null; if (String.IsNullOrEmpty(fromName)) - message = new MailMessage(fromEMail, to, subject, body); + message = new MailMessage(from, to, subject, body); else { - MailAddress fromMailAddress = new MailAddress(fromEMail, fromName); + MailAddress fromMailAddress = new MailAddress(from); MailAddress toMailAddress = new MailAddress(to); message = new MailMessage(fromMailAddress, toMailAddress); - //message.ReplyTo = new MailAddress(fromEMail, fromName); - message.Subject = subject; + message.Subject = subject; message.Body = body; } - message.BodyEncoding = Encoding.UTF8; + if (fromEMail != from) + { + message.ReplyToList.Add(new MailAddress(fromEMail, fromName)); + } + + + message.BodyEncoding = Encoding.UTF8; message.IsBodyHtml = false; var mailClient = new SmtpClient(smtpServer, 587) { Credentials = new NetworkCredential(smtpUser, smtpPassword) }; @@ -195,10 +207,9 @@ namespace BeWo.Service.Core { return true; } - } + } } return false; } - } } \ No newline at end of file diff --git a/Service/Invoicing/SettlementInvoiceCreation.cs b/Service/Invoicing/SettlementInvoiceCreation.cs index 1a52acbcc..58d8d38c6 100644 --- a/Service/Invoicing/SettlementInvoiceCreation.cs +++ b/Service/Invoicing/SettlementInvoiceCreation.cs @@ -210,6 +210,7 @@ namespace BeWo.Service.Invoicing periodEnd); } + var tolerancesInSpanList = relDC.CostBearer.CostRatePeriods.GetSpans(CostRatePeriodType.ServiceTolerance, periodStart, periodEnd).ToList(); @@ -346,7 +347,7 @@ namespace BeWo.Service.Invoicing } foreach (var iRecord in records) { - if (iRecord.ServiceDescription.ServiceCategory.IsBillable && IsServiceRecordBillable(iRecord)) + if (iRecord.ServiceDescription.ServiceCategory.IsBillable && IsServiceRecordBillable(iRecord)) { if (iRecord.GroupOid == null || !groupBookingDict.ContainsKey(iRecord.GroupOid.Value)) { @@ -488,13 +489,13 @@ namespace BeWo.Service.Invoicing } - public virtual bool IsServiceRecordBillable(ServiceRecord iRecord) - { - return true; - } + public virtual bool IsServiceRecordBillable(ServiceRecord iRecord) + { + return true; + } - public virtual decimal? CalculateMaxAmount(Settlement2DC si) - { + public virtual decimal? CalculateMaxAmount(Settlement2DC si) + { return null; } @@ -1116,7 +1117,7 @@ namespace BeWo.Service.Invoicing approvalPeriod.ApprovedTotal = months * approvalPeriod.ApprovedPerUnit; } else - { + { approvalPeriod.ApprovedTotal = Math.Round(approvalPeriod.Weeks * approvalPeriod.ApprovedPerUnit, 2, MidpointRounding.AwayFromZero); @@ -1127,57 +1128,9 @@ namespace BeWo.Service.Invoicing public virtual decimal GetTotalMonths(DateTime start, DateTime end) { - int restTageStart = 0; - int restTageEnd = 0; + var am = DateTimeUtils.GetTotalMonths(start, end); - DateTime startDt = start; - DateTime endDt = end; - - if (start > end) - { - return 0; - } - - if (startDt.Day > 1) - { - var endMonat = new DateTime(startDt.Year, startDt.Month, 1).AddMonths(1).AddDays(-1); - - if (endDt < endMonat) - { - endMonat = endDt; - } - restTageStart = endMonat.Subtract(startDt).Days + 1; - startDt = endMonat.AddDays(1); - } - if (startDt <= endDt && endDt.AddDays(1).Day != 1) - { - var startMonat = new DateTime(endDt.Year, endDt.Month, 1); - - restTageEnd += endDt.Subtract(startMonat).Days + 1; - - endDt = startMonat; - } - - int fullMonths = 0; - while (startDt < endDt) - { - fullMonths++; - startDt = startDt.AddMonths(1); - } - - decimal monthsTotal = fullMonths; - - if (restTageStart != 0) - { - monthsTotal += restTageStart / (decimal)DateTime.DaysInMonth(start.Date.Year, start.Date.Month); - - } - if (restTageEnd != 0) - { - monthsTotal += restTageEnd / (decimal)DateTime.DaysInMonth(end.Date.Year, end.Date.Month); - - } - return monthsTotal; + return am.AnzahlMonateGesamt; } public virtual decimal GetTotalQuarters(DateTime start, DateTime end) @@ -1234,5 +1187,6 @@ namespace BeWo.Service.Invoicing } return quartersTotal; } + } } diff --git a/Service/Plugins/PluginLoader.cs b/Service/Plugins/PluginLoader.cs index eb333f0ab..42807fffd 100644 --- a/Service/Plugins/PluginLoader.cs +++ b/Service/Plugins/PluginLoader.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Reflection; using BeWo.Data; using BS.Shared.Core; +using NHibernate.Mapping; namespace BeWo.Service.Plugins { @@ -15,11 +16,10 @@ namespace BeWo.Service.Plugins { #if DEBUG var t = "demo"; - t = "xxxx"; //t = "2356097460"; // Lebenshilfe Würzburg //t = "1234567890"; // Präsentationsdatenbank //t = "5687373602"; // LH Duisburg - //t = "5509064354"; // LH Duisburg Service Plus + //t = "5509064354"; // LH Duisburg Service Plus //t = "5620636022"; // GPZ Biberach //t = "8562233401"; // Sozialwirkstatt Schmitz //t = "1076891970"; // Assistenza @@ -37,7 +37,6 @@ namespace BeWo.Service.Plugins //t = "1378137009"; // BeWo Direkt //t = "3010479871"; // Aachener Verein //t = "3849764093"; // Club 74 - //t = "7375324044"; // Diakonie KKKleve //t = "5805202339"; // Wegweiser Betreuungsdienst //t = "2301474784"; // Hauskrankenpflege Leiendecker //t = "8243565510"; // Der Karren @@ -133,27 +132,29 @@ namespace BeWo.Service.Plugins //t = "4525013596"; // Hph Bersenbrück Freizeit und Reisen //t = "1609455614"; // Hph Bersenbrück Aph //t = "7852961459"; // B&B Betreutes Wohnen - //t = "8719930557"; //Lebenshilfe Rhein-Sieg + //t = "8719930557"; // Lebenshilfe Rhein-Sieg //t = "8947336185"; // Lebenshilfe Ahrweiler //t = "5712358157"; // FINDUS //t = "8828216586"; // Caritas Aachen - //t = "7062943632"; // ABW Elsebrock - //t = "3956369664"; // LH Wetterau - //t = "3984525482"; //API Berlin - //t = "9975231461"; // Selwo - //t = "8181286349"; // BeWo am Rhein - //t = "3549726254"; // Socia Köln - //t = "4595275645"; // Eigenständig Hennef - // t = "7381352241"; // Ressource e.V. - //t = "7912635399"; //Prof Eggers Stiftung - //t = "5562845955";//Praunheimer WerkstaettenGmbh - //t = "1106039294"; //HphBersenbrueckAtz - //t = "3607551608"; // BetreuungsBuero Scholz - //t = "3104936392"; //B.A.P. Bielefelder Ambulante Pflege - //t = "3852198843"; // Lebenshilfe Mannheim e.V. - //t = "9800364930"; //BeWoLeverkusen - //t = "4439874912"; //SultanSahin - + //t = "7062943632"; // ABW Elsebrock + //t = "3956369664"; // LH Wetterau + //t = "3984525482"; // API Berlin + //t = "9975231461"; // Selwo + //t = "8181286349"; // BeWo am Rhein + //t = "4595275645"; // Eigenständig + //t = "7912635399"; // Prof. Dr. Eggers Stiftung + //t = "3549726254"; // Socia + //t = "1992495802"; // Monvita + //t = "7381352241"; // Ressource e.V. + //t = "3607551608"; // Betreuungsbüro Scholz + //t = "3104936392"; // B.A.P. Bielefelder Ambulante Pflege + //t = "1106039294"; // Hph Bersenbrück ATZ + //t = "5562845955"; // Praunheimer Werkstätten + //t = "4801617798"; // Severin + //t = "1172092025"; // Flingern + //t = "3852198843"; // LH Mannheim + //t = "9800364930"; // BeWo Leverkusen + t = "4439874912"; //BeWo Sahin return t; #else if (MultitenancyOperationContextExt.Current != null) @@ -268,31 +269,31 @@ namespace BeWo.Service.Plugins } } + + if (result == null) + { + var list2 = lAllTypes.Where(t => typeof (T).IsAssignableFrom(t)).ToList(); - if (result == null) - { - var list2 = lAllTypes.Where(t => typeof(T).IsAssignableFrom(t)).ToList(); - - var list = list2.Where(t => t.GetCustomAttributes(typeof(IgnoreAutoPluginAttribute), true).Length == 0).ToList(); + var list = list2.Where(t => t.GetCustomAttributes(typeof (IgnoreAutoPluginAttribute), true).Length == 0).ToList(); if (list.Count == 1) - result = (T)Activator.CreateInstance(list[0]); - else if (list.Count > 1) - { - foreach (var type in list) - { - var attrs = type.GetCustomAttributes(typeof(IDSpecificClassAttribute), true); - if (attrs.Length == 0) - return (T)Activator.CreateInstance(type); - } + result = (T)Activator.CreateInstance(list[0]); + else if (list.Count > 1) + { + foreach (var type in list) + { + var attrs = type.GetCustomAttributes(typeof(IDSpecificClassAttribute), true); + if (attrs.Length == 0) + return (T)Activator.CreateInstance(type); + } - result = (T)Activator.CreateInstance(list[0]); - } + result = (T)Activator.CreateInstance(list[0]); + } - } + } - return result; + return result; } } } diff --git a/Service/ServiceImplementations/AccountingServiceImp.cs b/Service/ServiceImplementations/AccountingServiceImp.cs index b16bb35d8..48ea69b47 100644 --- a/Service/ServiceImplementations/AccountingServiceImp.cs +++ b/Service/ServiceImplementations/AccountingServiceImp.cs @@ -362,20 +362,20 @@ namespace BeWo.Service.ServiceImplementations var nextNumber = inc.GetNextInvoiceNumber(count, i.InvoiceBase); if (!String.IsNullOrEmpty(nextNumber)) { - if (!String.IsNullOrEmpty(i.InvoiceBase.InvoiceNumber)) - // Rechnungsnummer schon vorher erzeugt oder per Hand vergeben. - { - if (i.InvoiceBase.InvoiceNumber == nextNumber || newInvoices.Count > 1) - //Die per Hand vergebene Rechnungsnummer ist gleich der nächsten berechneten Rechnungsnummer, daher Rechnungsnummerzähler erhöhen - { - count++; - } - } - else - { + //if (!String.IsNullOrEmpty(i.InvoiceBase.InvoiceNumber) && newInvoices.Count == 1) + // // Rechnungsnummer schon vorher erzeugt oder per Hand vergeben. + //{ + // if (i.InvoiceBase.InvoiceNumber == nextNumber || newInvoices.Count > 1) + // //Die per Hand vergebene Rechnungsnummer ist gleich der nächsten berechneten Rechnungsnummer, daher Rechnungsnummerzähler erhöhen + // { + // count++; + // } + //} + //else + //{ i.InvoiceBase.InvoiceNumber = nextNumber; count++; - } + //} } } diff --git a/Service/ServiceImplementations/DownloadServiceImp.cs b/Service/ServiceImplementations/DownloadServiceImp.cs index ae6502713..5a54caaae 100644 --- a/Service/ServiceImplementations/DownloadServiceImp.cs +++ b/Service/ServiceImplementations/DownloadServiceImp.cs @@ -69,7 +69,10 @@ namespace BeWo.Service.ServiceImplementations "PLZ", // 12 "Ort", // 13 "Bemerkung", // 14 - "Erstbetreuung" // 15 + "Erstbetreuung", // 15 + "Betreuung begonnen", // 16 + "Betreuung beendet", // 17 + "Grund für Beendigung" // 18 }; var lContent = new string[lCustomers.Count][]; @@ -161,10 +164,22 @@ namespace BeWo.Service.ServiceImplementations { foreach (var vle in e2c.ValueList.Select(vle2o => vle2o.Entry).Where(vle => vle.SystemEntryID != null && vle.SystemEntryID.Value == SystemEntryID.EmployeeRoleMainAttendant)) { - lHeaderCaption[lHeaderCaption.Length - 1] = vle.Value; + lHeaderCaption[14] = vle.Value; lContent[iRowCount][14] = e2c.Employee.Person.FirstName + " " + e2c.Employee.Person.LastName; } } + + lContent[iRowCount][15] = String.Format("{0:dd.MM.yyyy}", lCustomers[iRowCount].AssistanceBegin); + lContent[iRowCount][16] = String.Format("{0:dd.MM.yyyy}", lCustomers[iRowCount].TerminationDate); + + if (lCustomers[iRowCount].TerminationReason != null) + { + lContent[iRowCount][17] = lCustomers[iRowCount].TerminationReason.Value; + } + else + { + lContent[iRowCount][17] = ""; + } } //WriteExcelFile(pFileID, lHeaderCaption, lContent, pPath); @@ -198,25 +213,24 @@ namespace BeWo.Service.ServiceImplementations "Urlaubstage", // 12 "FLS/Woche", // 13 "Gesamtstunden/Woche", // 14 - "Gesamtstunden/Monat", // 15 - "Arbeitstage pro Woche", // 16 - "Eintrittsdatum", // 17 + "Arbeitstage pro Woche", // 15 + "Eintrittsdatum", // 16 "Versicherungsnummer", "Stundensatz", "Telefon", - "Mobil", // 21 + "Mobil", // 20 "Mail", "private Mail", "Fax", "Strasse", - "PLZ", // 26 + "PLZ", // 25 "Ort", "Kontonummer", "Bankleitzahl", "Bank", - "BIC", // 31 + "BIC", // 30 "IBAN", - "Bemerkung" // 33 + "Bemerkung" // 32 }; string[][] lContent = new string[lEmployees.Count][]; @@ -273,16 +287,16 @@ namespace BeWo.Service.ServiceImplementations lContent[iRowCount][7] = lEmployees[iRowCount].HealthInsurance; lContent[iRowCount][8] = lEmployees[iRowCount].TaxNumber; - var lValuelistEntry = lEmployees[iRowCount].ValueList.SingleOrDefault(vle => vle.Entry.Type == ValueListEntryType.EmploymentType); - if (lValuelistEntry != null) - { - lContent[iRowCount][9] = lValuelistEntry.Entry.Value; - } + Contract lastContract = lEmployees[iRowCount].LastContract; if (lastContract != null) { + if (lastContract.EmploymentType != null) + { + lContent[iRowCount][9] = lastContract.EmploymentType.Name; + } lContent[iRowCount][10] = lastContract.ProbationPeriod.ToString(); lContent[iRowCount][11] = lastContract.CancellationPeriod.ToString(); @@ -301,69 +315,69 @@ namespace BeWo.Service.ServiceImplementations lContent[iRowCount][14] = lastContract.WeeklyTotalHours.Value.ToStringNullCheck(); } - if (lastContract.MonthlyTotalHours.HasValue) - { - lContent[iRowCount][15] = lastContract.MonthlyTotalHours.Value.ToStringNullCheck(); - } - var wd = lastContract.WeeklyDays ?? 5; if (wd == 0) wd = 5; - lContent[iRowCount][16] = String.Format("{0}", wd); - - lContent[iRowCount][17] = lastContract.EntryDate.DoIfNotNull(d => d.ToShortDateString()); + lContent[iRowCount][15] = String.Format("{0}", wd); + } - lContent[iRowCount][18] = lEmployees[iRowCount].InsuranceNumber; + var firstContract = lEmployees[iRowCount].FirstContract; + if (firstContract != null) + { + lContent[iRowCount][16] = firstContract.EntryDate.DoIfNotNull(d => d.ToShortDateString()); + } + lContent[iRowCount][17] = lEmployees[iRowCount].InsuranceNumber; if (lastContract != null) { if (lastContract.HourlyRate.HasValue) { - lContent[iRowCount][19] = lastContract.HourlyRate.Value.ToStringNullCheck(); + lContent[iRowCount][18] = lastContract.HourlyRate.Value.ToStringNullCheck(); } + lContent[iRowCount][32] = lastContract.Notice; } foreach (var iContact in lEmployees[iRowCount].Person.Contacts) { switch (iContact.Type) { case ContactType.business_Phone: - lContent[iRowCount][20] = iContact.Value; + lContent[iRowCount][19] = iContact.Value; break; case ContactType.business_MobilePhone: - lContent[iRowCount][21] = iContact.Value; + lContent[iRowCount][20] = iContact.Value; break; case ContactType.business_Mail: - lContent[iRowCount][22] = iContact.Value; + lContent[iRowCount][21] = iContact.Value; break; case ContactType.private_Mail: - lContent[iRowCount][23] = iContact.Value; + lContent[iRowCount][22] = iContact.Value; break; case ContactType.business_Fax: - lContent[iRowCount][24] = iContact.Value; + lContent[iRowCount][23] = iContact.Value; break; } } if (lEmployees[iRowCount].Person.Address != null) { - lContent[iRowCount][25] = lEmployees[iRowCount].Person.Address.Street; - lContent[iRowCount][26] = lEmployees[iRowCount].Person.Address.PostalCode; - lContent[iRowCount][27] = lEmployees[iRowCount].Person.Address.Town; + lContent[iRowCount][24] = lEmployees[iRowCount].Person.Address.Street; + lContent[iRowCount][25] = lEmployees[iRowCount].Person.Address.PostalCode; + lContent[iRowCount][26] = lEmployees[iRowCount].Person.Address.Town; } if (lEmployees[iRowCount].Person.BankAccount != null) { - lContent[iRowCount][28] = lEmployees[iRowCount].Person.BankAccount.AccountNumber; - lContent[iRowCount][29] = lEmployees[iRowCount].Person.BankAccount.BankCode; - lContent[iRowCount][30] = lEmployees[iRowCount].Person.BankAccount.BankName; - lContent[iRowCount][31] = lEmployees[iRowCount].Person.BankAccount.Bic; - lContent[iRowCount][32] = lEmployees[iRowCount].Person.BankAccount.IBAN; + lContent[iRowCount][27] = lEmployees[iRowCount].Person.BankAccount.AccountNumber; + lContent[iRowCount][28] = lEmployees[iRowCount].Person.BankAccount.BankCode; + lContent[iRowCount][29] = lEmployees[iRowCount].Person.BankAccount.BankName; + lContent[iRowCount][30] = lEmployees[iRowCount].Person.BankAccount.Bic; + lContent[iRowCount][31] = lEmployees[iRowCount].Person.BankAccount.IBAN; } - lContent[iRowCount][33] = lEmployees[iRowCount].Notice; + } diff --git a/Shared/Services/Calculations.cs b/Shared/Services/Calculations.cs index 5d20efd22..804b8e8e3 100644 --- a/Shared/Services/Calculations.cs +++ b/Shared/Services/Calculations.cs @@ -406,55 +406,10 @@ namespace BS.Shared.Services public virtual decimal GetTotalMonths(DateTime start, DateTime end) { - - int restTageStart = 0; - int restTageEnd = 0; + var am = DateTimeUtils.GetTotalMonths(start, end); - DateTime startDt = start; - DateTime endDt = end; - - if (startDt.Day > 1) - { - var endMonat = new DateTime(startDt.Year, startDt.Month, 1).AddMonths(1).AddDays(-1); - - if (endDt < endMonat) - { - endMonat = endDt; - } - restTageStart = endMonat.Subtract(startDt).Days + 1; - startDt = endMonat.AddDays(1); - } - if (endDt.AddDays(1).Day != 1) - { - var startMonat = new DateTime(endDt.Year, endDt.Month, 1); - - restTageEnd += endDt.Subtract(startMonat).Days + 1; - - endDt = startMonat; - } - - int fullMonths = 0; - while (startDt < endDt) - { - fullMonths++; - startDt = startDt.AddMonths(1); - } - - decimal monthsTotal = fullMonths; - - - if (restTageStart != 0) - { - monthsTotal += restTageStart / (decimal)DateTime.DaysInMonth(start.Date.Year, start.Date.Month); - - } - if (restTageEnd != 0) - { - monthsTotal += restTageEnd / (decimal)DateTime.DaysInMonth(end.Date.Year, end.Date.Month); - - } - return monthsTotal; - } + return am.AnzahlMonateGesamt; + } public virtual decimal GetTotalQuarters(DateTime start, DateTime end) { @@ -482,7 +437,7 @@ namespace BS.Shared.Services while (startDt <= endDt) { startDt = startDt.AddMonths(3); - + if (startDt <= endDt.AddDays(1)) { startTemp = startDt; @@ -510,7 +465,6 @@ namespace BS.Shared.Services } return quartersTotal; } - public virtual decimal? GetApprovedHoursPerDay(SupportConceptApprovalPeriodDC scap, List costRatePeriods) { if (!scap.EndDate.HasValue || !scap.StartDate.HasValue) // || scap.ApprovedFixedAmount.HasValue) @@ -724,6 +678,7 @@ namespace BS.Shared.Services List costRatePeriods) { var test = this.GetApprovedHoursForPeriod(scap, costRatePeriods, scap.StartDate, scap.EndDate); + return test; } @@ -1079,21 +1034,8 @@ namespace BS.Shared.Services public virtual decimal GetMonthCount(DateTime startDate, DateTime endDate) { - decimal count = 0; - - startDate = startDate.AddMonths(1); - while (startDate < endDate.AddDays(1)) - { - count++; - startDate = startDate.AddMonths(1); - } - - decimal restDays = endDate.Day; - - decimal days = DateTime.DaysInMonth(endDate.Year, endDate.Month); - - count += restDays / days; - return count; + var am = DateTimeUtils.GetTotalMonths(startDate, endDate); + return am.AnzahlMonateGesamt; } public virtual decimal? GetApprovedHoursTillNow(SupportConceptCostBearerRelDC relDC, DateTime? appointedDate) @@ -1144,7 +1086,7 @@ namespace BS.Shared.Services decimal days = Convert.ToDecimal((endDate - period.StartDate.Value).Days + 1); if (relDC.CostBearer.IsCalculatingWithFactor && relDC.CostBearer.CostRatePeriods != null) - { + { var rateFactorsInSpan = relDC.CostBearer.CostRatePeriods.GetSpans(CostRatePeriodType.RateFactor, period.StartDate.Value.Date, endDate).ToList(); if (rateFactorsInSpan.Count > 1) @@ -1183,7 +1125,7 @@ namespace BS.Shared.Services return totalApproved; } - public virtual decimal? GetApprovedHoursTillNow(SupportConceptApprovalPeriodDC scap, List costRates, DateTime? appointedDate, bool excludeRateFactor) + public virtual decimal? GetApprovedHoursTillNow(SupportConceptApprovalPeriodDC scap, List costRates, DateTime? appointedDate, bool excludeRateFactor) { decimal? totalApproved = null; @@ -1580,27 +1522,29 @@ namespace BS.Shared.Services .GetHoursInBE(this.GetApprovedHoursForPeriod(scap, costRatePeriods, start, end)); } - public virtual int GetRoundedDuration(DataContracts.Compact.CompactOrganisationDC org, decimal durationInMinutes) - { - int minuteInterval = org.ActualMinuteIntervall; - return GetRoundedDuration(minuteInterval, durationInMinutes); - } - public virtual int GetRoundedDuration(int minuteInterval, decimal durationInMinutes) - { - decimal lRoundedDuration = durationInMinutes; - if (minuteInterval > 0) - { - lRoundedDuration = durationInMinutes % minuteInterval != 0 - ? durationInMinutes + (minuteInterval - (durationInMinutes % minuteInterval)) - : durationInMinutes; - } + public virtual int GetRoundedDuration(DataContracts.Compact.CompactOrganisationDC org, decimal durationInMinutes) + { + int minuteInterval = org.ActualMinuteIntervall; + return GetRoundedDuration(minuteInterval, durationInMinutes); + } - return (int)Math.Round(lRoundedDuration, 0, MidpointRounding.AwayFromZero); - } + public virtual int GetRoundedDuration(int minuteInterval, decimal durationInMinutes) + { + decimal lRoundedDuration = durationInMinutes; - public static AccountingIntervalType ConvertApprovalToAccountingIntervalType(SupportConceptApprovalInterval supportConceptApprovalInterval) + if (minuteInterval > 0) + { + lRoundedDuration = durationInMinutes % minuteInterval != 0 + ? durationInMinutes + (minuteInterval - (durationInMinutes % minuteInterval)) + : durationInMinutes; + } + + return (int)Math.Round(lRoundedDuration, 0, MidpointRounding.AwayFromZero); + } + + public static AccountingIntervalType ConvertApprovalToAccountingIntervalType(SupportConceptApprovalInterval supportConceptApprovalInterval) { switch (supportConceptApprovalInterval) {