PerspektivenEV/Export/DatevExporterBthg - Debitor bei Eigenanteilsrg angefügt

SupportOID=161986
This commit is contained in:
2026-05-18 11:29:06 +02:00
parent ff82506d1f
commit 420ff4138b

View File

@@ -180,7 +180,9 @@ namespace PerspektivenEV.Export
12 ii.Notice,
13 ii.AmountPerUnit,
14 ii.UnitCount,
15 ii.AmountTotal
15 ii.AmountTotal,
16 ib.CustomerOid,
17 ib.CostbearerOid
*/
//Kontonummer; Umsatz; Gegenkonto; Belegdatum; Kost 1; Belegfeld 1; Buchungstext; Festschreibung
@@ -193,6 +195,8 @@ namespace PerspektivenEV.Export
String itemDescription = "";
String unitDescription = "";
String isApproved = "";
long? cOid = null;
if (row[8] != null)
orgaName = row[8].ToString();
@@ -206,14 +210,35 @@ namespace PerspektivenEV.Export
if (row[12] != null)
isApproved = row[12].ToString();
if (row[16] != null)
cOid = long.Parse(row[16].ToString());
if (sb.Length > 0)
sb.AppendLine();
DateTime lastDate = new DateTime(date.Year, date.Month, 1);
lastDate = lastDate.AddMonths(1).AddDays(-1);
var debitor = "999998";
if (cOid != null)
{
var scs = DAOFactory.SearchDAO.GetAllActiveSupportConceptsByCustomers(new List<long>() { cOid.Value }, false).ToList();
if (scs != null && scs.Count != 0 && scs[0].CostBearer2SupportConceptList != null)
{
var sc = scs[0];
if (scs.Count > 1)
{
sc = scs.Where(p => p.StartDate < lastDate && p.EndDate > new DateTime(date.Year, date.Month, 1)).FirstOrDefault();
}
var cb2sc = sc.CostBearer2SupportConceptList.Where(sc => sc.CostBearer.Organisation.Name != "EIGENANTEIL" && sc.CostBearer.Organisation.Name != "SELBSTZAHLER").FirstOrDefault();
if (cb2sc != null && cb2sc.KontoHilfeplan != null && cb2sc.KontoHilfeplan.Length > 0)
{
debitor = cb2sc.KontoHilfeplan;
}
}
}
//sb.Append(String.Format("{0}", row[1])); //Debitornr. als Kontonummer
sb.Append("999998;");
sb.Append(debitor + ";");
sb.Append(String.Format("{0:0.00}", row[15])); //Umsatz - der Rechnungsposition
sb.Append(";");
//var gegenkto = GetErloeskonto(itemDescription, unitDescription, orgaName, isApproved);
@@ -573,7 +598,9 @@ namespace PerspektivenEV.Export
ii.Notice,
ii.AmountPerUnit,
ii.UnitCount,
ii.AmountTotal
ii.AmountTotal,
ib.RecipientCustomerOid,
ib.RecipientCostbearerOid
from
invoicebase ib
inner join invoiceitem ii on ii.InvoiceBaseOid = ib.Oid