From dffef4bb21f660e87aecaf3f5b55d060d26400b0 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Fri, 27 Apr 2018 18:10:16 +0200 Subject: [PATCH] CZ Fio bank profile --- Logic/Financial/ExternalBankDataProfile.cs | 27 +++++++++++++++++++++- Site/Pages/v5/Ledgers/AccountPlan.aspx.cs | 11 +++++++-- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/Logic/Financial/ExternalBankDataProfile.cs b/Logic/Financial/ExternalBankDataProfile.cs index 03c74d04..1413b5bb 100644 --- a/Logic/Financial/ExternalBankDataProfile.cs +++ b/Logic/Financial/ExternalBankDataProfile.cs @@ -14,6 +14,7 @@ namespace Swarmops.Logic.Financial private ExternalBankDataProfile() { FieldNames = new Dictionary(); + FieldDelimiter = ','; } public string DateTimeFormatString @@ -65,6 +66,7 @@ namespace Swarmops.Logic.Financial public int IgnoreInitialLines { get; set; } public string InitialReplacements { get; set; } public int ExternalBankDataProfileId { get; set; } + public char FieldDelimiter { get; set; } public int Identity { get { return ExternalBankDataProfileId; } } public Dictionary FieldNames { get; private set; } @@ -146,6 +148,8 @@ namespace Swarmops.Logic.Financial result.BankDataAccountReader = StockBankDataReaders.CommaSeparatedValuesAccountReader; result.BankDataPaymentsReader = null; // No aggregated payments with Postbank + result.FieldDelimiter = ';'; // DE Postbank uses semicolon as delimiter for no reason in particular + return result; } @@ -157,7 +161,25 @@ namespace Swarmops.Logic.Financial result.Country = Structure.Country.FromCode("CZ"); result.Culture = "cz-CZ"; - result.FieldNames[ExternalBankDataFieldName.Date] = "...Continue here..."; + result.InitialReplacements = ";|\t"; // before CSV helper is implemented, replace field separators with spaces + + result.FieldNames[ExternalBankDataFieldName.Date] = "Datum"; // in dd.mm.yyyy format + result.FieldNames[ExternalBankDataFieldName.DescriptionPrimary] = "Zpráva pro příjemce"; + result.FieldNames[ExternalBankDataFieldName.CounterpartyName] = "Název protiúčtu"; + result.FieldNames[ExternalBankDataFieldName.CounterpartyAccount] = "Protiúčet"; + result.FieldNames[ExternalBankDataFieldName.CounterpartyBank] = "Kód banky"; + result.FieldNames[ExternalBankDataFieldName.DescriptionSecondary] = "Typ"; + result.FieldNames[ExternalBankDataFieldName.TransactionNet] = "Objem"; // has comma as radix + result.FieldNames[ExternalBankDataFieldName.Currency] = "Měna"; // must be czk + + result.LatestTransactionLocation = LatestTransactionLocation.Bottom; + result.FeeSignage = FeeSignage.Unknown; // no inline fees + result.Precision = ExternalBankDateTimePrecision.Day; + + result.BankDataAccountReader = StockBankDataReaders.CommaSeparatedValuesAccountReader; + result.BankDataPaymentsReader = null; // No aggregated payments with Postbank + + result.FieldDelimiter = ';'; // CZ Fio uses semicolon as delimiter for no reason in particular } throw new ArgumentException ("Unrecognized profile Id"); @@ -173,6 +195,9 @@ namespace Swarmops.Logic.Financial TransactionNet, DescriptionPrimary, DescriptionSecondary, + CounterpartyAccount, + CounterpartyBank, + CounterpartyName, UniqueId, NotUniqueId, Date, diff --git a/Site/Pages/v5/Ledgers/AccountPlan.aspx.cs b/Site/Pages/v5/Ledgers/AccountPlan.aspx.cs index b58799d0..dbbd727b 100644 --- a/Site/Pages/v5/Ledgers/AccountPlan.aspx.cs +++ b/Site/Pages/v5/Ledgers/AccountPlan.aspx.cs @@ -183,7 +183,10 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers if (result.AutomationData.AutomationEnabled && result.AutomationData.NonPresentationCurrency) { - result.CurrencyCode = result.AutomationData.AutomationCurrencyCode; + Currency foreignCurrency = Currency.FromCode(result.AutomationData.AutomationCurrencyCode); + + result.AutomationData.AutomationCurrencyCode = foreignCurrency.DisplayCode; + account.ForeignCurrency = foreignCurrency; } else { @@ -490,6 +493,8 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers AjaxCallAutomationDataResult result = new AjaxCallAutomationDataResult(); result.Success = true; result.Data = GetAccountAutomationData(profileId); + result.Data.NonPresentationCurrency = + (result.Data.Profile.Currency.Identity != authData.CurrentOrganization.Currency.Identity); return result; } @@ -506,7 +511,9 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers if (result.AutomationEnabled) { - // result.Profile = + result.Profile = FinancialAccountAutomationProfile.FromIdentity(profileId); + result.AutomationCurrencyCode = result.Profile.Currency.Code; + // the "NonpresentationCurrency" field can't be set here, because we don't know the presentation currency } return result;