diff --git a/ReportImp/LebenshilfeBadKreuznachFUD/Export/SageExporter.cs b/ReportImp/LebenshilfeBadKreuznachFUD/Export/SageExporter.cs index 50c147b4e..657c262fd 100644 --- a/ReportImp/LebenshilfeBadKreuznachFUD/Export/SageExporter.cs +++ b/ReportImp/LebenshilfeBadKreuznachFUD/Export/SageExporter.cs @@ -35,6 +35,11 @@ namespace LebenshilfeBadKreuznachFUD.Export query.FileName = String.Format("SageExportAutismus{0:yyyyMM}.csv", dt); query.QueryResult = GetAbrechnungenString(dt, "Autismus"); } + else if (query.Oid == 103) + { + query.FileName = String.Format("SageExportKita{0:yyyyMM}.csv", dt); + query.QueryResult = GetAbrechnungenString(dt, "Kita"); + } return query; } @@ -95,7 +100,7 @@ ib.AccountingPeriodEnd, String buchungstext = GetBuchungstext(row, teamname); sb.Append(buchungstext); sb.Append(";"); - if (teamname == "Integration") + if (teamname == "Integration"|| teamname == "Kita") { sb.Append(String.Format("{0}", row[7])); // Sollkonto - Kundennr. Kostenträger } @@ -113,12 +118,27 @@ ib.AccountingPeriodEnd, String costCenter = GetKostenstelle(row[9], teamname); sb.Append(costCenter + ";"); // Kostenstelle (String.Format("{0}", row[9])); sb.Append(costCenter + ";"); // Kostenstelle Haben (String.Format("{0}", row[9])); - sb.Append(";;;12"); // Buchungskreis + String buchungskreis = GetBuchungskreis(row[9], teamname); + sb.Append(String.Format(";;;{0}", buchungskreis)); // Buchungskreis } return sb.ToString(); } + private static string GetBuchungskreis(object v, string teamname) + { + string kreis = "12"; + if (teamname == "Kita") // Kostenstelle ist bei Kind hinterlegt; Kostenstelle spezifisch für jede Kita, damit Buchungskreis ableitbar (ansonsten müsste man über Team des Kindes gehen) + { + kreis = "2"; + if (v.ToString() != null && v.ToString().ToLower().Contains("t80600")) + { + kreis = "3"; + } + } + return kreis; + } + private static string GetBuchungstext(DataRow row, string teamname) { String text = String.Format("{0:MM}/{0:yyyy} {1} - {2}", row[11], row[5], row[6]); @@ -130,6 +150,10 @@ ib.AccountingPeriodEnd, { text = "AR-ENT " + text; } + else if (teamname == "Kita") + { + text = "AR-PS " + text; + } return text; } @@ -161,6 +185,14 @@ ib.AccountingPeriodEnd, kto = "S82029"; } } + else if (teamname == "Kita") // Kostenstelle ist bei Kind hinterlegt; Kostenstelle spezifisch für jede Kita, damit Konto ableitbar (ansonsten müsste man über Team des Kindes gehen) + { + kto = "S82002"; + if (row[9].ToString() != null && row[9].ToString().ToLower().Contains("t80600")) + { + kto = "S82003"; + } + } return kto; } @@ -171,7 +203,7 @@ ib.AccountingPeriodEnd, { stelle = "T70400"; } - else if (teamname == "Entlastung") + else if (teamname == "Entlastung" || teamname == "Kita") { stelle = String.Format("{0}", v); } @@ -209,7 +241,7 @@ inner join serviceinvoiceperiod sip on sip.serviceinvoiceoid = si.oid inner join invoiceitem ii on ii.serviceinvoiceperiodoid = sip.oid WHERE ib.`AccountingPeriodEnd` >= ':Monat_Start' AND ib.`AccountingPeriodEnd` < ':Monat_End' and ib.IsActive = 1 ORDER BY p.`LastName`, p.`FirstName`, cb2sc.`ApprovedStartDate`, ii.GrossAmountTotal desc) AS sqry -WHERE Team = ':teamname' +WHERE Team like ':teamname%' "; return sql;