SHKService Sammelrechnung LWV komplett
This commit is contained in:
@@ -219,7 +219,7 @@ namespace SHKService
|
||||
// xrLabel11
|
||||
//
|
||||
this.xrLabel11.Font = new System.Drawing.Font("Calibri", 11.25F);
|
||||
this.xrLabel11.LocationFloat = new DevExpress.Utils.PointFloat(720.6534F, 64.70773F);
|
||||
this.xrLabel11.LocationFloat = new DevExpress.Utils.PointFloat(747.5032F, 64.70773F);
|
||||
this.xrLabel11.Name = "xrLabel11";
|
||||
this.xrLabel11.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F);
|
||||
this.xrLabel11.SizeF = new System.Drawing.SizeF(69.17712F, 16.99999F);
|
||||
@@ -231,7 +231,7 @@ namespace SHKService
|
||||
this.xrLabel14.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] {
|
||||
new DevExpress.XtraReports.UI.XRBinding("Text", null, "CreatorName")});
|
||||
this.xrLabel14.Font = new System.Drawing.Font("Calibri", 11.25F);
|
||||
this.xrLabel14.LocationFloat = new DevExpress.Utils.PointFloat(789.8306F, 64.70773F);
|
||||
this.xrLabel14.LocationFloat = new DevExpress.Utils.PointFloat(816.6804F, 64.70773F);
|
||||
this.xrLabel14.Name = "xrLabel14";
|
||||
this.xrLabel14.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F);
|
||||
this.xrLabel14.SizeF = new System.Drawing.SizeF(225F, 17F);
|
||||
@@ -320,7 +320,7 @@ namespace SHKService
|
||||
this.xrTable1.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 2, 2, 100F);
|
||||
this.xrTable1.Rows.AddRange(new DevExpress.XtraReports.UI.XRTableRow[] {
|
||||
this.xrTableRow2});
|
||||
this.xrTable1.SizeF = new System.Drawing.SizeF(1014.83F, 17F);
|
||||
this.xrTable1.SizeF = new System.Drawing.SizeF(1047.503F, 17F);
|
||||
this.xrTable1.StylePriority.UseBorders = false;
|
||||
this.xrTable1.StylePriority.UseFont = false;
|
||||
this.xrTable1.StylePriority.UsePadding = false;
|
||||
@@ -346,7 +346,7 @@ namespace SHKService
|
||||
this.xrTableCell11.StylePriority.UseTextAlignment = false;
|
||||
this.xrTableCell11.Text = "Rechnungssumme";
|
||||
this.xrTableCell11.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft;
|
||||
this.xrTableCell11.Weight = 1.8007896864822381D;
|
||||
this.xrTableCell11.Weight = 1.8702418773940952D;
|
||||
//
|
||||
// xrTableCell14
|
||||
//
|
||||
@@ -361,7 +361,7 @@ namespace SHKService
|
||||
this.xrTableCell14.StylePriority.UseTextAlignment = false;
|
||||
this.xrTableCell14.Text = "xrTableCell9";
|
||||
this.xrTableCell14.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleRight;
|
||||
this.xrTableCell14.Weight = 0.21297249777057958D;
|
||||
this.xrTableCell14.Weight = 0.20835502025138933D;
|
||||
//
|
||||
// ruleNoticeNull
|
||||
//
|
||||
@@ -487,7 +487,7 @@ namespace SHKService
|
||||
this.xrTable3.Rows.AddRange(new DevExpress.XtraReports.UI.XRTableRow[] {
|
||||
this.xrTableRow1,
|
||||
this.xrTableRow5});
|
||||
this.xrTable3.SizeF = new System.Drawing.SizeF(1014.831F, 36F);
|
||||
this.xrTable3.SizeF = new System.Drawing.SizeF(1047.503F, 36F);
|
||||
this.xrTable3.StylePriority.UseBackColor = false;
|
||||
this.xrTable3.StylePriority.UseBorders = false;
|
||||
this.xrTable3.StylePriority.UseFont = false;
|
||||
@@ -562,7 +562,7 @@ namespace SHKService
|
||||
this.xrTableCell7.StylePriority.UseBorders = false;
|
||||
this.xrTableCell7.StylePriority.UseFont = false;
|
||||
this.xrTableCell7.Text = "Leistung";
|
||||
this.xrTableCell7.Weight = 0.33118949750760451D;
|
||||
this.xrTableCell7.Weight = 0.42778503588224182D;
|
||||
//
|
||||
// xrTableCell10
|
||||
//
|
||||
@@ -572,7 +572,7 @@ namespace SHKService
|
||||
this.xrTableCell10.StylePriority.UseBorders = false;
|
||||
this.xrTableCell10.StylePriority.UseFont = false;
|
||||
this.xrTableCell10.Text = "Leistungsmin.";
|
||||
this.xrTableCell10.Weight = 0.23459147992913265D;
|
||||
this.xrTableCell10.Weight = 0.23459240641212942D;
|
||||
//
|
||||
// xrTableCell15
|
||||
//
|
||||
@@ -582,7 +582,7 @@ namespace SHKService
|
||||
this.xrTableCell15.StylePriority.UseBorders = false;
|
||||
this.xrTableCell15.StylePriority.UseFont = false;
|
||||
this.xrTableCell15.Text = "Einzelpreis";
|
||||
this.xrTableCell15.Weight = 0.22079260622355268D;
|
||||
this.xrTableCell15.Weight = 0.22079269044927966D;
|
||||
//
|
||||
// xrTableCell16
|
||||
//
|
||||
@@ -592,7 +592,7 @@ namespace SHKService
|
||||
this.xrTableCell16.StylePriority.UseBorders = false;
|
||||
this.xrTableCell16.StylePriority.UseFont = false;
|
||||
this.xrTableCell16.Text = "Anzahl der ";
|
||||
this.xrTableCell16.Weight = 0.22079294500509136D;
|
||||
this.xrTableCell16.Weight = 0.22079260810218343D;
|
||||
//
|
||||
// xrTableCell8
|
||||
//
|
||||
@@ -602,7 +602,7 @@ namespace SHKService
|
||||
this.xrTableCell8.StylePriority.UseBorders = false;
|
||||
this.xrTableCell8.StylePriority.UseFont = false;
|
||||
this.xrTableCell8.Text = "Gesamt-";
|
||||
this.xrTableCell8.Weight = 0.2207927765535766D;
|
||||
this.xrTableCell8.Weight = 0.22079286077930357D;
|
||||
//
|
||||
// xrTableCell39
|
||||
//
|
||||
@@ -613,7 +613,7 @@ namespace SHKService
|
||||
this.xrTableCell39.StylePriority.UseBorders = false;
|
||||
this.xrTableCell39.StylePriority.UseFont = false;
|
||||
this.xrTableCell39.Text = "Summe Monat";
|
||||
this.xrTableCell39.Weight = 0.29621382278968905D;
|
||||
this.xrTableCell39.Weight = 0.28979009504426406D;
|
||||
//
|
||||
// xrTableRow5
|
||||
//
|
||||
@@ -675,11 +675,12 @@ namespace SHKService
|
||||
// xrTableCell46
|
||||
//
|
||||
this.xrTableCell46.Borders = ((DevExpress.XtraPrinting.BorderSide)((DevExpress.XtraPrinting.BorderSide.Left | DevExpress.XtraPrinting.BorderSide.Bottom)));
|
||||
this.xrTableCell46.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Bold);
|
||||
this.xrTableCell46.Font = new System.Drawing.Font("Arial", 8F);
|
||||
this.xrTableCell46.Name = "xrTableCell46";
|
||||
this.xrTableCell46.StylePriority.UseBorders = false;
|
||||
this.xrTableCell46.StylePriority.UseFont = false;
|
||||
this.xrTableCell46.Weight = 0.33118937124124648D;
|
||||
this.xrTableCell46.Text = "Kompensatorische Assistenz";
|
||||
this.xrTableCell46.Weight = 0.42778610705212583D;
|
||||
//
|
||||
// xrTableCell47
|
||||
//
|
||||
@@ -689,7 +690,7 @@ namespace SHKService
|
||||
this.xrTableCell47.StylePriority.UseBorders = false;
|
||||
this.xrTableCell47.StylePriority.UseFont = false;
|
||||
this.xrTableCell47.Text = " pro Woche";
|
||||
this.xrTableCell47.Weight = 0.23459246033900408D;
|
||||
this.xrTableCell47.Weight = 0.23459237611322442D;
|
||||
//
|
||||
// xrTableCell48
|
||||
//
|
||||
@@ -699,7 +700,7 @@ namespace SHKService
|
||||
this.xrTableCell48.StylePriority.UseBorders = false;
|
||||
this.xrTableCell48.StylePriority.UseFont = false;
|
||||
this.xrTableCell48.Text = "Tage";
|
||||
this.xrTableCell48.Weight = 0.22079291172385726D;
|
||||
this.xrTableCell48.Weight = 0.2207928274980776D;
|
||||
//
|
||||
// xrTableCell49
|
||||
//
|
||||
@@ -709,7 +710,7 @@ namespace SHKService
|
||||
this.xrTableCell49.StylePriority.UseBorders = false;
|
||||
this.xrTableCell49.StylePriority.UseFont = false;
|
||||
this.xrTableCell49.Text = "Tage";
|
||||
this.xrTableCell49.Weight = 0.22079290420700248D;
|
||||
this.xrTableCell49.Weight = 0.22079283050944532D;
|
||||
//
|
||||
// xrTableCell9
|
||||
//
|
||||
@@ -719,7 +720,7 @@ namespace SHKService
|
||||
this.xrTableCell9.StylePriority.UseBorders = false;
|
||||
this.xrTableCell9.StylePriority.UseFont = false;
|
||||
this.xrTableCell9.Text = "preis";
|
||||
this.xrTableCell9.Weight = 0.22079290420700248D;
|
||||
this.xrTableCell9.Weight = 0.22079283050944529D;
|
||||
//
|
||||
// xrTableCell50
|
||||
//
|
||||
@@ -729,7 +730,7 @@ namespace SHKService
|
||||
this.xrTableCell50.Name = "xrTableCell50";
|
||||
this.xrTableCell50.StylePriority.UseBorders = false;
|
||||
this.xrTableCell50.StylePriority.UseFont = false;
|
||||
this.xrTableCell50.Weight = 0.29621429597668925D;
|
||||
this.xrTableCell50.Weight = 0.28979050104603526D;
|
||||
//
|
||||
// DetailReport1
|
||||
//
|
||||
@@ -755,7 +756,7 @@ namespace SHKService
|
||||
this.xrTable2.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 2, 2, 100F);
|
||||
this.xrTable2.Rows.AddRange(new DevExpress.XtraReports.UI.XRTableRow[] {
|
||||
this.xrTableRow3});
|
||||
this.xrTable2.SizeF = new System.Drawing.SizeF(1014.83F, 17F);
|
||||
this.xrTable2.SizeF = new System.Drawing.SizeF(1047.503F, 17F);
|
||||
this.xrTable2.StylePriority.UseBorders = false;
|
||||
this.xrTable2.StylePriority.UseFont = false;
|
||||
this.xrTable2.StylePriority.UsePadding = false;
|
||||
@@ -845,7 +846,7 @@ namespace SHKService
|
||||
this.xrTableCell26.StylePriority.UseFont = false;
|
||||
this.xrTableCell26.StylePriority.UseTextAlignment = false;
|
||||
this.xrTableCell26.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter;
|
||||
this.xrTableCell26.Weight = 0.33289208820280392D;
|
||||
this.xrTableCell26.Weight = 0.4299855305391253D;
|
||||
//
|
||||
// xrTableCell27
|
||||
//
|
||||
@@ -862,7 +863,7 @@ namespace SHKService
|
||||
this.xrTableCell27.StylePriority.UseTextAlignment = false;
|
||||
this.xrTableCell27.Text = "xrTableCell45";
|
||||
this.xrTableCell27.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter;
|
||||
this.xrTableCell27.Weight = 0.23579789695281189D;
|
||||
this.xrTableCell27.Weight = 0.23579848956467103D;
|
||||
//
|
||||
// xrTableCell28
|
||||
//
|
||||
@@ -877,7 +878,7 @@ namespace SHKService
|
||||
this.xrTableCell28.StylePriority.UsePadding = false;
|
||||
this.xrTableCell28.StylePriority.UseTextAlignment = false;
|
||||
this.xrTableCell28.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter;
|
||||
this.xrTableCell28.Weight = 0.22192789741327412D;
|
||||
this.xrTableCell28.Weight = 0.22192806673094817D;
|
||||
//
|
||||
// xrTableCell29
|
||||
//
|
||||
@@ -890,21 +891,21 @@ namespace SHKService
|
||||
this.xrTableCell29.StylePriority.UseFont = false;
|
||||
this.xrTableCell29.StylePriority.UseTextAlignment = false;
|
||||
this.xrTableCell29.Text = "xrTableCell17";
|
||||
this.xrTableCell29.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleRight;
|
||||
this.xrTableCell29.Weight = 0.22192856135156558D;
|
||||
this.xrTableCell29.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter;
|
||||
this.xrTableCell29.Weight = 0.22192788408086947D;
|
||||
//
|
||||
// xrTableCell3
|
||||
//
|
||||
this.xrTableCell3.Borders = ((DevExpress.XtraPrinting.BorderSide)((DevExpress.XtraPrinting.BorderSide.Left | DevExpress.XtraPrinting.BorderSide.Bottom)));
|
||||
this.xrTableCell3.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] {
|
||||
new DevExpress.XtraReports.UI.XRBinding("Text", null, "ServiceInvoicePeriods.ServiceInvoiceItems.GrossAmount")});
|
||||
new DevExpress.XtraReports.UI.XRBinding("Text", null, "ServiceInvoicePeriods.ServiceInvoiceItems.NetAmount", "{0:c2}")});
|
||||
this.xrTableCell3.Font = new System.Drawing.Font("Calibri", 9F);
|
||||
this.xrTableCell3.Name = "xrTableCell3";
|
||||
this.xrTableCell3.StylePriority.UseBorders = false;
|
||||
this.xrTableCell3.StylePriority.UseFont = false;
|
||||
this.xrTableCell3.StylePriority.UseTextAlignment = false;
|
||||
this.xrTableCell3.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleRight;
|
||||
this.xrTableCell3.Weight = 0.22192771476319542D;
|
||||
this.xrTableCell3.Weight = 0.22192805339854343D;
|
||||
//
|
||||
// xrTableCell31
|
||||
//
|
||||
@@ -918,7 +919,7 @@ namespace SHKService
|
||||
this.xrTableCell31.StylePriority.UseFont = false;
|
||||
this.xrTableCell31.StylePriority.UseTextAlignment = false;
|
||||
this.xrTableCell31.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleRight;
|
||||
this.xrTableCell31.Weight = 0.29773565063758856D;
|
||||
this.xrTableCell31.Weight = 0.29128109158593107D;
|
||||
//
|
||||
// bindingSource1
|
||||
//
|
||||
|
||||
@@ -4,12 +4,15 @@ using BeWo.Report.ReportObjects;
|
||||
using DevExpress.XtraReports.UI;
|
||||
using BS.Shared.Core;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SHKService
|
||||
{
|
||||
[IDSpecificClass(Identifier = "Sammelrechnung")]
|
||||
public partial class SammelrechnungTab : XtraReport, IBeWoReport<ServiceInvoiceRO>
|
||||
{
|
||||
private Dictionary<string, decimal> key2Value = new Dictionary<string, decimal>(); //Monatssumme pro Klient
|
||||
|
||||
public SammelrechnungTab()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
@@ -17,20 +20,22 @@ namespace SHKService
|
||||
|
||||
public void SetReportDataSource(ServiceInvoiceRO pRO)
|
||||
{
|
||||
|
||||
pRO.RecipientOrganisation = "LWV Hessen";
|
||||
pRO.ServiceInvoicePeriods.Sort((a, b) => a.Customer.LastNameFirstName.CompareTo(b.Customer.LastNameFirstName));
|
||||
|
||||
foreach (var sip in pRO.ServiceInvoicePeriods)
|
||||
{
|
||||
if (sip.Customer.LastName.ToLower().Contains("(ka)"))
|
||||
if (sip.Customer.FirstName.ToLower().Contains("(ka)"))
|
||||
{
|
||||
sip.Customer.LastName = sip.Customer.LastName.Replace(" (ka)", "");
|
||||
sip.Customer.FirstName = sip.Customer.LastName.Replace(" (ka)", "");
|
||||
}
|
||||
if (sip.Notice != null)
|
||||
{
|
||||
if (sip.ServiceInvoiceItems.Count > 0)
|
||||
{
|
||||
sip.NotBillableString = sip.ServiceInvoiceItems[0].UnitDescription;
|
||||
}
|
||||
|
||||
}
|
||||
if (sip.SupportConceptApprovalPeriod.ServiceCategory == null || sip.SupportConceptApprovalPeriod.ServiceCategory != null && sip.SupportConceptApprovalPeriod.ServiceCategory.Name.Contains("Monat"))
|
||||
sip.ApprovedHours = 1;
|
||||
@@ -42,12 +47,50 @@ namespace SHKService
|
||||
sip.ApprovedHours = (decimal)(end - start).TotalDays;
|
||||
}
|
||||
if (sip.CostBearer2SupportConcept.CustomerReferenceNumber == null)
|
||||
{
|
||||
sip.CostBearer2SupportConcept.CustomerReferenceNumber = "LVG";
|
||||
}
|
||||
|
||||
foreach (var ii in sip.ServiceInvoiceItems)
|
||||
{
|
||||
String key = String.Format("{0}_{1}_{2}", sip.Customer.LastName, sip.Customer.FirstName, sip.Customer.DateOfBirthString);
|
||||
if (!key2Value.ContainsKey(key))
|
||||
{
|
||||
key2Value[key] = ii.NetAmount.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
key2Value[key] += ii.NetAmount.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//var anhang = new SammelrechnungAnhang();
|
||||
//xrSubreport1.ReportSource = anhang;
|
||||
//anhang.SetReportDataSource(pRO);
|
||||
for (int i = 0; i < pRO.ServiceInvoicePeriods.Count; i++)
|
||||
{
|
||||
var sip = pRO.ServiceInvoicePeriods[i];
|
||||
String key = String.Format("{0}_{1}_{2}", sip.Customer.LastName, sip.Customer.FirstName, sip.Customer.DateOfBirthString);
|
||||
String key2 = null;
|
||||
if (i != pRO.ServiceInvoicePeriods.Count -1)
|
||||
{
|
||||
var sip2 = pRO.ServiceInvoicePeriods[i + 1];
|
||||
key2 = String.Format("{0}_{1}_{2}", sip2.Customer.LastName, sip2.Customer.FirstName, sip2.Customer.DateOfBirthString);
|
||||
}
|
||||
|
||||
if (key == key2)
|
||||
{
|
||||
foreach (var ii in sip.ServiceInvoiceItems)
|
||||
{
|
||||
ii.GrossAmount = "";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var ii in sip.ServiceInvoiceItems)
|
||||
{
|
||||
ii.GrossAmount = String.Format("{0:c2}", key2Value[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.bindingSource1.DataSource = pRO;
|
||||
}
|
||||
|
||||
260
ReportImp/SHKService/Invoicing/BudgetnachweisAnhangRO.cs
Normal file
260
ReportImp/SHKService/Invoicing/BudgetnachweisAnhangRO.cs
Normal file
@@ -0,0 +1,260 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BeWo.Data.Access;
|
||||
using BeWo.Data.Entities;
|
||||
using BeWo.Report;
|
||||
using BeWo.Service.DCEntityMapper;
|
||||
using BS.Shared;
|
||||
using BS.Shared.Core;
|
||||
using BS.Shared.DataContracts;
|
||||
using BS.Shared.Extensions;
|
||||
|
||||
namespace SHKService
|
||||
{
|
||||
public class BudgetnachweisAnhangRO : AbstractBeWoReportObject<BudgetnachweisAnhangRO>
|
||||
{
|
||||
public Settlement2DC SettlementDC { get; set; }
|
||||
public SupportConceptCostBearerRelDC Costbearer2SupportConceptDC { get; set; }
|
||||
public CustomerDC CustomerDC { get; set; }
|
||||
public DateTime BewilligtStart { get; set; }
|
||||
public DateTime BewilligtEnde { get; set; }
|
||||
public List<Entgeltzeitraum> Entgeltzeitraeume { get; set; }
|
||||
public List<BudgetnachweisMonatsZeile> MonatsZeilen { get; set; }
|
||||
public decimal RateFactor { get; set; }
|
||||
public decimal SummeFLMinuten { get; set; }
|
||||
public decimal SummeFaktorMinuten { get; set; }
|
||||
public decimal SummeGesamtMinuten { get; set; }
|
||||
public decimal SummeFLStunden { get; set; }
|
||||
public decimal SummeFehlkontakte { get; set; }
|
||||
public decimal SummeFehlkontakteStunden { get; set; }
|
||||
public decimal SummeFaktorStunden { get; set; }
|
||||
public decimal SummeGesamtStunden { get; set; }
|
||||
public decimal SummeGesamtStundenMitFK { get; set; }
|
||||
|
||||
|
||||
public void Create(Settlement2DC dc)
|
||||
{
|
||||
|
||||
CostBearer2SupportConcept cb2sc = DAOFactory.GenericDAO.LoadByID<CostBearer2SupportConcept>(dc.CostBearer2SupportConceptOid.Value);
|
||||
Customer customer = cb2sc.SupportConcept.Customer;
|
||||
|
||||
this.SettlementDC = dc;
|
||||
this.Costbearer2SupportConceptDC = MapperFactory.SupportConceptCostBearerRelDC_CostBearer2SupportConcept.MapToNewDC(cb2sc);
|
||||
this.CustomerDC = MapperFactory.CustomerDC_Customer.MapToNewDC(customer);
|
||||
this.BewilligtStart = dc.AccountingPeriodStart.Value;
|
||||
this.BewilligtEnde = dc.AccountingPeriodEnd.Value;
|
||||
this.MonatsZeilen = new List<BudgetnachweisMonatsZeile>();
|
||||
this.Entgeltzeitraeume = new List<Entgeltzeitraum>();
|
||||
|
||||
var crList = MapperFactory.CostRatePeriodDC_CostRatePeriod.MapToNewDCs(cb2sc.CostBearer.CostRatePeriods.Where(c => c.CostRateType == CostRatePeriodType.HourlyRate));
|
||||
var crRfList = MapperFactory.CostRatePeriodDC_CostRatePeriod.MapToNewDCs(cb2sc.CostBearer.CostRatePeriods.Where(c => c.CostRateType == CostRatePeriodType.RateFactor));
|
||||
|
||||
var rf = crRfList.GetCostRatePeriodForDate(CostRatePeriodType.RateFactor, this.BewilligtEnde);
|
||||
if (rf != null && rf.CostRateValue.HasValue)
|
||||
{
|
||||
this.RateFactor = rf.CostRateValue.Value;
|
||||
}
|
||||
|
||||
foreach (var cr in crList)
|
||||
{
|
||||
if (!cr.EndDate.HasValue)
|
||||
{
|
||||
cr.EndDate = this.BewilligtEnde;
|
||||
}
|
||||
}
|
||||
|
||||
crList = crList.OrderBy(c => c.EndDate).ToList();
|
||||
|
||||
DateTime start = DateTime.MinValue;
|
||||
int idx = 1;
|
||||
foreach (var cr in crList)
|
||||
{
|
||||
if (!cr.StartDate.HasValue)
|
||||
{
|
||||
cr.StartDate = start;
|
||||
}
|
||||
|
||||
if (cr.StartDate > DateTime.MinValue)
|
||||
{
|
||||
cr.StartDate = cr.StartDate.Value.AddDays(1);
|
||||
}
|
||||
|
||||
if (cr.EndDate >= this.BewilligtStart && cr.StartDate <= this.BewilligtEnde)
|
||||
{
|
||||
var ez = new Entgeltzeitraum();
|
||||
ez.Index = idx++;
|
||||
ez.Start = cr.StartDate.Value;
|
||||
ez.Ende = cr.EndDate.Value;
|
||||
|
||||
if (ez.Start == DateTime.MinValue || ez.Start < BewilligtStart)
|
||||
{
|
||||
ez.Start = this.BewilligtStart;
|
||||
}
|
||||
if (ez.Ende == DateTime.MaxValue)
|
||||
{
|
||||
ez.Ende = this.BewilligtEnde;
|
||||
}
|
||||
|
||||
ez.CostRatePeriod = cr;
|
||||
ez.ServiceRecords = new List<ServiceRecordDC>();
|
||||
this.Entgeltzeitraeume.Add(ez);
|
||||
}
|
||||
|
||||
start = cr.EndDate.Value;
|
||||
}
|
||||
|
||||
var span = new DateTimeSpan();
|
||||
span.StartDateTime = dc.AccountingPeriodStart.Value;
|
||||
span.EndDateTime = dc.AccountingPeriodEnd.Value.AddDays(1).AddTicks(-1);
|
||||
|
||||
//IList<ServiceRecord> serviceRecords = DAOFactory.SearchDAO.FindCustomerServiceRecords(customer.Oid.Value, span, null, null, false);
|
||||
IList<ServiceRecord> serviceRecords = GetServiceRecords(cb2sc);
|
||||
|
||||
|
||||
Dictionary<string, BudgetnachweisMonatsZeile> monat2Zeile = new Dictionary<string, BudgetnachweisMonatsZeile>();
|
||||
|
||||
DateTime monat = new DateTime(this.BewilligtStart.Year, this.BewilligtStart.Month, this.BewilligtStart.Day);
|
||||
|
||||
while (monat <= this.BewilligtEnde)
|
||||
{
|
||||
String key = String.Format("{0:MM.yyyy}", monat);
|
||||
|
||||
var zeile = new BudgetnachweisMonatsZeile();
|
||||
zeile.ServiceRecords = new List<ServiceRecordDC>();
|
||||
zeile.Monat = monat;
|
||||
zeile.SummeMinuten = 0;
|
||||
zeile.SummeFehlkontakte = 0;
|
||||
|
||||
foreach (var e in this.Entgeltzeitraeume)
|
||||
{
|
||||
if (e.Start <= monat && monat <= e.Ende)
|
||||
{
|
||||
zeile.Entgeltzeitraum = e.Index;
|
||||
}
|
||||
}
|
||||
|
||||
if (monat.Day != 1)
|
||||
monat = new DateTime(monat.Year, monat.Month, 1);
|
||||
monat = monat.AddMonths(1);
|
||||
|
||||
monat2Zeile.Add(key, zeile);
|
||||
}
|
||||
|
||||
var groupBookingDict = new Dictionary<long, bool>();
|
||||
foreach (var sr in serviceRecords)
|
||||
{
|
||||
if (sr.ServiceDescription.ServiceCategory.IsBillable && (!sr.GroupOid.HasValue || !groupBookingDict.ContainsKey(sr.GroupOid.Value)))
|
||||
{
|
||||
if (sr.GroupOid.HasValue)
|
||||
{
|
||||
groupBookingDict.Add(sr.GroupOid.Value, true);
|
||||
}
|
||||
var srDc = MapperFactory.ServiceRecordDC_ServiceRecord.MapToNewDC(sr);
|
||||
String key = String.Format("{0:MM.yyyy}", sr.Start);
|
||||
|
||||
if (monat2Zeile.ContainsKey(key))
|
||||
{
|
||||
if (monat2Zeile[key].Monat <= sr.Start.Value.Date)
|
||||
{
|
||||
monat2Zeile[key].ServiceRecords.Add(srDc);
|
||||
|
||||
decimal minuten = sr.RoundedDuration;
|
||||
decimal prozent = sr.ServiceDescription.ServiceCategory.ProzentAbrechnung;
|
||||
|
||||
//if (sr.ServiceDescription.ProzentAbrechnung.HasValue)
|
||||
//{
|
||||
// prozent = sr.ServiceDescription.ProzentAbrechnung.Value;
|
||||
|
||||
//}
|
||||
//minuten *= (prozent / 100);
|
||||
if (sr.ServiceDescription.Name.ToLower().Contains("fehlkontakt"))
|
||||
{
|
||||
monat2Zeile[key].SummeFehlkontakte += minuten;
|
||||
}
|
||||
else
|
||||
monat2Zeile[key].SummeMinuten += minuten;
|
||||
|
||||
|
||||
foreach (var e in this.Entgeltzeitraeume)
|
||||
{
|
||||
if (e.Start <= sr.Start.Value.Date && sr.Start.Value.Date <= e.Ende)
|
||||
{
|
||||
e.ServiceRecords.Add(srDc);
|
||||
if (sr.ServiceDescription.Name.ToLower().Contains("fehlkontakt"))
|
||||
{
|
||||
e.SummeFehlkontakte += minuten;
|
||||
}
|
||||
else
|
||||
e.SummeFLMinuten += minuten;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.MonatsZeilen.AddRange(monat2Zeile.Values.OrderBy(m => m.Monat));
|
||||
|
||||
|
||||
foreach (var e in this.Entgeltzeitraeume)
|
||||
{
|
||||
e.SummeFLStunden = Math.Round(e.SummeFLMinuten / 60, 2, MidpointRounding.AwayFromZero);
|
||||
e.SummeFehlkontakteStunden = Math.Round(e.SummeFehlkontakte / 60, 2, MidpointRounding.AwayFromZero);
|
||||
e.SummeGesamtStunden = Math.Round(((this.RateFactor + 100) / 100) * e.SummeFLStunden, 2, MidpointRounding.AwayFromZero);
|
||||
e.SummeFaktorStunden = e.SummeGesamtStunden - e.SummeFLStunden;
|
||||
e.SummeGesamtStundenMitFK = e.SummeFehlkontakteStunden + e.SummeGesamtStunden;
|
||||
|
||||
//e.SummeFaktorMinuten = (this.RateFactor / 100) * e.SummeFLMinuten;
|
||||
e.SummeFaktorMinuten = e.SummeFaktorStunden * 60;
|
||||
e.SummeGesamtMinuten = e.SummeFaktorMinuten + e.SummeFLMinuten;
|
||||
|
||||
|
||||
this.SummeFLMinuten += e.SummeFLMinuten;
|
||||
this.SummeFaktorMinuten += e.SummeFaktorMinuten;
|
||||
this.SummeGesamtMinuten += e.SummeGesamtMinuten;
|
||||
|
||||
this.SummeFLStunden += e.SummeFLStunden;
|
||||
this.SummeFaktorStunden += e.SummeFaktorStunden;
|
||||
this.SummeGesamtStunden += e.SummeGesamtStunden;
|
||||
this.SummeFehlkontakte += e.SummeFehlkontakte;
|
||||
this.SummeFehlkontakteStunden += e.SummeFehlkontakteStunden;
|
||||
this.SummeGesamtStundenMitFK += e.SummeGesamtStundenMitFK;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual IList<ServiceRecord> GetServiceRecords(CostBearer2SupportConcept cb2sc)
|
||||
{
|
||||
return cb2sc.ServiceRecords;
|
||||
}
|
||||
}
|
||||
|
||||
public class BudgetnachweisMonatsZeile
|
||||
{
|
||||
public List<ServiceRecordDC> ServiceRecords { get; set; }
|
||||
public DateTime Monat { get; set; }
|
||||
public decimal? SummeMinuten { get; set; }
|
||||
public decimal? SummeFehlkontakte { get; set; }
|
||||
public int Entgeltzeitraum { get; set; }
|
||||
public decimal? Betrag { get; set; }
|
||||
}
|
||||
|
||||
public class Entgeltzeitraum
|
||||
{
|
||||
public List<ServiceRecordDC> ServiceRecords { get; set; }
|
||||
public CostRatePeriodDC CostRatePeriod { get; set; }
|
||||
public DateTime Start { get; set; }
|
||||
public DateTime Ende { get; set; }
|
||||
public decimal SummeFLMinuten { get; set; }
|
||||
public decimal SummeFaktorMinuten { get; set; }
|
||||
public decimal SummeGesamtMinuten { get; set; }
|
||||
public decimal SummeFLStunden { get; set; }
|
||||
public decimal SummeFehlkontakte { get; set; }
|
||||
public decimal SummeFehlkontakteStunden { get; set; }
|
||||
public decimal SummeFaktorStunden { get; set; }
|
||||
public decimal SummeGesamtStunden { get; set; }
|
||||
public decimal SummeGesamtStundenMitFK { get; set; }
|
||||
public int Index { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -119,13 +119,27 @@ namespace SHKService.Invoicing
|
||||
|
||||
ii.AmountTotal = ii.UnitCount * ii.AmountPerUnit;
|
||||
ii.GrossAmountTotal = ii.AmountTotal;
|
||||
serviceInvoicePeriod.InvoiceItemList.Add(ii);
|
||||
if (ii.ItemDescription.Contains("KA") || ii.ItemDescription.Contains("Kompensatorisch"))
|
||||
{
|
||||
if (supportConceptApprovalPeriod.EndDate.HasValue && supportConceptApprovalPeriod.EndDate.Value.Year == serviceInvoicePeriod.End.Value.Year
|
||||
&& supportConceptApprovalPeriod.EndDate.Value.Month == serviceInvoicePeriod.End.Value.Month)
|
||||
{
|
||||
// do nothing -> Spitzabrechnung wird erstellt
|
||||
}
|
||||
else
|
||||
{
|
||||
serviceInvoicePeriod.InvoiceItemList.Add(ii);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
serviceInvoicePeriod.InvoiceItemList.Add(ii);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static decimal GetPreis(IList<Preis> allePreise, String name, DateTime datum)
|
||||
{
|
||||
|
||||
var pausch = allePreise.Where(p => p.Name.Contains(name)).FirstOrDefault();
|
||||
if (pausch != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user