Work on PDF conversion

This commit is contained in:
Rick Falkvinge
2017-09-28 17:16:14 +02:00
parent e8c833fef0
commit ea05b79370
11 changed files with 143 additions and 17 deletions
+27 -2
View File
@@ -46,7 +46,32 @@ namespace Swarmops.Logic.Financial
string organizationCurrencyCode = organization.Currency.Code;
int crlfIndex = data.IndexOfAny (new[] {'\n', '\r'});
// Replace any strings initially to force the bank data into readability (per profile)
string[] replacements = Profile.InitialReplacements.Split('|');
for (int loop = 0; loop < replacements.Length/2; loop++)
{
data = data.Replace(replacements[loop*2], replacements[loop*2 + 1]);
}
int crlfIndex;
for (int loop = 0; loop < Profile.IgnoreInitialLines && !String.IsNullOrEmpty(data); loop++)
{
crlfIndex = data.IndexOfAny(new[] { '\n', '\r' });
if (crlfIndex > 0)
{
data = data.Substring(crlfIndex).Trim();
}
else
{
data = string.Empty;
}
}
crlfIndex = data.IndexOfAny (new[] {'\n', '\r'});
string fieldKeyLine = data.Substring (0, crlfIndex);
@@ -61,7 +86,7 @@ namespace Swarmops.Logic.Financial
{
for (int index = 0; index < dataKeyFields.Length; index++)
{
if (dataKeyFields[index].Trim() == Profile.FieldNames[fieldName])
if (StripQuotes(dataKeyFields[index]).Trim() == Profile.FieldNames[fieldName])
{
fieldNameLookup[fieldName] = index;
break;
@@ -45,12 +45,19 @@ namespace Swarmops.Logic.Financial
get { return 2; }
}
public static int DEPostbankId
{
get { return 3; }
}
public string Name { get; set; }
public Country Country { get; set; }
public string Culture { get; set; }
public string Currency { get; set; }
public string BankDataAccountReader { get; set; }
public string BankDataPaymentsReader { get; set; }
public int IgnoreInitialLines { get; set; }
public string InitialReplacements { get; set; }
public Dictionary<ExternalBankDataFieldName, string> FieldNames { get; private set; }
@@ -109,6 +116,29 @@ namespace Swarmops.Logic.Financial
return result;
}
if (externalBankDataProfileId == DEPostbankId)
{
result.Name = "DE Postbank";
result.Country = Country.FromCode("DE");
result.Culture = "de-DE";
result.IgnoreInitialLines = 8;
result.InitialReplacements = ";|\t| €| (€)|";
result.FieldNames[ExternalBankDataFieldName.Date] = "Buchungstag";
result.FieldNames[ExternalBankDataFieldName.Description] = "Buchungsdetails";
result.FieldNames[ExternalBankDataFieldName.TransactionNet] = "Betrag";
result.FieldNames[ExternalBankDataFieldName.AccountBalance] = "Saldo";
result.LatestTransactionLocation = LatestTransactionLocation.Top;
result.FeeSignage = FeeSignage.Unknown; // no inline fees
result.Precision = ExternalBankDateTimePrecision.Day;
result.BankDataAccountReader = StockBankDataReaders.TabSeparatedValuesAccountReader;
result.BankDataPaymentsReader = null; // No aggregated payments with Paypal
return result;
}
throw new ArgumentException ("Unrecognized profile Id");
}
}
+6
View File
@@ -212,6 +212,12 @@ namespace Swarmops.Logic.Financial
return ExternalBankDataProfile.FromIdentity (ExternalBankDataProfile.SESebId);
}
if (OrganizationId == 8 && PilotInstallationIds.IsPilot(PilotInstallationIds.SwarmopsLive) &&
FinancialAccountId == 150)
{
return ExternalBankDataProfile.FromIdentity(ExternalBankDataProfile.DEPostbankId);
}
return null;
}
}
+5
View File
@@ -8,6 +8,11 @@
get { return "TabSeparatedValuesReader"; }
}
public static string SemicolonSeparatedValuesAccountReader
{
get { return "SemicolonSeparatedValuesReader"; }
}
public static string SEPaymentsBankgiroReader
{
get { return "SEPaymentsBankgiroReader"; }