Resuming work on nonpres currency import
This commit is contained in:
@@ -38,7 +38,7 @@ namespace Swarmops.Logic.Financial
|
||||
throw new InvalidOperationException ("Cannot call LoadData before a profile has been set");
|
||||
}
|
||||
|
||||
if (Profile.BankDataAccountReader != StockBankDataReaders.TabSeparatedValuesAccountReader)
|
||||
if (Profile.BankDataAccountReader != StockBankDataReaders.CommaSeparatedValuesAccountReader)
|
||||
{
|
||||
throw new NotImplementedException ("Only tab separated values are supported at this point");
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Swarmops.Common.Interfaces;
|
||||
using Swarmops.Logic.Structure;
|
||||
|
||||
namespace Swarmops.Logic.Financial
|
||||
{
|
||||
public class ExternalBankDataProfile
|
||||
public class ExternalBankDataProfile: IHasIdentity
|
||||
{
|
||||
public FeeSignage FeeSignage;
|
||||
public LatestTransactionLocation LatestTransactionLocation;
|
||||
@@ -50,6 +51,11 @@ namespace Swarmops.Logic.Financial
|
||||
get { return 3; }
|
||||
}
|
||||
|
||||
public static int CZFioId
|
||||
{
|
||||
get { return 4; }
|
||||
}
|
||||
|
||||
public string Name { get; set; }
|
||||
public Country Country { get; set; }
|
||||
public string Culture { get; set; }
|
||||
@@ -58,12 +64,15 @@ namespace Swarmops.Logic.Financial
|
||||
public string BankDataPaymentsReader { get; set; }
|
||||
public int IgnoreInitialLines { get; set; }
|
||||
public string InitialReplacements { get; set; }
|
||||
public int ExternalBankDataProfileId { get; set; }
|
||||
public int Identity { get { return ExternalBankDataProfileId; } }
|
||||
|
||||
public Dictionary<ExternalBankDataFieldName, string> FieldNames { get; private set; }
|
||||
|
||||
public static ExternalBankDataProfile FromIdentity (int externalBankDataProfileId)
|
||||
{
|
||||
ExternalBankDataProfile result = new ExternalBankDataProfile();
|
||||
result.ExternalBankDataProfileId = externalBankDataProfileId;
|
||||
|
||||
// Ugly hack for now
|
||||
|
||||
@@ -83,7 +92,7 @@ namespace Swarmops.Logic.Financial
|
||||
result.FeeSignage = FeeSignage.Unknown; // no inline fees
|
||||
result.Precision = ExternalBankDateTimePrecision.Day;
|
||||
|
||||
result.BankDataAccountReader = StockBankDataReaders.TabSeparatedValuesAccountReader;
|
||||
result.BankDataAccountReader = StockBankDataReaders.CommaSeparatedValuesAccountReader;
|
||||
result.BankDataPaymentsReader = StockBankDataReaders.SEPaymentsBankgiroReader;
|
||||
|
||||
return result;
|
||||
@@ -110,7 +119,7 @@ namespace Swarmops.Logic.Financial
|
||||
result.FeeSignage = FeeSignage.Negative;
|
||||
result.Precision = ExternalBankDateTimePrecision.Second;
|
||||
|
||||
result.BankDataAccountReader = StockBankDataReaders.TabSeparatedValuesAccountReader;
|
||||
result.BankDataAccountReader = StockBankDataReaders.CommaSeparatedValuesAccountReader;
|
||||
result.BankDataPaymentsReader = null; // No aggregated payments with Paypal
|
||||
|
||||
return result;
|
||||
@@ -134,12 +143,23 @@ namespace Swarmops.Logic.Financial
|
||||
result.FeeSignage = FeeSignage.Unknown; // no inline fees
|
||||
result.Precision = ExternalBankDateTimePrecision.Day;
|
||||
|
||||
result.BankDataAccountReader = StockBankDataReaders.TabSeparatedValuesAccountReader;
|
||||
result.BankDataPaymentsReader = null; // No aggregated payments with Paypal
|
||||
result.BankDataAccountReader = StockBankDataReaders.CommaSeparatedValuesAccountReader;
|
||||
result.BankDataPaymentsReader = null; // No aggregated payments with Postbank
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
if (externalBankDataProfileId == CZFioId)
|
||||
{
|
||||
// Czech Fio Bank
|
||||
|
||||
result.Name = "CZ Fio";
|
||||
result.Country = Structure.Country.FromCode("CZ");
|
||||
result.Culture = "cz-CZ";
|
||||
|
||||
result.FieldNames[ExternalBankDataFieldName.Date] = "...Continue here...";
|
||||
}
|
||||
|
||||
throw new ArgumentException ("Unrecognized profile Id");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
using Swarmops.Common.Interfaces;
|
||||
using Swarmops.Logic.Structure;
|
||||
|
||||
namespace Swarmops.Logic.Financial
|
||||
{
|
||||
[Serializable]
|
||||
public class FinancialAccountAutomationProfile: IHasIdentity
|
||||
{
|
||||
public int FinancialAccountAutomationProfileId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public bool CanRetrieve { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public Country Country
|
||||
{
|
||||
get { return CountryId != 0? Country.FromIdentity(CountryId): null; }
|
||||
set { this.CountryId = (value == null? 0: value.Identity); }
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public Currency Currency
|
||||
{
|
||||
get { return CurrencyId != 0? Currency.FromIdentity(CurrencyId): null; }
|
||||
set { this.CurrencyId = (value == null? 0: value.Identity); }
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public ExternalBankDataProfile BankDataProfile
|
||||
{
|
||||
get { return BankDataProfileId != 0 ? ExternalBankDataProfile.FromIdentity(BankDataProfileId): null; }
|
||||
set { this.BankDataProfileId = (value == null ? 0 : value.Identity); }
|
||||
}
|
||||
|
||||
protected int BankDataProfileId { get; set; }
|
||||
protected int CountryId { get; set; }
|
||||
protected int CurrencyId { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public int Identity { get { return FinancialAccountAutomationProfileId; } }
|
||||
}
|
||||
|
||||
|
||||
|
||||
public enum FinancialAccountAutomationProfileHardIds
|
||||
{
|
||||
Unknown = 0,
|
||||
BitcoinHotwallet = 1,
|
||||
BitcoinCashArmory = 2,
|
||||
BitcoinCoreArmory = 3,
|
||||
BankPaypal = 4,
|
||||
BankSwedenSeb = 5,
|
||||
BankGermanyPostbank = 6,
|
||||
BankCzechFio = 7
|
||||
}
|
||||
}
|
||||
@@ -3,9 +3,9 @@
|
||||
// ReSharper disable InconsistentNaming
|
||||
internal class StockBankDataReaders
|
||||
{
|
||||
public static string TabSeparatedValuesAccountReader
|
||||
public static string CommaSeparatedValuesAccountReader
|
||||
{
|
||||
get { return "TabSeparatedValuesReader"; }
|
||||
get { return "CommaSeparatedValuesReader"; }
|
||||
}
|
||||
|
||||
public static string SemicolonSeparatedValuesAccountReader
|
||||
|
||||
@@ -135,6 +135,7 @@
|
||||
<Compile Include="Financial\BitcoinTransactionInput.cs" />
|
||||
<Compile Include="Financial\BitcoinUtility.cs" />
|
||||
<Compile Include="Financial\ExpenseClaimGroup.cs" />
|
||||
<Compile Include="Financial\FinancialAccountAutomationProfile.cs" />
|
||||
<Compile Include="Financial\HotBitcoinAddress.cs" />
|
||||
<Compile Include="Financial\HotBitcoinAddresses.cs" />
|
||||
<Compile Include="Financial\HotBitcoinAddressUnspent.cs" />
|
||||
|
||||
@@ -525,8 +525,10 @@
|
||||
function onToggleChange(newValue, cookie) {
|
||||
if (newValue) {
|
||||
$(".DivEditAutomationControls").slideDown();
|
||||
$(".DivEditNonautomationControls").slideUp();
|
||||
} else {
|
||||
$(".DivEditAutomationControls").slideUp();
|
||||
$(".DivEditNonautomationControls").slideDown();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -621,9 +623,8 @@
|
||||
<label for="CheckAccountAdministrative"><asp:Literal ID="LiteralLabelAdministrativeShort" runat="server"/></label><div class="CheckboxContainer"><input type="checkbox" rel="Administrative" class="EditCheck" id="CheckAccountAdministrative"/></div>
|
||||
<br/></div>
|
||||
<div class="DivEditInitControls">
|
||||
<Swarmops5:TextCurrency ID="CurrencyInitialBalance" runat="server" />
|
||||
<div class="DivEditAssetControls">
|
||||
<div class="DivEditForexControls"><Swarmops5:TextCurrency ID="CurrencyInitialBalanceForex" runat="server" /></div>
|
||||
<div class="DivEditNonautomationControls">
|
||||
<Swarmops5:TextCurrency ID="CurrencyInitialBalance" runat="server" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="DivEditAssetControls">
|
||||
@@ -653,8 +654,8 @@
|
||||
<asp:Literal ID="LiteralLabelActiveLong" runat="server"/><br/>
|
||||
<asp:Literal ID="LiteralLabelExpensableLong" runat="server"/><br/>
|
||||
<asp:Literal ID="LiteralLabelAdministrativeLong" runat="server"/><br/></div>
|
||||
<div id="DivEditInitLabels"><asp:Literal ID="LiteralLabelInitialAmount" runat="server"/><br/>
|
||||
<div class="DivEditAssetControls"><div class="DivEditForexControls">Initial Balance (<span class="SpanAccountCurrencyCode">XXX</span>)</div></div>
|
||||
<div id="DivEditInitLabels">
|
||||
<div class="DivEditNonAutomationControls"><asp:Literal ID="LiteralLabelInitialAmount" runat="server"/><br/></div></div>
|
||||
</div>
|
||||
<div class="DivEditAssetControls">
|
||||
<h2><asp:Label ID="LabelHeaderAutomation" runat="server"/></h2>
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Web;
|
||||
using System.Web.Management;
|
||||
using System.Web.Services;
|
||||
using System.Web.UI.WebControls;
|
||||
using Resources;
|
||||
@@ -101,9 +102,12 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
|
||||
// Hardcoded automation profiles for the time being
|
||||
|
||||
this.DropAccountAutomationProfile.Items.Add(new ListItem("[CZ CZK] Fio CSV", "3"));
|
||||
this.DropAccountAutomationProfile.Items.Add(new ListItem("[DE EUR] Postbank CSV", "2"));
|
||||
this.DropAccountAutomationProfile.Items.Add(new ListItem("[SE SEK] SEB CSV", "1"));
|
||||
this.DropAccountAutomationProfile.Items.Add(new ListItem("[BTC] Bitcoin Core - Armory", "3"));
|
||||
this.DropAccountAutomationProfile.Items.Add(new ListItem("[BCH] Bitcoin Cash - Armory", "2"));
|
||||
this.DropAccountAutomationProfile.Items.Add(new ListItem("[BCH] Bitcoin Cash Hotwallet", "1"));
|
||||
this.DropAccountAutomationProfile.Items.Add(new ListItem("[CZ CZK] Fio CSV", "7"));
|
||||
this.DropAccountAutomationProfile.Items.Add(new ListItem("[DE EUR] Postbank CSV", "6"));
|
||||
this.DropAccountAutomationProfile.Items.Add(new ListItem("[SE SEK] SEB CSV", "5"));
|
||||
|
||||
}
|
||||
PageAccessRequired = new Access (CurrentOrganization, AccessAspect.Bookkeeping, AccessType.Write);
|
||||
@@ -561,7 +565,19 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
|
||||
private static AutomationData GetAccountAutomationData(int profileId)
|
||||
{
|
||||
|
||||
AutomationData result = new AutomationData();
|
||||
|
||||
result.AutomationProfileCustomXml = string.Empty;
|
||||
result.AutomaticRetrievalPossible = false;
|
||||
result.AutomationProfileId = profileId;
|
||||
result.AutomationEnabled = (profileId != 0);
|
||||
|
||||
if (result.AutomationEnabled)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -642,9 +658,13 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
public bool AutomationEnabled { get; set; }
|
||||
public int AutomationProfileId { get; set; }
|
||||
public string AutomationCurrencyCode { get; set; }
|
||||
public string AutomationCountryCode { get; set; }
|
||||
public bool NonPresentationCurrency { get; set; }
|
||||
public bool SetInitialBalance { get; set; }
|
||||
public bool AutomaticRetrievalPossible { get; set; } // always false for now
|
||||
public string AutomationProfileCustomXml { get; set; } // always empty for now
|
||||
|
||||
public FinancialAccountAutomationProfile Profile { get; set; }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
|
||||
@@ -165,15 +165,6 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers {
|
||||
/// </remarks>
|
||||
protected global::Swarmops.Frontend.Controls.Financial.CurrencyTextBox CurrencyInitialBalance;
|
||||
|
||||
/// <summary>
|
||||
/// CurrencyInitialBalanceForex control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::Swarmops.Frontend.Controls.Financial.CurrencyTextBox CurrencyInitialBalanceForex;
|
||||
|
||||
/// <summary>
|
||||
/// ToggleAssetAutomation control.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user