MalteserJohanniterJohanneshaus - Ersteinrichtung mit Schwerpunkt BeWo!
This commit is contained in:
191
ReportImp/MalteserJohanniterJohanneshaus/CustomReportCreator.cs
Normal file
191
ReportImp/MalteserJohanniterJohanneshaus/CustomReportCreator.cs
Normal file
@@ -0,0 +1,191 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using BeWo.Data;
|
||||
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;
|
||||
using BS.Shared.Extensions;
|
||||
using DevExpress.XtraReports.Design;
|
||||
using DevExpress.XtraReports.UI;
|
||||
|
||||
namespace MalteserJohanniterJohanneshaus
|
||||
{
|
||||
public class IntegraReportCreator : DefaultReportCreator
|
||||
{
|
||||
public override XtraReport CreateServiceOverviewAllCustomersReport(int month, int year, long orgaOid, long empOid, long? serviceCategoryOid, int startDay, int endDay)
|
||||
{
|
||||
//List<ServicesOverviewRO> lROs = ServicesOverviewRO.Create(month, year, orgaOid, empOid, startDay, endDay);
|
||||
List<ServicesOverviewRO> lROs = Create(month, year, orgaOid, empOid, startDay, endDay, serviceCategoryOid);
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
private List<ServicesOverviewRO> Create(int pMonth, int pYear, long orgaOid, long empOid, int startDay, int endDay, long? serviceCategoryOid = null)
|
||||
{
|
||||
var roList = new List<ServicesOverviewRO>();
|
||||
|
||||
List<long> customerOids = new List<long>();
|
||||
|
||||
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)
|
||||
{
|
||||
bool all = false;
|
||||
foreach (var group in loggedInUser.UserGroups)
|
||||
{
|
||||
if (group.Name.ToLower().Contains("admin") || group.Name.ToLower().Contains("verwaltung"))
|
||||
{
|
||||
all = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (all)
|
||||
{
|
||||
customerOids.AddRange(DAOFactory.GenericDAO.GetAllActive<Customer>()
|
||||
.OrderBy(ob => ob.Person.LastName + ", " + ob.Person.FirstName).Select(c => c.Oid.Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
var teams = DAOFactory.SearchDAO.FindLeadingTeams(loggedInUser.Employee.Oid.Value);
|
||||
|
||||
foreach (var team in teams)
|
||||
{
|
||||
foreach (var employee in team.MemberList)
|
||||
{
|
||||
foreach (var e2c in employee.Employee2CustomerList)
|
||||
{
|
||||
if (e2c.Customer.IsActive == ActivationTypeId.Active)
|
||||
{
|
||||
foreach (var v2o in e2c.ValueList)
|
||||
{
|
||||
if (v2o.Entry.Type == ValueListEntryType.StaffRoleType &&
|
||||
v2o.Entry.Value.Contains("Hauptbetreuung"))
|
||||
{
|
||||
if (!customerOids.Contains(e2c.Customer.Oid.Value))
|
||||
{
|
||||
customerOids.Add(e2c.Customer.Oid.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
foreach (var coid in customerOids)
|
||||
{
|
||||
var ro = ServicesOverviewRO.Create(coid, pMonth, pYear, true, orgaOid, empOid, startDay, endDay, serviceCategoryOid);
|
||||
|
||||
//ServicesOverviewRO ro = ServicesOverviewRO.Create(customer, pSpan, disableEmptySupportConcepts, orgaOid, empOid, searchServiceRecordsByEndDate, serviceCategoryOid);
|
||||
if (ro != null)
|
||||
{
|
||||
roList.Add(ro);
|
||||
}
|
||||
}
|
||||
|
||||
return roList.OrderBy(r => r.CustomerLastName + ", " + r.CustomerFirstName).ToList();
|
||||
}
|
||||
|
||||
public override XtraReport CreateServiceOverviewReportForCustomers(IList<long> customerOids, int month, int year, long? orgaOid, long? empOid, long? serviceCategoryOid, int startDay, int endDay, bool nurFehlende)
|
||||
{
|
||||
var roList = new List<ServicesOverviewRO>();
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
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<ServicesOverviewRO> report = null;
|
||||
String kt = "";
|
||||
if (!String.IsNullOrWhiteSpace(ro.Costbearer))
|
||||
kt = ro.Costbearer.Trim();
|
||||
|
||||
String function = "";
|
||||
if (ro.CostBearer2SupportConceptList != null)
|
||||
{
|
||||
foreach (var c2s in ro.CostBearer2SupportConceptList)
|
||||
{
|
||||
if (c2s.CostBearer.Organisation.Function != null && !String.IsNullOrWhiteSpace(ro.Costbearer) && c2s.CostBearer.Organisation.Name == ro.Costbearer)
|
||||
function = c2s.CostBearer.Organisation.Function.Value;
|
||||
}
|
||||
}
|
||||
|
||||
//if (function == "Krankenkasse")
|
||||
// report = new MalteserJohanniterJohanneshaus.LeistungsnachweisSoziotherapie();
|
||||
|
||||
if (report == null)
|
||||
report = new MalteserJohanniterJohanneshaus.Quittierungsbeleg();
|
||||
report.SetReportDataSource(ro);
|
||||
|
||||
return report as XtraReport;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using BeWo.Service.Core;
|
||||
using BeWo.Service.Plugins;
|
||||
using BS.Shared.Core;
|
||||
using BS.Shared.DataContracts;
|
||||
using Utils = BS.Shared.Core.Utils;
|
||||
|
||||
namespace MalteserJohanniterJohanneshaus.Export
|
||||
{
|
||||
public class CustomDataExporter : DataExporter
|
||||
{
|
||||
public override QueryDC CreateQuery(QueryDC query)
|
||||
{
|
||||
return DatevExporter.CreateQuery(query);
|
||||
}
|
||||
}
|
||||
}
|
||||
272
ReportImp/MalteserJohanniterJohanneshaus/Datev/DatevExporter.cs
Normal file
272
ReportImp/MalteserJohanniterJohanneshaus/Datev/DatevExporter.cs
Normal file
@@ -0,0 +1,272 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using BeWo.Data.Access;
|
||||
using BeWo.Data.Entities;
|
||||
using BeWo.Service.DCEntityMapper;
|
||||
using BS.Shared;
|
||||
using BS.Shared.DataContracts;
|
||||
using BS.Shared.Extensions;
|
||||
|
||||
namespace MalteserJohanniterJohanneshaus.Export
|
||||
{
|
||||
public class DatevExporter
|
||||
{
|
||||
|
||||
public static QueryDC CreateQuery(QueryDC query)
|
||||
{
|
||||
DateTime dt = DateTime.Now;
|
||||
DateTime.TryParse(query.Parameter[0].Value.ToString(), out dt);
|
||||
|
||||
query.FileName = String.Format("Datev Export {0:yyyyMM}.csv", dt);
|
||||
query.QueryResult = GetAbrechnungenString(dt);
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
|
||||
public static String GetAbrechnungenString(DateTime date)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
//sb.AppendLine("Datum;Konto;Gegenkonto;Buchungstext;Belegfeld1;Umsatz Soll;Kostenstelle");
|
||||
|
||||
sb.AppendLine("Belegdatum;Belegnummer;Debitorennummer;Kontonummer;Betrag;Buchungstext;Kostenstelle");
|
||||
|
||||
var s = GetMonatlicheBetraegeString(date);
|
||||
if (!String.IsNullOrWhiteSpace(s))
|
||||
{
|
||||
sb.Append(s);
|
||||
}
|
||||
|
||||
s = GetMonatlicheRechnungenString(date);
|
||||
if (!String.IsNullOrWhiteSpace(s))
|
||||
{
|
||||
if (sb.Length > 0)
|
||||
sb.AppendLine();
|
||||
|
||||
sb.Append(s);
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public static String GetMonatlicheRechnungenString(DateTime date)
|
||||
{
|
||||
var sql = GetMonatlicheRechnungenSql(date);
|
||||
|
||||
/*
|
||||
sip.Claim,
|
||||
c.DebitorNumber,
|
||||
ib.InvoiceDate,
|
||||
ib.invoicenumber,
|
||||
c.CostCenter,
|
||||
c2s.Oid,
|
||||
ib.InvoiceId,
|
||||
c2s.Notice AS 'Kostenstelle'
|
||||
*/
|
||||
|
||||
//sb.AppendLine("Belegdatum;Belegnummer;Debitorennummer;Kontonummer;Betrag;Buchungstext;Kostenstelle");
|
||||
//"Datum;Konto;Gegenkonto;Buchungstext;Belegfeld1;Umsatz Soll;Kostenstelle"
|
||||
var dt = ExecuteQuery(sql, date);
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
foreach (DataRow row in dt.Rows)
|
||||
{
|
||||
if (sb.Length > 0)
|
||||
{
|
||||
sb.AppendLine();
|
||||
}
|
||||
DateTime lastDate = new DateTime(date.Year, date.Month, 1);
|
||||
lastDate = lastDate.AddMonths(1).AddDays(-1);
|
||||
sb.Append(String.Format("{0:dd.MM.yyyy}", lastDate));
|
||||
sb.Append(";");
|
||||
sb.Append(String.Format("{0}", row[3]));
|
||||
sb.Append(";");
|
||||
sb.Append(String.Format("{0}", row[1]));
|
||||
sb.Append(";");
|
||||
sb.Append("5810"); // Erlöskonto
|
||||
sb.Append(";");
|
||||
sb.Append(String.Format("{0:0.00}", row[0]));
|
||||
sb.Append(";");
|
||||
String buchungstext = "";
|
||||
long? c2sOid = (long?)row[5];
|
||||
|
||||
if (c2sOid.HasValue)
|
||||
{
|
||||
var c2s = DAOFactory.GenericDAO.LoadByID<CostBearer2SupportConcept>(c2sOid.Value);
|
||||
var c = c2s.SupportConcept.Customer;
|
||||
buchungstext = String.Format("{0}, {1} - {2:yyyy}/{2:MM}", c.Person.LastName, c.Person.FirstName, lastDate);
|
||||
}
|
||||
|
||||
sb.Append(buchungstext);
|
||||
sb.Append(";");
|
||||
|
||||
sb.Append("70000");
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public static String GetMonatlicheBetraegeString(DateTime date)
|
||||
{
|
||||
var sql = GetMonatlicheBetraegeLvrSql(date);
|
||||
|
||||
/*
|
||||
'Betrag',
|
||||
c.DebitorNumber,
|
||||
c.CostCenter,
|
||||
CONCAT(p.`LastName`, ', ', p.`FirstName`) as 'Verwendung',
|
||||
cb2sc.Oid,
|
||||
cb2sc.Notice AS 'Kostenstelle',
|
||||
|
||||
*/
|
||||
|
||||
//"Datum;Konto;Gegenkonto;Buchungstext;Belegfeld1;Umsatz Soll;Kostenstelle"
|
||||
var dt = ExecuteQuery(sql, date);
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
foreach (DataRow row in dt.Rows)
|
||||
{
|
||||
if (sb.Length > 0)
|
||||
{
|
||||
sb.AppendLine();
|
||||
}
|
||||
DateTime lastDate = new DateTime(date.Year, date.Month, 1);
|
||||
lastDate = lastDate.AddMonths(1).AddDays(-1);
|
||||
|
||||
sb.Append(String.Format("{0:dd.MM.yyyy}", lastDate));
|
||||
sb.Append(";");
|
||||
sb.Append(String.Format("{0:MM}{0:yyyy}", lastDate));
|
||||
sb.Append(";");
|
||||
sb.Append(String.Format("{0}", row[1])); //Debitor
|
||||
sb.Append(";");
|
||||
sb.Append("8002"); // Erlöskonto
|
||||
sb.Append(";");
|
||||
sb.Append(String.Format("{0:0.00}", row[0]));
|
||||
sb.Append(";");
|
||||
|
||||
sb.Append(String.Format("ABW, {0} - {1:yyyy}/{1:MM}", row[3], lastDate));
|
||||
sb.Append(";");
|
||||
string costcenter;
|
||||
costcenter = String.Format("{0}", row[5]); // CB2SC Notice
|
||||
costcenter.Trim();
|
||||
sb.Append(costcenter);
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
private static String GetMonatlicheRechnungenSql(DateTime date)
|
||||
{
|
||||
|
||||
String sql = @"
|
||||
select
|
||||
sip.Claim,
|
||||
c.DebitorNumber,
|
||||
ib.InvoiceDate,
|
||||
ib.invoicenumber,
|
||||
c.CostCenter,
|
||||
c2s.Oid,
|
||||
ib.InvoiceId,
|
||||
c2s.Notice AS 'Kostenstelle'
|
||||
from
|
||||
person p
|
||||
inner join customer c on c.personoid = p.oid
|
||||
inner join supportconcept sc on sc.customeroid = c.oid
|
||||
inner join costbearer2supportconcept c2s on c2s.supportconceptoid = sc.oid
|
||||
inner join invoicebase ib on ib.costbearer2supportconceptoid = c2s.oid
|
||||
inner join serviceinvoice si on si.invoicebaseoid = ib.oid
|
||||
inner join serviceinvoiceperiod sip on sip.serviceinvoiceoid = si.oid
|
||||
WHERE ib.`AccountingPeriodEnd` >= ':Monat_Start' AND ib.`AccountingPeriodEnd` < ':Monat_End' and ib.IsActive = 1
|
||||
order by ib.invoicenumber
|
||||
";
|
||||
|
||||
return sql;
|
||||
}
|
||||
|
||||
private static String GetMonatlicheBetraegeLvrSql(DateTime date)
|
||||
{
|
||||
// Achtung da Preise nur Verwaltung wird Preis von FLS geholt und auch nur FLS exportiert!
|
||||
// Fehlkontakte sind berücksichtigt
|
||||
String sql = @"
|
||||
SELECT
|
||||
sum(qry.Betrag) AS Betrag,
|
||||
qry.DebitorNumber,
|
||||
qry.CostCenter,
|
||||
qry.Verwendung,
|
||||
qry.Oid,
|
||||
qry.Kostenstelle
|
||||
FROM
|
||||
(
|
||||
(SELECT
|
||||
IF(crpRateFactor.`CostRateValue` is null, ROUND((sr.`GeleisteteFLM` / 60) * (SELECT crp.`CostRateValue` FROM `costrateperiod` crp WHERE crp.`ObjectTid` = 22 AND crp.`CostRateType` = 0 AND crp.`ObjectOid` = cb2sc.`CostBearerOid` AND (crp.`EndDate` is null or crp.`EndDate` > ':Monat_Start') order by IF(crp.`EndDate` is null, MAKEDATE(9999,365),crp.`EndDate`) LIMIT 1 )),
|
||||
ROUND(ROUND((sr.`GeleisteteFLM` / 60), 2) * (SELECT crp.`CostRateValue` FROM `costrateperiod` crp WHERE crp.`ObjectTid` = 43 AND crp.`ObjectOid` = 1 AND (crp.`EndDate` is null or crp.`EndDate` > ':Monat_Start') order by IF(crp.`EndDate` is null, MAKEDATE(9999,365),crp.`EndDate`) LIMIT 1 ) * ((100 + crpRateFactor.`CostRateValue`)/100), 2)) AS 'Betrag',
|
||||
c.DebitorNumber,
|
||||
c.CostCenter,
|
||||
CONCAT(p.`LastName`, ', ', p.`FirstName`) as 'Verwendung',
|
||||
cb2sc.Oid,
|
||||
cb2sc.Notice AS 'Kostenstelle'
|
||||
FROM `supportconcept` sc
|
||||
INNER JOIN `costbearer2supportconcept` cb2sc ON sc.`Oid` = cb2sc.`SupportConceptOid`
|
||||
INNER JOIN `costbearer` cb ON cb2sc.`CostBearerOid` = cb.`Oid`
|
||||
LEFT JOIN
|
||||
(SELECT crp.`ObjectOid`, crp.`CostRateValue` FROM `costrateperiod` crp
|
||||
WHERE crp.`ObjectTid` = 22 AND crp.`CostRateType` = 2 AND (crp.`EndDate` is null or crp.`EndDate` > NOW()))
|
||||
AS crpRateFactor ON crpRateFactor.`ObjectOid` = cb.`Oid`
|
||||
INNER JOIN `organisation` org ON org.`CostBearerOid` = cb.`Oid`
|
||||
INNER JOIN `customer` c ON sc.`CustomerOid` = c.`Oid`
|
||||
INNER JOIN `person` p on c.`PersonOid` = p.`Oid`
|
||||
LEFT JOIN
|
||||
(SELECT sr2.`CostBearer2SupportConceptOid`, SUM(sr2.`roundedduration` / IF(sr2.`GroupEmployeeCount` is null, 1, sr2.`GroupEmployeeCount`)) AS GeleisteteFLM FROM `servicerecord` sr2
|
||||
INNER JOIN `servicedescription` sd ON sr2.`ServiceDescriptionOid` = sd.`Oid`
|
||||
INNER JOIN `servicecategory` sc ON sd.`ServiceCategoryOid` = sc.`Oid`
|
||||
WHERE sr2.`StartDate` >= ':Monat_Start' AND sr2.`StartDate` < ':Monat_End' AND sc.`Billable` = 1 and sc.Name = 'Fachleistungsstunde' and sd.Name <> 'Fehlkontakt' GROUP BY sr2.`CostBearer2SupportConceptOid`)
|
||||
AS sr ON sr.`CostBearer2SupportConceptOid` = cb2sc.`Oid`
|
||||
WHERE c.`IsActive` = 1 AND sc.`IsActive` = 1
|
||||
and (sr.`GeleisteteFLM` is not null)
|
||||
UNION
|
||||
(SELECT
|
||||
ROUND(0.8 * (sr.`GeleisteteFLM` / 60) * (SELECT crp.`CostRateValue` FROM `costrateperiod` crp WHERE crp.`ObjectTid` = 43 AND crp.`ObjectOid` = 1 AND (crp.`EndDate` is null or crp.`EndDate` > ':Monat_Start') order by IF(crp.`EndDate` is null, MAKEDATE(9999,365),crp.`EndDate`) LIMIT 1 )) AS 'Betrag',
|
||||
c.DebitorNumber,
|
||||
c.CostCenter,
|
||||
CONCAT(p.`LastName`, ', ', p.`FirstName`) as 'Verwendung',
|
||||
cb2sc.Oid,
|
||||
cb2sc.Notice AS 'Kostenstelle'
|
||||
FROM `supportconcept` sc
|
||||
INNER JOIN `costbearer2supportconcept` cb2sc ON sc.`Oid` = cb2sc.`SupportConceptOid`
|
||||
INNER JOIN `costbearer` cb ON cb2sc.`CostBearerOid` = cb.`Oid`
|
||||
INNER JOIN `organisation` org ON org.`CostBearerOid` = cb.`Oid`
|
||||
INNER JOIN `customer` c ON sc.`CustomerOid` = c.`Oid`
|
||||
INNER JOIN `person` p on c.`PersonOid` = p.`Oid`
|
||||
LEFT JOIN
|
||||
(SELECT sr2.`CostBearer2SupportConceptOid`, SUM(sr2.`roundedduration` / IF(sr2.`GroupEmployeeCount` is null, 1, sr2.`GroupEmployeeCount`)) AS GeleisteteFLM FROM `servicerecord` sr2
|
||||
INNER JOIN `servicedescription` sd ON sr2.`ServiceDescriptionOid` = sd.`Oid`
|
||||
INNER JOIN `servicecategory` sc ON sd.`ServiceCategoryOid` = sc.`Oid`
|
||||
WHERE sr2.`StartDate` >= ':Monat_Start' AND sr2.`StartDate` < ':Monat_End' AND sc.`Billable` = 1 and sc.Name = 'Fachleistungsstunde' and sd.Name = 'Fehlkontakt' GROUP BY sr2.`CostBearer2SupportConceptOid`)
|
||||
AS sr ON sr.`CostBearer2SupportConceptOid` = cb2sc.`Oid`
|
||||
WHERE c.`IsActive` = 1 AND sc.`IsActive` = 1
|
||||
and (sr.`GeleisteteFLM` is not null)))
|
||||
)qry
|
||||
GROUP BY qry.OID
|
||||
ORDER BY qry.Verwendung
|
||||
";
|
||||
|
||||
return sql;
|
||||
}
|
||||
|
||||
public static DataTable ExecuteQuery(String sql, DateTime dt)
|
||||
{
|
||||
var newsql = sql;
|
||||
newsql = newsql.Replace(":Abrechnungsmonat", String.Format("{0:dd.MM.yyyy}", dt));
|
||||
newsql = newsql.Replace(":Belegnr", String.Format("{0:yyMM}", dt));
|
||||
newsql = newsql.Replace(":Monat_MM", String.Format("{0:MM}", dt));
|
||||
newsql = newsql.Replace(":Monat_Start", String.Format("{0:yyyy-MM}-01", dt));
|
||||
dt = dt.AddMonths(1);
|
||||
newsql = newsql.Replace(":Monat_End", String.Format("{0:yyyy-MM}-01", dt));
|
||||
|
||||
return DAOFactory.AdoDAO.ExecuteQuery(newsql).Tables[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
158
ReportImp/MalteserJohanniterJohanneshaus/Finanzauswertung.cs
Normal file
158
ReportImp/MalteserJohanniterJohanneshaus/Finanzauswertung.cs
Normal file
@@ -0,0 +1,158 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using BeWo.Report;
|
||||
using BeWo.Report.ReportObjects;
|
||||
using BS.Shared.DataContracts;
|
||||
using BS.Shared.DataContracts.Compact;
|
||||
|
||||
namespace MalteserJohanniterJohanneshaus
|
||||
{
|
||||
public partial class Finanzauswertung : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<FinanceRO>
|
||||
{
|
||||
public Finanzauswertung()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void SetReportDataSource(FinanceRO pRO)
|
||||
{
|
||||
|
||||
if (pRO.SupportConceptFinanceList != null)
|
||||
{
|
||||
foreach (var scRo in pRO.SupportConceptFinanceList)
|
||||
{
|
||||
//if (scRo.Costbearer2Supportconcept != null)
|
||||
//{
|
||||
// CalculateBillableAmountInReportTimeSpan(scRo, pRO.ReportStartDate.Value, pRO.ReportEndDate.Value);
|
||||
//}
|
||||
|
||||
String kst = GetKostenstelle(scRo);
|
||||
|
||||
if (String.IsNullOrEmpty(kst))
|
||||
{
|
||||
scRo.Custom1 = " ";
|
||||
}
|
||||
else
|
||||
{
|
||||
scRo.Custom1 = String.Format("Kostenstelle {0}", kst);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pRO.CalculateBillableAmountInReportTimeSpan();
|
||||
|
||||
if (pRO.ReportStartDate.HasValue && pRO.ReportEndDate.HasValue)
|
||||
{
|
||||
DateTime start = pRO.ReportStartDate.Value;
|
||||
DateTime end = pRO.ReportEndDate.Value;
|
||||
|
||||
if (start.Year == end.Year && start.Month == end.Month && start.Day == 1 &&
|
||||
end.Day == DateTime.DaysInMonth(end.Year, end.Month))
|
||||
{
|
||||
lblTitel.Text = String.Format("Finanzauswertung {0:MMMM yyyy}", start);
|
||||
cellBewilligtImZeitraumHeader.Text = String.Format("bewilligte FLS {0:MMMM}", start);
|
||||
cellGeleistetImZeitraumHeader.Text = String.Format("geleistete Std. {0:MMMM}", start);
|
||||
cellFehlkontakteHeader.Text = String.Format("Fehl-\nkontakte {0:MMMM}", start);
|
||||
}
|
||||
else
|
||||
{
|
||||
lblTitel.Text = String.Format("Finanzauswertung {0:dd.MM.yyyy}-{1:dd.MM.yyyy}", start, end);
|
||||
cellBewilligtImZeitraumHeader.Text = String.Format("bewilligte FLS {0:dd.MM.yyyy}-{1:dd.MM.yyyy}", start, end);
|
||||
cellGeleistetImZeitraumHeader.Text = String.Format("geleistete Std. {0:dd.MM.yyyy}-{1:dd.MM.yyyy}", start, end);
|
||||
//cellFehlkontakteHeader.Text = String.Format("Fehl-\nkontakte {0:dd.MM.yyyy}-{1:dd.MM.yyyy}", start, end);
|
||||
}
|
||||
if (pRO.RateFactor.HasValue)
|
||||
{
|
||||
cellRateFactorHeader.Text = String.Format("geleistete Std. x {0:0.##}", pRO.RateFactor);
|
||||
}
|
||||
else
|
||||
{
|
||||
//cellRateFactorHeader.Visible = false;
|
||||
//cellRateFactor.Visible = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cellBewilligtImZeitraumHeader.Visible = false;
|
||||
cellBewilligteFLSImBereich.Visible = false;
|
||||
cellGeleistetImBereich.Visible = false;
|
||||
cellGeleistetImZeitraumHeader.Visible = false;
|
||||
cellRateFactorHeader.Visible = false;
|
||||
cellRateFactor.Visible = false;
|
||||
}
|
||||
|
||||
if (pRO.GruppierungLeistungskategorie && pRO.SupportConceptFinanceList != null)
|
||||
{
|
||||
GroupHeader1.Visible = true;
|
||||
GroupFooter1.Visible = true;
|
||||
foreach (var scRo in pRO.SupportConceptFinanceList)
|
||||
{
|
||||
if (String.IsNullOrEmpty(scRo.Leistungskategorie))
|
||||
{
|
||||
scRo.GruppierungsKategorie = " ";
|
||||
}
|
||||
else
|
||||
{
|
||||
scRo.GruppierungsKategorie = String.Format("Leistungskategorie {0}", scRo.Leistungskategorie);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.bindingSource1.DataSource = pRO;
|
||||
}
|
||||
|
||||
private string GetKostenstelle(FinanceRO.SupportConceptFinanceRO scRo)
|
||||
{
|
||||
return scRo.Costbearer2Supportconcept.SupportConcept.DetailDescription;
|
||||
}
|
||||
|
||||
//private void CalculateBillableAmountInReportTimeSpan(FinanceRO.SupportConceptFinanceRO scRo, DateTime start, DateTime end)
|
||||
//{
|
||||
|
||||
// Dictionary<CompactSupportConceptDC, List<ServiceRecordDC>> dict = new Dictionary<CompactSupportConceptDC, List<ServiceRecordDC>>();
|
||||
|
||||
// CompactSupportConceptDC sc = CreateCompactSupportConcept(scRo.Costbearer2Supportconcept);
|
||||
// if (scRo.ServiceRecords != null)
|
||||
// {
|
||||
// foreach (var sr in scRo.ServiceRecords)
|
||||
// {
|
||||
// sr.AlreadyAccounted = false;
|
||||
// }
|
||||
// }
|
||||
|
||||
// dict.Add(sc, scRo.ServiceRecords);
|
||||
|
||||
// var creator = new InvoiceCreation();
|
||||
|
||||
// //String text = String.Format("Tenant={0}, Context=Null? {1}, Factory = {2}", tenant,
|
||||
// // MultitenancyOperationContextExt.Current == null, factory);
|
||||
|
||||
// //Utils.SendErrorMail("CB DEBUG", text);
|
||||
// DateTimeSpan span = new DateTimeSpan();
|
||||
// span.StartDate = start;
|
||||
// span.EndDate = end;
|
||||
|
||||
|
||||
// var invoices = creator.GenerateServiceInvoices(scRo.Costbearer2Supportconcept.CostBearer.CostBearerOid.Value, span, dict);
|
||||
|
||||
// if (invoices != null && invoices.Count == 1)
|
||||
// {
|
||||
// scRo.BillableAmountInReportTimeSpan = invoices[0].ClaimSum ?? 0;
|
||||
|
||||
// }
|
||||
//}
|
||||
|
||||
private CompactSupportConceptDC CreateCompactSupportConcept(SupportConceptCostBearerRelDC c2s)
|
||||
{
|
||||
var dc = new CompactSupportConceptDC();
|
||||
dc.SupportConceptOid = c2s.SupportConcept.SupportConceptOid;
|
||||
dc.CostBearerRelOids = new List<long>();
|
||||
dc.CostBearerRelOids.Add(c2s.CostBearer2SupportConceptOid.Value);
|
||||
dc.IsApproved = true;
|
||||
return dc;
|
||||
}
|
||||
}
|
||||
}
|
||||
1421
ReportImp/MalteserJohanniterJohanneshaus/Finanzauswertung.designer.cs
generated
Normal file
1421
ReportImp/MalteserJohanniterJohanneshaus/Finanzauswertung.designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
120
ReportImp/MalteserJohanniterJohanneshaus/Finanzauswertung.resx
Normal file
120
ReportImp/MalteserJohanniterJohanneshaus/Finanzauswertung.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -25,7 +25,8 @@ namespace MalteserJohanniterJohanneshaus.Invoicing
|
||||
if (!ii.RateFactor.HasValue)
|
||||
{
|
||||
var rateFactor = iServiceRecord.CostBearer.CostRatePeriods.GetCostRatePeriodForDate(CostRatePeriodType.RateFactor, iServiceRecord.Start.Value);
|
||||
if (rateFactor != null && rateFactor.CostRateValue.HasValue)
|
||||
if (rateFactor != null && rateFactor.CostRateValue.HasValue
|
||||
&& !(iServiceRecord.ServiceDescription.Name.ToLower().Contains("fehlkontakt") || (iServiceRecord.ServiceDescription.ProzentAbrechnung.HasValue && iServiceRecord.ServiceDescription.ProzentAbrechnung.Value < 100)))
|
||||
{
|
||||
ii.RateFactor = rateFactor.CostRateValue;
|
||||
//ii.UnitCount = ii.UnitCount.Value * ((100 + ii.RateFactor.Value) / 100);
|
||||
|
||||
@@ -11,7 +11,34 @@ namespace MalteserJohanniterJohanneshaus.Invoicing
|
||||
{
|
||||
public override InvoiceCreation CreateInvoiceCreator(string specificId, string tenant, Dictionary<CompactSupportConceptDC, List<ServiceRecordDC>> supportConcepts2ServiceRecords)
|
||||
{
|
||||
return new CustomInvoiceCreation();
|
||||
}
|
||||
}
|
||||
foreach (var list in supportConcepts2ServiceRecords.Values)
|
||||
{
|
||||
foreach (var sr in list)
|
||||
{
|
||||
var sd = sr.ServiceDescription.Category;
|
||||
var ic = GetInvoiceCreatorForCategory(sd);
|
||||
if (ic != null)
|
||||
return ic;
|
||||
}
|
||||
}
|
||||
return base.CreateInvoiceCreator(specificId, tenant, supportConcepts2ServiceRecords);
|
||||
}
|
||||
|
||||
private InvoiceCreation GetInvoiceCreatorForCategory(ServiceCategoryDC sd)
|
||||
{
|
||||
if (sd != null && !String.IsNullOrEmpty(sd.Name))
|
||||
{
|
||||
String cat = sd.Name.ToLower().Trim();
|
||||
if (cat.Contains("fachleistung"))
|
||||
{
|
||||
return new CustomInvoiceCreation();
|
||||
}
|
||||
if (cat.Contains("soziotherapie"))
|
||||
{
|
||||
return new SoziotherapieInvoiceCreation();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
using BeWo.Data.Entities;
|
||||
using BeWo.Service.Invoicing;
|
||||
using BS.Shared.DataContracts;
|
||||
using BS.Shared.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace MalteserJohanniterJohanneshaus
|
||||
{
|
||||
public class CustomSettlementInvoiceCreation : SettlementInvoiceCreation
|
||||
{
|
||||
public override bool CanCreateInvoiceTheOldWay(Settlement2DC si, CostBearer2SupportConcept c2s)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//public override bool IsServiceRecordBillable(ServiceRecord iRecord)
|
||||
//{
|
||||
// if (iRecord.ServiceDescription.ServiceCategory.Name.Contains("Assistenz"))
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
// return true;
|
||||
//}
|
||||
|
||||
//public override void CalculateSettlementInvoiceApprovedAmounts(Settlement2DC si, SupportConceptCostBearerRelDC relDC, Calculations calc)
|
||||
//{
|
||||
// si.ApprovedFLSWeekly = 0;
|
||||
// si.ApprovedFLS = 0;
|
||||
// foreach (var sp in relDC.ApprovalPeriodList)
|
||||
// {
|
||||
// if (sp.ServiceCategory == null || !sp.ServiceCategory.Name.Contains("Assistenz"))
|
||||
// {
|
||||
// si.ApprovedFLSWeekly += calc.GetApprovedHoursPerWeek(sp, relDC.CostBearer.CostRatePeriods) ?? 0m;
|
||||
|
||||
// decimal flsTotal = calc.GetApprovedHoursTotal(sp, relDC.CostBearer.CostRatePeriods) ?? 0m;
|
||||
// flsTotal = Math.Round(flsTotal, 2, MidpointRounding.AwayFromZero);
|
||||
|
||||
// si.ApprovedFLS += flsTotal;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
//public override IList<ServiceRecord> GetBillableServiceRecords(CostBearer2SupportConcept c2s)
|
||||
//{
|
||||
// return c2s.ServiceRecords.OrderBy(s => s.Start).Where(s => !s.ServiceDescription.ServiceCategory.Name.ToLower().Contains("assistenz")).ToList();
|
||||
//}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BeWo.Data.Access;
|
||||
using BeWo.Data.Entities;
|
||||
using BeWo.Service.DCEntityMapper;
|
||||
using BeWo.Service.Invoicing;
|
||||
using BS.Shared;
|
||||
using BS.Shared.Core;
|
||||
using BS.Shared.DataContracts;
|
||||
using BS.Shared.DataContracts.Compact;
|
||||
using BS.Shared.Extensions;
|
||||
using BS.Shared.Services;
|
||||
|
||||
namespace MalteserJohanniterJohanneshaus.Invoicing
|
||||
{
|
||||
public class SoziotherapieInvoiceCreation : InvoiceCreation
|
||||
{
|
||||
public override void SetInvoiceId(ServiceInvoice invoice)
|
||||
{
|
||||
invoice.InvoiceBase.InvoiceId = "RechnungSoziotherapie";
|
||||
invoice.InvoiceBase.InvoiceTypeText = "Soziotherapie";
|
||||
}
|
||||
|
||||
public override IList<InvoiceItem> CreateInvoiceItems(List<ServiceRecordDC> serviceRecordsInPeriod, DateTimeSpan invoicePeriod, SupportConceptApprovalPeriod scap,
|
||||
Calculations calc)
|
||||
{
|
||||
var list = base.CreateInvoiceItems(serviceRecordsInPeriod, invoicePeriod, scap, calc);
|
||||
var ii = CreateHausbesuchspauschale(serviceRecordsInPeriod, invoicePeriod, scap);
|
||||
list.AddRange(ii);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public override InvoiceItem CreateInvoiceItem(ServiceRecordDC iServiceRecord, SupportConceptApprovalPeriod scap, Calculations calc)
|
||||
{
|
||||
var ii = base.CreateInvoiceItem(iServiceRecord, scap, calc);
|
||||
ii.ItemDescription = iServiceRecord.ServiceDescription.Name;
|
||||
|
||||
if (ii.ItemDescription.ToLower().Contains("probe"))
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001607";
|
||||
}
|
||||
else if (ii.ItemDescription.ToLower().Contains("gruppentherapie"))
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2002672";
|
||||
}
|
||||
else if (ii.ItemDescription.ToLower().Contains("video"))
|
||||
{
|
||||
if (iServiceRecord.RoundedDuration <= 30 || ii.ItemDescription.ToLower().Contains("30"))
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001616";
|
||||
}
|
||||
else if (iServiceRecord.RoundedDuration > 30 || ii.ItemDescription.ToLower().Contains("60"))
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001615";
|
||||
}
|
||||
}
|
||||
else if (ii.ItemDescription.ToLower().Contains("telefon"))
|
||||
{
|
||||
if (iServiceRecord.RoundedDuration <= 30)
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001618";
|
||||
}
|
||||
else if (iServiceRecord.RoundedDuration > 30)
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001617";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (iServiceRecord.RoundedDuration <= 30)
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001612";
|
||||
}
|
||||
else if (iServiceRecord.RoundedDuration > 30)
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001610";
|
||||
}
|
||||
}
|
||||
|
||||
return ii;
|
||||
}
|
||||
|
||||
|
||||
public virtual IList<InvoiceItem> CreateHausbesuchspauschale(List<ServiceRecordDC> serviceRecordsInPeriod, DateTimeSpan invoicePeriod, SupportConceptApprovalPeriod scap)
|
||||
{
|
||||
IList<InvoiceItem> items = new List<InvoiceItem>();
|
||||
decimal hausbesuchspauschale = 7.98m;
|
||||
var preise = DAOFactory.GenericDAO.GetAllActive<Preis>();
|
||||
hausbesuchspauschale = GetPreis(preise, "Hausbesuchspauschale", invoicePeriod.StartDate);
|
||||
|
||||
int countHausbesuch = 0;
|
||||
|
||||
foreach (var sr in serviceRecordsInPeriod)
|
||||
{
|
||||
if (sr.ServiceDescription.Name.ToLower().Contains("aufsuchend"))
|
||||
{
|
||||
countHausbesuch++;
|
||||
}
|
||||
}
|
||||
|
||||
if (countHausbesuch > 0)
|
||||
{
|
||||
var invoiceItem = new InvoiceItem();
|
||||
|
||||
decimal anzahlHausbesuche = countHausbesuch;
|
||||
|
||||
invoiceItem.AmountPerUnit = hausbesuchspauschale;
|
||||
invoiceItem.UnitCount = anzahlHausbesuche;
|
||||
invoiceItem.AmountTotal = anzahlHausbesuche * hausbesuchspauschale;
|
||||
invoiceItem.ItemPeriodStart = invoicePeriod.StartDate;
|
||||
invoiceItem.ItemPeriodEnd = invoicePeriod.EndDate;
|
||||
invoiceItem.RateFactor = null;
|
||||
invoiceItem.GrossAmountTotal = invoiceItem.AmountTotal;
|
||||
invoiceItem.ItemDescription = "Hausbesuchspauschale";
|
||||
invoiceItem.UnitDescription = "GPos: 2009690";
|
||||
if (scap != null)
|
||||
invoiceItem.SupportConceptApprovalPeriodOid = scap.Oid;
|
||||
|
||||
items.Add(invoiceItem);
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
private static decimal GetPreis(IList<Preis> allePreise, String name, DateTime datum)
|
||||
{
|
||||
|
||||
var tagessatz = allePreise.Where(p => p.Name.Contains(name)).FirstOrDefault();
|
||||
if (tagessatz != null)
|
||||
{
|
||||
var crlist = MapperFactory.CostRatePeriodDC_CostRatePeriod.MapToNewDCs(tagessatz.CostRatePeriods);
|
||||
|
||||
var cr = crlist.GetCostRatePeriodForDate(CostRatePeriodType.AmountOfMoney, datum);
|
||||
if (cr != null && cr.CostRateValue.HasValue)
|
||||
{
|
||||
return cr.CostRateValue.Value;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override IList<InvoiceItem> CreateSummaryInvoiceItems(IList<InvoiceItem> itemList, DateTimeSpan invoicePeriod, SupportConceptApprovalPeriod scap, Calculations calc, bool summaryPerMonth, bool addRateFactorToUnitCount)
|
||||
{
|
||||
return base.CreateSummaryInvoiceItems(itemList, invoicePeriod, scap, calc, true, true);
|
||||
}
|
||||
|
||||
public override string GetSummaryItemKey(SupportConceptApprovalPeriod scap, InvoiceItem iitem, bool summaryPerMonth)
|
||||
{
|
||||
String key = String.Format("{0}_{1}_{2}", iitem.AmountPerUnit, iitem.RateFactor, iitem.ItemDescription);
|
||||
if (summaryPerMonth)
|
||||
{
|
||||
key = String.Format("{0}_{1}_{2:yyyyMM}_{3}", iitem.AmountPerUnit, iitem.RateFactor, iitem.ItemPeriodStart, iitem.ItemDescription);
|
||||
}
|
||||
|
||||
return key;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -61,8 +61,19 @@
|
||||
<Compile Include="CustomerDataReport.Designer.cs">
|
||||
<DependentUpon>CustomerDataReport.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="CustomReportCreator.cs" />
|
||||
<Compile Include="Datev\CustomDataExporter.cs" />
|
||||
<Compile Include="Datev\DatevExporter.cs" />
|
||||
<Compile Include="Finanzauswertung.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Finanzauswertung.designer.cs">
|
||||
<DependentUpon>Finanzauswertung.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Invoicing\CustomInvoiceCreation.cs" />
|
||||
<Compile Include="Invoicing\CustomInvoiceFactory.cs" />
|
||||
<Compile Include="Invoicing\SettlementInvoiceCreation.cs" />
|
||||
<Compile Include="Invoicing\SoziotherapieInvoiceCreation.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Quittierungsbeleg.cs">
|
||||
<SubType>Component</SubType>
|
||||
@@ -78,6 +89,12 @@
|
||||
</Compile>
|
||||
<Compile Include="Service\CustomCustomerService.cs" />
|
||||
<Compile Include="Service\CustomHomeContentGenerator.cs" />
|
||||
<Compile Include="SoziotherapieLeistungsnachweis.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SoziotherapieLeistungsnachweis.designer.cs">
|
||||
<DependentUpon>SoziotherapieLeistungsnachweis.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Translation\TranslationDictionary.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -103,6 +120,10 @@
|
||||
<DependentUpon>CustomerDataReport.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Finanzauswertung.resx">
|
||||
<DependentUpon>Finanzauswertung.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\licenses.licx" />
|
||||
<EmbeddedResource Include="Quittierungsbeleg.resx">
|
||||
<DependentUpon>Quittierungsbeleg.cs</DependentUpon>
|
||||
@@ -112,6 +133,9 @@
|
||||
<DependentUpon>ServiceRecordListReport.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="SoziotherapieLeistungsnachweis.resx">
|
||||
<DependentUpon>SoziotherapieLeistungsnachweis.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -0,0 +1 @@
|
||||
DevExpress.XtraReports.UI.XtraReport, DevExpress.XtraReports.v23.2, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using BeWo.Report.ReportObjects;
|
||||
namespace BeWo.Report.DefaultReports
|
||||
namespace MalteserJohanniterJohanneshaus
|
||||
{
|
||||
partial class Quittierungsbeleg
|
||||
{
|
||||
|
||||
@@ -3,12 +3,13 @@ using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using BeWo.Report;
|
||||
using BeWo.Report.ReportObjects;
|
||||
using BeWo.Service.DCEntityMapper;
|
||||
using BS.Shared.Core;
|
||||
using DevExpress.XtraReports.UI;
|
||||
|
||||
namespace BeWo.Report.DefaultReports
|
||||
namespace MalteserJohanniterJohanneshaus
|
||||
{
|
||||
public partial class Quittierungsbeleg : XtraReport, IBeWoReport<ServicesOverviewRO>
|
||||
{
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using BS.Shared.Core;
|
||||
using DevExpress.XtraReports.UI;
|
||||
using BeWo.Report.ReportObjects;
|
||||
using BeWo.Report;
|
||||
using System.Collections.Generic;
|
||||
using BeWo.Data.Access;
|
||||
using System.IO;
|
||||
using System.Drawing;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace MalteserJohanniterJohanneshaus
|
||||
{
|
||||
|
||||
public partial class LeistungsnachweisSoziotherapie : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<ServicesOverviewRO>
|
||||
{
|
||||
public LeistungsnachweisSoziotherapie()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void SetReportDataSource(ServicesOverviewRO pRO)
|
||||
{
|
||||
double gesamt = 0;
|
||||
if (pRO.Services != null)
|
||||
{
|
||||
List<ServicesOverviewRO.ServiceDetail> servicesBillable = new List<ServicesOverviewRO.ServiceDetail>();
|
||||
|
||||
foreach (ServicesOverviewRO.ServiceDetail s in pRO.Services)
|
||||
{
|
||||
if (s.IsBillable)
|
||||
{
|
||||
servicesBillable.Add(s);
|
||||
s.Minutes = s.Minutes * (double)pRO.RateFactor;
|
||||
gesamt += s.Minutes;
|
||||
}
|
||||
s.Notice5 = "E"; //Einzel
|
||||
|
||||
if (s.ServiceDescription.Contains("Probation") || s.ServiceDescription.Contains("(P)"))
|
||||
{
|
||||
s.Notice5 = "P";
|
||||
}
|
||||
else if (s.ServiceDescription.Contains("(G)"))
|
||||
{
|
||||
s.Notice5 = "G";
|
||||
}
|
||||
|
||||
if (s.ServiceDescription.Contains("(A)"))
|
||||
{
|
||||
s.ServiceDescription = "(A)";
|
||||
}
|
||||
else if (s.ServiceDescription.Contains("(V)"))
|
||||
{
|
||||
s.ServiceDescription = "(V)";
|
||||
}
|
||||
else if (s.ServiceDescription.Contains("(T)"))
|
||||
{
|
||||
s.ServiceDescription = "(T)";
|
||||
}
|
||||
else if (s.ServiceDescription.Contains("(E)") || s.ServiceDescription.Contains("(G)"))
|
||||
{
|
||||
s.ServiceDescription = "(E)";
|
||||
}
|
||||
|
||||
|
||||
ServicesOverviewRO.CreateSignatureString(s);
|
||||
}
|
||||
|
||||
pRO.Services = servicesBillable;
|
||||
}
|
||||
|
||||
|
||||
cellGesamt.Text = String.Format("{0:0.00}", gesamt / 60);
|
||||
|
||||
//SetzeAdresseUndIk(pRO);
|
||||
|
||||
|
||||
this.bindingSource1.DataSource = pRO;
|
||||
}
|
||||
|
||||
private void picSignature_BeforePrint(object sender, CancelEventArgs e)
|
||||
{
|
||||
XRPictureBox xrBox = sender as XRPictureBox;
|
||||
//var test = this.GetCurrent
|
||||
string base64String = xrBox.Tag as string;
|
||||
if (!String.IsNullOrWhiteSpace(base64String))
|
||||
{
|
||||
var base64Data = Regex.Match(base64String, @"data:image/(?<type>.+?),(?<data>.+)").Groups["data"].Value;
|
||||
var binData = Convert.FromBase64String(base64Data);
|
||||
Image img = ByteArrayToImage(binData);
|
||||
xrBox.Image = Utils.CropImage(img);
|
||||
}
|
||||
else
|
||||
{
|
||||
xrBox.Image = null;
|
||||
}
|
||||
}
|
||||
|
||||
public Image ByteArrayToImage(byte[] byteArrayIn)
|
||||
{
|
||||
using (var memoryStream = new MemoryStream(byteArrayIn))
|
||||
{
|
||||
return Image.FromStream(memoryStream);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
1068
ReportImp/MalteserJohanniterJohanneshaus/SoziotherapieLeistungsnachweis.designer.cs
generated
Normal file
1068
ReportImp/MalteserJohanniterJohanneshaus/SoziotherapieLeistungsnachweis.designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user