PerspektivenEV/Export/DatevExporter
This commit is contained in:
@@ -57,17 +57,21 @@ namespace PerspektivenEV.Export
|
||||
var sql = GetMonatlicheRechnungenSql(date);
|
||||
|
||||
/*
|
||||
sip.Claim,
|
||||
c.DebitorNumber,
|
||||
ib.InvoiceDate,
|
||||
ib.invoicenumber,
|
||||
c.CostCenter,
|
||||
c2s.Oid,
|
||||
ib.InvoiceId,
|
||||
ii.ServiceDescription,
|
||||
ii.HourlyRate,
|
||||
ii.UnitCount,
|
||||
ii.GrossAmount
|
||||
0 sip.Claim,
|
||||
1 c.DebitorNumber,
|
||||
2 ib.InvoiceDate,
|
||||
3 ib.invoicenumber,
|
||||
4 ib.Oid AS InvoiceOID,
|
||||
5 c.CostCenter,
|
||||
6 c2s.Oid,
|
||||
7 ib.InvoiceId,
|
||||
8 ib.RecipientOrganisation,
|
||||
9 ii.ItemDescription,
|
||||
10 ii.UnitDescription,
|
||||
11 ii.Notice,
|
||||
12 ii.AmountPerUnit,
|
||||
13 ii.UnitCount,
|
||||
14 ii.AmountTotal
|
||||
*/
|
||||
|
||||
//Kontonummer; Umsatz; Gegenkonto; Belegdatum; Kost 1; Belegfeld 1; Buchungstext; Festschreibung
|
||||
@@ -76,6 +80,27 @@ namespace PerspektivenEV.Export
|
||||
StringBuilder sb = new StringBuilder();
|
||||
foreach (DataRow row in dt.Rows)
|
||||
{
|
||||
String orgaName = "";
|
||||
String itemDescription = "";
|
||||
String unitDescription = "";
|
||||
String isApproved = "";
|
||||
|
||||
if (row[8] != null)
|
||||
{
|
||||
orgaName = row[8].ToString();
|
||||
}
|
||||
if (row[9] != null)
|
||||
{
|
||||
itemDescription = row[9].ToString();
|
||||
}
|
||||
if (row[10] != null)
|
||||
{
|
||||
unitDescription = row[10].ToString();
|
||||
}
|
||||
if (row[11] != null)
|
||||
{
|
||||
isApproved = row[11].ToString();
|
||||
}
|
||||
if (sb.Length > 0)
|
||||
{
|
||||
sb.AppendLine();
|
||||
@@ -85,18 +110,19 @@ namespace PerspektivenEV.Export
|
||||
|
||||
sb.Append(String.Format("{0}", row[1])); //Debitornr. als Kontonummer noch offen!?
|
||||
sb.Append(";");
|
||||
sb.Append(String.Format("{0:0.00}", row[0])); //Umsatz
|
||||
sb.Append(String.Format("{0:0.00}", row[12])); //Umsatz - der Rechnungsposition
|
||||
sb.Append(";");
|
||||
var gegenkto = GetErloeskonto(itemDescription, unitDescription, orgaName, isApproved);
|
||||
sb.Append(gegenkto); //Gegenkonto
|
||||
sb.Append(";");
|
||||
// GetErloeskonto();
|
||||
sb.Append("999999;"); //Gegenkonto
|
||||
sb.Append(String.Format("{0:ddMM}", lastDate));
|
||||
sb.Append(";");
|
||||
// GetKostenstelle();
|
||||
sb.Append("999999;"); //Kostenstelle
|
||||
var kostenstelle = GetKostenstelle(itemDescription, unitDescription);
|
||||
sb.Append("kostenstelle;"); //Kostenstelle
|
||||
sb.Append(String.Format("{0}", row[3]));
|
||||
sb.Append(";");
|
||||
String buchungstext = "";
|
||||
long? c2sOid = (long?)row[5];
|
||||
long? c2sOid = (long?)row[6];
|
||||
|
||||
if (c2sOid.HasValue)
|
||||
{
|
||||
@@ -109,11 +135,96 @@ namespace PerspektivenEV.Export
|
||||
|
||||
sb.Append(buchungstext);
|
||||
sb.Append(";");
|
||||
//noch löschen nur zur Kontrolle
|
||||
sb.Append(String.Format("{0:0.00}", row[0])); //Umsatz
|
||||
sb.Append(";");
|
||||
sb.Append("0;");
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
private static String GetErloeskonto(String itemDesc, String unitDesc, String orgaName, String isApproved)
|
||||
{
|
||||
if (itemDesc.Contains("Handgeld"))
|
||||
return "496101";
|
||||
|
||||
else if (orgaName == "Selbstzahler")
|
||||
{
|
||||
if (unitDesc.Contains("FLS BW"))
|
||||
return "495805";
|
||||
else if (unitDesc.Contains("Tagesstätte"))
|
||||
return "467601";
|
||||
else
|
||||
return "444444";
|
||||
}
|
||||
|
||||
else if (isApproved == "false")
|
||||
{
|
||||
if (unitDesc.Contains("FLS BW"))
|
||||
return "495804";
|
||||
else if (unitDesc.ToLower().Contains("fls pfk"))
|
||||
return "496202";
|
||||
else
|
||||
return "444444";
|
||||
}
|
||||
|
||||
else if (orgaName == "LWV")
|
||||
{
|
||||
if (unitDesc.Contains("FLS BW FFM"))
|
||||
return "495801";
|
||||
else if (unitDesc.Contains("FLS BW HTK"))
|
||||
return "495800";
|
||||
else if (unitDesc.Contains("FLS BW KB"))
|
||||
return "495802";
|
||||
else if (unitDesc.Contains("Tagesstätte"))
|
||||
return "467600";
|
||||
else
|
||||
return "444444";
|
||||
}
|
||||
else if (orgaName != "LWV" && orgaName != "SELBSTZAHLER")
|
||||
{
|
||||
if (unitDesc.Contains("FLS BW FFM"))
|
||||
return "495806";
|
||||
else if (unitDesc.Contains("FLS BW HTK"))
|
||||
return "495803";
|
||||
else if (unitDesc.Contains("FLS BW KB"))
|
||||
return "495802";
|
||||
else if (unitDesc.ToLower().Contains("fls pfk ffm"))
|
||||
return "496200";
|
||||
else if (unitDesc.ToLower().Contains("fls pfk htk"))
|
||||
return "496201";
|
||||
else
|
||||
return "444444";
|
||||
}
|
||||
else
|
||||
return "444444";
|
||||
}
|
||||
|
||||
private static String GetKostenstelle(String itemDesc, String unitDesc)
|
||||
{
|
||||
if (unitDesc == "Beratung")
|
||||
return "350";
|
||||
else if (unitDesc.Contains("FLS BW FFM"))
|
||||
return "158";
|
||||
else if (unitDesc.Contains("FLS BW HTK"))
|
||||
return "150";
|
||||
else if (unitDesc.Contains("FLS BW KB"))
|
||||
return "150";
|
||||
else if (unitDesc.ToLower().Contains("fls pfk"))
|
||||
return "300";
|
||||
else if (unitDesc == "Tagesstätte") // implementieren 200,201,202
|
||||
return "200";
|
||||
else if (unitDesc.Contains("Traumberatung As"))
|
||||
return "360";
|
||||
else if (unitDesc.Contains("Traumberatung PnT"))
|
||||
return "361";
|
||||
if (itemDesc.Contains("Handgeld")) // implementieren 150,158,200,201
|
||||
return "150";
|
||||
else
|
||||
return "444444";
|
||||
}
|
||||
|
||||
private static String GetMonatlicheRechnungenSql(DateTime date)
|
||||
{
|
||||
String sql = @"
|
||||
@@ -126,7 +237,9 @@ namespace PerspektivenEV.Export
|
||||
c.CostCenter,
|
||||
c2s.Oid,
|
||||
ib.InvoiceId,
|
||||
ib.RecipientOrganisation,
|
||||
ii.ItemDescription,
|
||||
ii.UnitDescription,
|
||||
ii.AmountPerUnit,
|
||||
ii.UnitCount,
|
||||
ii.AmountTotal
|
||||
|
||||
Reference in New Issue
Block a user